Webhooks
Listen for events on your SMSPortal account so your API integration can automatically trigger reactions.
Webhooks provide a powerful method to receive event notifications such as delivery statuses, replies to your SMSes and Short Codes , and URL clicks that have just occurred.
Begin using webhooks with your SMSPortal integration in just three simple steps:
- Create a webhook endpoint on your server.
- Use the SMSPortal Control Panel to test that your endpoint works.
- Save your endpoints and go live.
What are webhooks
Webhooks refers to a combination of elements that collectively create a notification and reaction system within a larger integration.
Webhooks are like a phone number that SMSPortal calls to notify you of activity in your SMSPortal account. The activity could be a delivery status, reply or click from a mobile subscriber. The webhook endpoint is the person answering that call who takes actions based upon the specific information it receives.
The webhook endpoint is just code on your server, which could be written in any programming language you choose. This endpoint has an associated URL (e.g. https://yourdomain.com/webhooks). The SMSPortal notifications are Event objects. This Event object contains all the relevant information about what just happened, including the type of event and the data associated with that event. You can then use these webhooks to trigger any required actions, such as automatically initiating another SMS or call to the mobile subscriber, updating CRM systems or updating statistics and calculating ROI on your campaigns.
Webhooks are the fastest way to receive delivery statuses, replies and clicks as an HTTP Request is performed by our servers to specified URLs as soon as the delivery status, reply and / or click is received. This mechanism of receiving delivery statuses, replies and / or clicks removes the latency that is involved with the constant polling for new data.
When to use webhooks
Many events that occur within a SMSPortal account have synchronous results. These results are immediate and directly respond to an executed request. For example, a successful request to send an SMS immediately returns a response with an EventID. Such requests don’t require webhooks, as the key information is already available.
Other events that occur within a SMSPortal account are asynchronous: happening at a later time and not directly in response to your code’s execution. Most commonly these involve:
- Delivery Receipt Statuses
- Replies to your SMSes and Short Codes
- URL Previews and Click Tracking
With these and similar APIs, SMSPortal needs to notify your integration about changes to the status of an object so your integration can take subsequent steps.
The specific actions your webhook endpoint may take differs based upon the event. Some examples include:
- Updating a customer’s record in your database based on the delivery receipt status.
- Contacting a customer when they respond positively to a SMS or short code.
- Removing a customer from future correspondence when they opt-out.
- Triggering additional SMSes or remarketing to customers that preview or click your URL.
Updated 12 months ago