Tutorials
Receive an SMS message using Infobip API
Receive an SMS message using Infobip API

Receive an SMS message using Infobip API

In this tutorial, you will learn how to send an SMS message from your handset to a webhook that you have configured. This will simulate a scenario in which an end user can reply to an SMS and their message gets stored in a third-party application that you manage.

The tutorial assumes basic familiarity with APIs. It is important however that you are faimiliar with the webhook technology and how to utilize it for this project. For the ease of replicating the scenario, we have used a free online webhook tool, HookRelay (opens in a new tab).

Prerequisites

Implementation

  1. Buy a number capable of receiving incoming SMS traffic.
  2. Set up a webhook.
  3. Add webhook details to the number you've purchased.
  4. Receive an SMS on your webhook.

Buy a number

To buy a number, you'll need to log into your Infobip account (opens in a new tab). If using the Infobip test sender, skip this section.

  1. Expand the Channels and Numbers icon on the left-hand side menu, and select Numbers.
  2. On the Numbers screen, click Buy Number.
  3. Set up your number preferences, like a country, number type, etc.
  4. Once you chose all details, 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 (opens in a new tab). This section will show you how to create and account and configure the webhook with HookRelay.

Step 1. Sign in with git credentials

Sign in to HookRelay (opens in a new tab) with your GitHub or GitLab credentials. Once logged in, you'll access a dashboard where you can start creating webhooks.

Step 2. Create a webook

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 providing is a descriptive name for your webhook, e.g. Infobip Receive SMS and to make sure it's able to receive incoming traffic.

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 (opens in a new tab) and access your number configuration page (Channels and Numbers > Numbers). If using the Infobip test sender, configure that number.

  1. Select the number and click the SMS tab.
  2. Under Keywords, click the plus icon to add a keyword.
  3. Use the Forwarding action dropdown to select the Forward to HTTP option.
  4. Under URL provide the URL of the webhook that you have created.
  5. Select MO_JSON_2 as a Renderer Type.
  6. Click CONFIGURE to save configuration.

Receive an SMS on your webhook

Now that we have everything configured, to test that all works as expected, send an SMS (opens in a new tab) 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": "447491163443",
      "text": "SEND10",
      "cleanText": "",
      "keyword": "SEND10",
      "receivedAt": "2025-03-13T11:43:00.603+0000",
      "smsCount": 1,
      "messageId": "2491729790183409612",
      "pairedMessageId": null,
      "price": {
        "pricePerMessage": 0,
        "currency": "EUR"
      },
      "callbackData": null
    }
  ],
  "messageCount": 1,
  "pendingMessageCount": 0
}

Useful links

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products