Skip to content

Hubtel

Point your Hubtel shortcode at Asterisks, test it, and see the request and response format.

Before you start

  • A Hubtel account with a USSD shortcode (or a shared-code extension) assigned to you.
  • An Asterisks app, tested in the phone preview. New to Asterisks? Start with the Quickstart.
  • Hubtel selected in the builder's top bar, so the callback address is in Hubtel's format.

Connect Hubtel

  1. Deploy your app

    In the builder, press Save, then Deploy. Enter the shortcode Hubtel gave you and press Deploy.
  2. Copy the callback address

    Under Callback URL for Hubtel, press the copy button. It looks like this, with your app's id at the end:
    Callback address for Hubtel
    https://apis.useasterisks.com/api/ussd/hubtel/your-app-id
  3. Paste it into Hubtel

    Sign in to Hubtel, open the settings for your USSD shortcode, and paste the address into the callback field. Hubtel may call it the Service Interaction URL or callback URL. Save.
Tip: Can't find the field, or don't have access to it? Send the address to your Hubtel account manager and ask them to point your shortcode at it.

Test the connection

  1. Open Live sessions

    In the Asterisks dashboard, keep Live sessions open.
  2. Dial your shortcode

    From a phone on a network Hubtel covers. Your first screen should appear, and the session shows up in Live sessions.
  3. Go through every path

    Try each option and a few wrong answers, as you did in the preview.

Nothing happens, or you see an error? Check Troubleshooting.

Technical details

You don't need this to get started. It is here for developers and for Hubtel's support team.

What Hubtel sends

Request
POST /api/ussd/hubtel/{appId}
Content-Type: application/json

{
  "SessionId": "3c7d1f0b...",
  "Mobile": "233244123456",
  "ServiceCode": "713",
  "Type": "Initiation",
  "Message": "*713#",
  "Operator": "mtn",
  "Sequence": 1
}

Type is Initiation on dial, Response for each reply, and Release or Timeout when the caller hangs up or times out.

What Asterisks answers

Response
{
  "SessionId": "3c7d1f0b...",
  "Type": "Response",
  "Message": "Coffee Shop\n1. Order coffee\n2. Opening hours\n3. Exit",
  "ClientState": ""
}

Type is Response to wait for a reply, or Release to end the session.

The Network variable

{{Network}} holds the caller's network as Hubtel reports it in Operator.