Inbounds

Inbounds, or Mobile Originated (MO) messages, are incoming messages. Inbound messages can be listed and retrieved like batch messages and they can also be delivered by callback requests like delivery reports.

MMS Media error codes

The REST API handles MO media messages by uploading them to specified s3 storage location and providing the URL to download the attachment. On a successful upload, the code will be 0. If the upload fails, the code will be a value other than 0.

Status Code Name Status Description
0 Uploaded Uploaded Attachment successfully uploaded to storage.
1 Internal failure Failed Internal exception happened during upload.
2 Bucket not found Failed Provisioned bucket doesn't exist.

List incoming messages

With the list operation, you can list all inbound messages that you have received. This operation supports pagination. Inbounds are returned in reverse chronological order.

SecurityBearerAuth
Request
path Parameters
service_plan_id
required
string

Your service plan ID. You can find this on your Dashboard.

Example: jd63jf88477ll123ab4567cd89012ef3
query Parameters
page
integer >= 0
Default: 0

The page number starting from 0.

Example: page=2
page_size
integer <= 100
Default: 30

Determines the size of a page

to
string

Only list messages sent to this destination. Multiple phone numbers formatted as either E.164 or short codes can be comma separated.

Example: to=+14155553421, +13435552671, +14325552677
start_date
string <ISO-8601>
Default: "Now-24"

Only list messages received at or after this date/time. Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ.

Default: Now-24

end_date
string <ISO-8601>

Only list messages received before this date/time. Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ.

Example: end_date=2016-10-02T09:34:18.542Z
client_reference
string [ 0 .. 2048 ] characters

Using a client reference in inbound messages requires additional setup on your account. Contact your account manager to enable this feature.

Only list inbound messages that are in response to messages with a previously provided client reference.

Example: client_reference=myReference
Responses
200

OK. A successful response , or an Error.

Response Schema: application/json
count
integer <int64>

The total number of inbounds matching the given filters

page
integer <int32>

The requested page.

Array of Text MO (object) or Binary MO (object) or Media MO (object)

The page of inbounds matching the given filters.

page_size
integer <int32>

The number of inbounds returned in this request.

get/xms/v1/{service_plan_id}/inbounds
Request samples
Response samples
application/json
{
  • "count": 1,
  • "page": 0,
  • "inbounds": [
    • {
      }
    ],
  • "page_size": 50
}

Retrieve inbound message

This operation retrieves a specific inbound message with the provided inbound ID.

SecurityBearerAuth
Request
path Parameters
service_plan_id
required
string

Your service plan ID. You can find this on your Dashboard.

Example: jd63jf88477ll123ab4567cd89012ef3
inbound_id
required
string

The inbound ID found when listing inbound messages.

Example: 01FC66621XXXXX119Z8PMV1QPA
Responses
200

OK. A successful response , or an Error.

Response Schema: application/json
One of:

The page of inbounds matching the given filters.

body
required
string [ 0 .. 2000 ] characters
from
required
string

The phone number that sent the message. More info

id
required
string

The ID of this inbound message.

received_at
required
string <date-time>

When the system received the message.

Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ.

to
required
string

The Sinch phone number or short code to which the message was sent.

type
required
string

Regular SMS

Value: "mo_text"
client_reference
string

If this inbound message is in response to a previously sent message that contained a client reference, then this field contains that client reference.

Utilizing this feature requires additional setup on your account. Contact your account manager to enable this feature.

operator_id
string

The MCC/MNC of the sender's operator if known.

sent_at
string <date-time>

When the message left the originating device. Only available if provided by operator.

Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ.

get/xms/v1/{service_plan_id}/inbounds/{inbound_id}
Request samples
Response samples
application/json
{
  • "body": "Test message",
  • "client_reference": "ABC123",
  • "from": "+11203494390",
  • "id": "01FC66621XXXXX119Z8PMV1QPA",
  • "operator_id": "35000",
  • "received_at": "2019-08-24T14:15:22Z",
  • "sent_at": "2019-08-24T14:15:22Z",
  • "to": "11203453453",
  • "type": "mo_text"
}

Incoming SMSWebhook

An inbound message is a message sent to one of your short codes or long numbers from a mobile phone. To receive inbound message callbacks, a URL needs to be added to your REST API. This URL can be specified in your Dashboard.

Request
Request Body schema: application/json

The incoming message to your sinch number

One of:

The page of inbounds matching the given filters.

body
required
string [ 0 .. 2000 ] characters
from
required
string

The phone number that sent the message. More info

id
required
string

The ID of this inbound message.

received_at
required
string <date-time>

When the system received the message.

Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ.

to
required
string

The Sinch phone number or short code to which the message was sent.

type
required
string

Regular SMS

Value: "mo_text"
client_reference
string

If this inbound message is in response to a previously sent message that contained a client reference, then this field contains that client reference.

Utilizing this feature requires additional setup on your account. Contact your account manager to enable this feature.

operator_id
string

The MCC/MNC of the sender's operator if known.

sent_at
string <date-time>

When the message left the originating device. Only available if provided by operator.

Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ.

Responses
200

A 2xx status code indicates that the data was received successfully.

400

A 4xx status counts as a permanent failure and will not trigger any retries, except for 429.

429

The callback will be retried and the callback throughput will be lowered.

500

A 5xx status code will trigger a retry.

Request samples
application/json
{
  • "body": "This is a test message.",
  • "from": "16051234567",
  • "id": "01XXXXX21XXXXX119Z8P1XXXXX",
  • "operator_id": "string",
  • "received_at": "2022-08-24T14:15:22Z",
  • "sent_at": "2022-08-24T14:15:22Z",
  • "to": "13185551234",
  • "type": "mo_text"
}