Skip to main content

USSD Session Webhook

The USSD API sends POST requests to your configured endpoint for each stage of a USSD session. Your endpoint should parse the payload and return a JSON response that tells the network whether to continue or end the session.

Overview

The USSD session follows three stages:
  1. Begin: Starts a new session.
  2. Continue: Sends user input during an active session.
  3. End: Closes the session and displays a final response.
Your endpoint must be reachable and return valid JSON quickly. If the callback fails or times out, the session may terminate for the user.

Endpoint Setup

Provide a publicly reachable POST URL that can:
  • Receive JSON payloads for begin and continue events.
  • Return JSON responses in the expected format.
  • Handle optional backend data when provided by the network/backend.

Request Format

Begin Request

Continue Request

Response Format

Continue Response (Prompt User for More Input)

Use this response when you want the session to remain active.

End Response (Close Session)

Use this response when the interaction is complete.

Field Descriptions

Common Fields

string
required
Subscriber phone number (for example, 2348099999999).
string
required
Mobile network name. Expected values include 9mobile, mtn, glo, and airtel.
string
required
USSD shortcode used for the session (for example, 123).
string
required
Current USSD input/message content.

Session Fields

number
required
Session stage code (2 = begin, 3 = continue, 4 = end).
string
required
Session stage name (begin, continue, end).
number
UI mode code (0 = none, 1 = input, 2 = dialog).
string
UI mode name (none, input, dialog).

Optional Backend Fields

object
Optional backend payload. This may vary by telco/network integration and can be omitted in responses.
object
USSD backend body information.
object
USSD backend header information.

Status Fields

number
Request status code (for example, 200).
string
Request status message (for example, OK).

Best Practices

  • Return only valid JSON in the expected shape.
  • Keep responses short and fast to avoid session timeout.
  • Treat backend as optional and parse defensively.
  • Log msisdn, session.type, and text for troubleshooting.