LineDevelopers

Simulate a customer reply

POST/api/v1/sandbox/inbound

Test keys only. Line stores a received message from from to your number in to, and sends message.received to your test webhooks.

  • A STOP word, such as STOP or UNSUBSCRIBE, also sends contact.opted_out.
  • A START word after a simulated STOP also sends contact.opted_in.

The sandbox keeps no opt-out list, so a simulated STOP does not block later test sends. Read the reply with GET /api/v1/messages?direction=inbound.

Bearer key, test or live

Request body

fromstringrequired

The customer's number in E.164 format.

tostringrequired

One of your SMS numbers in E.164 format, from GET /api/v1/phone-numbers.

bodystringrequired

The customer's text.

Responses

201The received sandbox message, and the event types Line sent.
403The key is a live key, or it lacks the messages.send scope.
422The number in to is not an SMS number this key may use.
Plus 400, 401, 403, 429, 503. See Errors.
curl -X POST 'https://staging.useline.io/api/v1/sandbox/inbound' \
  -H "Authorization: Bearer $LINE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "+447700900456",
    "to": "+447700900123",
    "body": "Thanks, see you then."
  }'
Response 201
{
  "id": "3c9e7a14-8b2d-4f61-a0e5-7d1b9c2f4a86",
  "conversation_id": null,
  "status": "received",
  "direction": "inbound",
  "livemode": false,
  "from": "+447700900456",
  "to": "+447700900123",
  "sender_type": "phone_number",
  "body": "Thanks, see you then.",
  "encoding": "GSM-7",
  "segments": 1,
  "estimated_credits": "0",
  "events": [
    "message.received"
  ],
  "request_id": "req_6b1f0c2a"
}