Skip to main content

Incoming MO Messages

To receive incoming SMS, you must acquire one or more numbers from the number inventory and assign them to an API Key. Each API Key can have multiple numbers associated with it for receiving inbound messages.

Upon a receipt of an incoming SMS that has been sent to one of the numbers assigned to your account, then an Incoming Message will be posted to a Webhook address. This Webhook address can be set up in the Customer Portal as part of the configuration of the Number that you have selected from the number pool and assigned to your account.

The incoming message Webhook should be acknowledged with an HTTP 200 OK response. If the incoming message is unable to connect to the Webhook address or if a non HTTP 200 Ok response is received, it will be queued and re-tried for up to 24 hours before being discarded.

The Webhook call will be sent as a POST with a JSON document in the request body. It will be of the following format:

Endpoint

Webhook calls are sent as HTTP POST requests with a JSON body.

POST {Your Webhook URL registered in the Rakuten CPaaS or provided in request as "custom_callback_url"}

Request Parameters

List of JSON fields included in the Webhook POST body.

ParameterRequiredDescription/Values
message_idYThe message ID returned in the submit SMS API request
sender_addressYSender phone number
destination_addressYDestination phone number assigned to your account
content_typeYEncoding type: text (GSM-7), unicode (UTF-16)
udhOptionalHex representation of the UDH (User Data Header) field, present in concatenated or specially encoded messages. Empty string if not used.
message_bodyYThe text content of the received SMS message

Example Payload

Example JSON body received at your Webhook endpoint.

{
"message_id": "...the message id returned in the submit sms API request...",
"sender_address": "...sender address...",
"destination_address": "...destination phone number...",
"content_type": "text, unicode or binary",
"udh": "...hex representation of the udh field if present in the message...",
"message_body": "The contents of the message being delivered"
}

Sample Payload

{
"message_id": "msg-00123abc456def789",
"sender_address": "819012345678",
"destination_address": "815011112222",
"content_type": "unicode",
"udh": "",
"message_body": "Thank you for contacting us. Your inquiry number is 12345."
}

Command to verify your Webhook endpoint in a local development environment.

curl -X POST http://localhost:3000/mo-webhook \
-H "Content-Type: application/json" \
-d '{
"message_id": "test-msg-001",
"sender_address": "819012345678",
"destination_address": "815011112222",
"content_type": "text",
"udh": "",
"message_body": "This is a test message"
}'

Implementation Notes

ItemDetails
Response RequirementMust return HTTP 200 OK. Any other response code triggers a retry.
Retry PolicyOn connection failure or non-200 response, retried for up to 24 hours then automatically discarded.
IdempotencyRetries may deliver the same message_id more than once. Strongly recommended to implement deduplication using message_id.
content_typeWhen content_type is unicode, the body is UTF-16 encoded. SMS containing Japanese characters or emoji is typically unicode.
Concatenated SMSLong messages are split and delivered in parts. The udh field contains concatenation reference, total parts, and sequence number — implement reassembly logic as needed.
HTTPS RequiredAlways use HTTPS for your Webhook URL in production environments.