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:
- SMS -> Receive SMS
- SMS -> Opt-out occurred
- Delivery Reports -> Message is delivered
- Delivery Reports -> Message has expired
To create a webhook, log-in, and go to Settings > API and select the Webhooks tab. Then click "New Webhook":
Set up the basics of your webhook:
- Select the event(s) you want to listen for, (e.g. SMS -> Receive SMS)
- Select the HTTP Method you want us to send to your application (e.g. POST)
- Enter the URL where you want to process the event (e.g. https://yourapplication.com/sms/inbound-sms)
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.
Comments
0 comments
Article is closed for comments.