USSD
Stable

Handle requests

What Sendexa posts to your backend URL at each step of a session.

POST your backend URL
application/json

One request when someone dials your code, then one each time they answer a screen. Every request carries only the latest input, so keep the rest of the session yourself, keyed by sessionId.

JSON
{
"sessionId": "171632898024603649",
"msisdn": "233244123456",
"action": "start",
"ussdString": "",
"messageType": "0",
"ussdCode": "144",
"fullCode": "*889*144#",
"businessId": "BU-68KZZBUX"
}

Fields

FieldTypeRequiredDescription
sessionIdstring
required
The same for every step of one session. Use it to store where the dialer is.
msisdnstring
required
The dialer's phone number in international format without +, as reported by their network.
actionstring
required
"start" when they dial, "continue" when they answer a screen.
userInputstringoptionalWhat they typed on the last screen. Only on continue.
ussdStringstring
required
The same input as userInput; an empty string on start.
ussdCodestring
required
Your code's extension, e.g. "144".
fullCodestring
required
The full code dialled, e.g. "*889*144#". Useful if one backend serves several codes.
businessIdstring
required
Your Sendexa workspace ID.
messageTypestring
required
Always "0". You can ignore it.

Headers

FieldTypeRequiredDescription
Content-Typestring
required
application/json
X-Sendexa-Signaturestring
required
t=<unix seconds>,v1=<HMAC-SHA256 of "<t>.<raw body>" with your signing key>. Check it before trusting msisdn or anything else.

See Verify requests for the check in each language, and Sample code for complete backends.