HubtelDevelopers
Guides

Service interactions and responses

Handle each step of a customer's USSD, Hubtel App or Webstore session, and return a menu, an input screen or an item to pay for.

Updated 26 Nov 2026

Hubtel sends each step of a customer's session to your Service Interaction URL. Reply with the next screen, end the session, or send the item to checkout.

Register your endpoint as described in Programmable Services. Field names and values are case-sensitive.

Incoming request

FieldTypeMeaning
TypeStringInitiation starts a session, Response continues it, and Timeout means the customer cancelled the session.
MessageStringCustomer input, or the dialled USSD string at initiation.
ServiceCodeStringService code, for example 711*2.
OperatorStringmtn, vodafone (Telecel), tigo or airtel (AirtelTigo).
ClientStateStringThe ClientState you returned in your last response. It's sent once, then discarded.
MobileStringCustomer's phone number.
SessionIdStringIdentifier for the current session.
SequenceIntegerPosition of this message in the session.
PlatformStringUSSD, Webstore or Hubtel-App.
{
  "Type": "Initiation",
  "Mobile": "233249111411",
  "SessionId": "example-session",
  "ServiceCode": "713",
  "Message": "*713#",
  "Operator": "vodafone",
  "Sequence": 1,
  "ClientState": "",
  "Platform": "USSD"
}

Return a response

FieldRequiredMeaning
SessionIdYesReturn the session identifier from the request.
TypeYesresponse continues the session; release ends it; AddToCart ends the interaction and sends the item to checkout.
MessageYesUSSD display text. Use \n for new lines and write menu choices in the text.
MaskNoMarks the current message as masked.
ItemFor AddToCartPurchase object; leave empty for other response types.
ServiceCodeNoReturn the service code where needed.
LabelYesTitle shown on app and web channels.
DataTypeYesdisplay for information or input for customer input.
FieldTypeYesThe input control: text, phone, email, number (whole numbers), decimal or textarea.
SequenceNoMessage position.
ClientStateNoState to return with the next request.

Example session

Return a menu for the initiation request:

{
  "SessionId": "example-session",
  "Type": "response",
  "Message": "Choose a service\n1. Buy airtime\n2. Check balance",
  "Label": "Choose a service",
  "ClientState": "menu",
  "DataType": "input",
  "FieldType": "text"
}

When the customer selects 1, the next request has Type: "Response", Message: "1", Sequence: 2 and ClientState: "menu". Return a numeric input screen:

{
  "SessionId": "example-session",
  "Type": "response",
  "Message": "Enter the airtime amount",
  "Label": "Airtime amount",
  "ClientState": "amount",
  "DataType": "input",
  "FieldType": "decimal"
}

Use ClientState to know which question the customer is answering. Validate input such as the amount before you build an item.

Start payment with AddToCart

{
  "SessionId": "example-session",
  "Type": "AddToCart",
  "Message": "Your request has been submitted. Follow the payment prompt to continue.",
  "Item": { "ItemName": "Airtime", "Qty": 1, "Price": 5.0 },
  "Label": "Complete payment",
  "DataType": "display",
  "FieldType": "text"
}

AddToCart ends the session and starts payment. It isn't proof of payment: wait for the paid order at your Service Fulfilment URL. See Service fulfilment.

End a session and handle invalid responses

Return Type: "release" with the required fields to end a session without payment. A Timeout request means the customer left: don't create a purchase.

Don't use special characters such as É in Message. If customers see "The response from the provider of this service is invalid. Error: UUE", your response body isn't in the expected format: check the required fields.

On this page