As an outcome of this guide, you will be able to send an SMS message from your handset to a webhook that you have configured, which will simulate a scenario in which an end user can reply to an SMS and their message gets stored in a third-party application.


Prerequisites

Infobip account

• a webhook that will listen to incoming events

Difficulty level

This guide assumes basic familiarity with APIs. It is important however that you are familiar with the webhook technology and how to utilize it for this project. For ease of replicating the scenario, we have used a free online webhook tool, HookRelay.

Summary of the steps

• Buy a number capable of receiving incoming SMS traffic.
• Set up a webhook.
• Add webhook details to the number you’ve purchased.
• Receive an SMS on your webhook.

Buy a number

To buy a number, you’ll need to log into your Infobip account.

  1. Click on the Channels and Numbers icon on the left-hand side menu.
  2. On the Channels Essentials screen click Numbers.
  3. On the Numbers screen, click Buy Number.
  4. Set up filter options to narrow down your choices:
    • Use Filter By Country to select the country you want to test the number in.
    • Use Filter By Capability to select SMS as an option.
  5. Click Buy to finalize the purchase.

Set up a webhook

For the purpose of this guide, we will use a simple online webhook tool, HookRelay. This section will show you how to create an account and configure the webhook with HookRelay.

Step 1. Sign in with git credentials

Sign in to HookRelay with your GitHub or GitLab credentials. Once logged in, you’ll access a dashboard where you can start creating webhooks.

Step 2. Create a webhook

To create an inbound webhook, from your dashboard, click the New Hook button on the top right. That will take you to the configuration screen where all you need to provide is a descriptive name for your webhook, e.g. Infobip Receive SMS.

Once you click the Create hook button, you’ll be able to view and copy its URL that you will need to add to your number configuration in your Infobip account.

Configure your number with webhook details

Head back to your Infobip account and access your number configuration page (Channels and Numbers > Numbers).

  1. Select the number you’ve purchased and click on Add Keyword to configure forwarding options. You can leave the Keyword field empty.
  2. Use the Forwarding dropdown to select the Forward to HTTP option. This will expand more options to configure.
  3. Select POST for a Method, and JSON as a Format.
  4. Under Forwarding provide the URL of the webhook that you have created.
  5. Click Save.

Receive an SMS on your webhook

Now that we have everything configured, to test that all works as expected, send an SMS from your handset to the number you have purchased. This should trigger an event, and you should see your message in JSON format arriving at your webhook.

{
  "results": [
    {
      "from": "447415774432",
      "to": "447860098667",
      "text": "One more message",
      "cleanText": "One more message",
      "keyword": null,
      "receivedAt": "2022-07-14T13:47:33.293+0000",
      "smsCount": 1,
      "messageId": "8254676033717801584",
      "pairedMessageId": null,
      "price": {
        "pricePerMessage": 0.0,
        "currency": "EUR"
      },
      "callbackData": null
    }
  ],
  "messageCount": 1,
  "pendingMessageCount": 0
}