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
| Field | Type | Required | Description |
|---|---|---|---|
| sessionId | string | required | The same for every step of one session. Use it to store where the dialer is. |
| msisdn | string | required | The dialer's phone number in international format without +, as reported by their network. |
| action | string | required | "start" when they dial, "continue" when they answer a screen. |
| userInput | string | optional | What they typed on the last screen. Only on continue. |
| ussdString | string | required | The same input as userInput; an empty string on start. |
| ussdCode | string | required | Your code's extension, e.g. "144". |
| fullCode | string | required | The full code dialled, e.g. "*889*144#". Useful if one backend serves several codes. |
| businessId | string | required | Your Sendexa workspace ID. |
| messageType | string | required | Always "0". You can ignore it. |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
| Content-Type | string | required | application/json |
| X-Sendexa-Signature | string | 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.