- Stitch >
- Introduction >
- Live Examples
Create Server-side Functions & Webhooks¶
You can run server-side functions in response to events in external applications by having those applications call incoming webhooks. Information about each event can be included in the HTTP request used to trigger a webhook and processed in the webhook function.
Respond to a Webhook¶
Some services allow you to call back to your server with a webhook. One such service is Twilio, which can be set up to forward any text messages it receives to your application by sending a POST request to your webhook URL.
In the following example, you can add a message to a message board by
sending a text message to a Twilio phone number. You can also look up
any messages you’ve sent by phone number.
Twilio encodes information about each message into a request that it
sends to the webhook url. When the webhook receives the request, it
runs the textMessageHandler
function which stores the message in
MongoDB.
Live Example
Try to send a message longer than 50 characters. You should receive a response text message informing you that your message is too long.