2degrees

How can we help?

Webhooks

In this article:


A webhook (or callback) enables our platform to ping your application with information about a given event (such as a new inbound SMS received). This happens in real-time, allowing you to leverage the platform to create your own 2-way messaging solutions by sending SMS via the API, and processing any responses via Webhooks.


Common events that you will want to listen to:

To create a webhook, log-in, and go to Configuration, then Webhooks and select New Webhook:



Set up the basics of your webhook:


Next, specify any headers you would like to present in your request. To add additional header rows, simply click “Add Header”:


Next, specify the content to be passed in the content of the request to the specified endpoint.
A good default to specify would be the following:


id

$mtID

accountId

$accountId

sourceAddress

$sourceAddress

destinationAddress

$destinationAddress

messageContent

$mtContent

replyContent

$moContent



Finally, click “Save Webhook” in the bottom right of the screen.

In this example, we created a webhook that will POST to https://yourapplication.com/sms/inbound-sms when you receive a SMS, as a JSON request with the following information in the JSON body: id, accountId, sourceAddress, destinationAddress, messageContent, replyContent.