Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

What is a Webhook?


Webhooks(link takes you to an external page) are user-defined HTTP(link takes you to an external page) callbacks. They are triggered by some event in a web application and can facilitate integrating different applications or third-party APIs, like Twilio.

Want to learn more about how Twilio uses webhooks? Check out the Webhooks Hub in our developer documentation!


More on Webhooks

more-on-webhooks page anchor

Twilio uses webhooks to let your application know when events happen, such as receiving an SMS message or getting an incoming phone call. When the event occurs, Twilio makes an HTTP request (usually a POST or a GET(link takes you to an external page)) to the URL you configured for the webhook. Twilio's request will include details of the event such as the incoming phone number or the body of an incoming message. Many other modern web services like GitHub and Slack also make use of webhooks to communicate events.

How webhooks work.

To handle a webhook you only need to build a small web application that can accept the HTTP requests. If you already have a web application set up, handling a webhook is usually as easy as adding a new URL to your application.

If you don't already have a web application, almost all server-side programming languages offer frameworks to help you build one. Examples include:

Webhooks can also be handled by serverless frameworks like AWS Lambda(link takes you to an external page) and Azure Functions(link takes you to an external page). Really anything that can receive and reply to an HTTP request will do. Got a Raspberry Pi(link takes you to an external page) lying around?

Whichever framework and language you choose, webhooks function the same for every Twilio application. An HTTP request will be made to a URI(link takes you to an external page) that you provide to Twilio. Your application performs whatever logic you feel necessary - read/write from a database, integrate with another API, or perform some computation - then replies to Twilio with a TwiML response with the instructions you want Twilio to perform.

Ready to do more with Webhooks?

ready-to-do-more-with-webhooks page anchor

Check out these tutorials that show you how to work with webhooks on a variety of platforms:


Rate this page: