# Send SMS messages using Twilio from analytics events - Docs

You can use your PostHog event data to send SMS messages via Twilio. Here's everything you need to get started.

## Configuring Twilio

First, you'll need to create a Twilio account if you don't have one already. Then, gather the following credentials from your Twilio dashboard:

1.  **Account SID**: Found on your [Twilio Console Dashboard](https://console.twilio.com/)
2.  **Auth Token**: Found on your [Twilio Console Dashboard](https://console.twilio.com/)
3.  **From Phone Number**: This is the Twilio phone number you'll be sending messages from. You can find or purchase one in the [Phone Numbers section](https://console.twilio.com/us1/develop/phone-numbers/manage/incoming) of your Twilio account.

## Configuring PostHog's Twilio destination

1.  In PostHog, click the **[Data pipeline](https://app.posthog.com/data-management/destinations)** tab in the left sidebar.
2.  Click the [Destinations](https://app.posthog.com/data-management/destinations?search=twilio) tab.
3.  Click **New destination** and choose Twilio's **Create** button.

Enter your Account SID, Auth Token, and From Phone Number from Twilio. The recipient phone number can be extracted from your event properties.

> **Important:** The SMS body template has a character limit of 1600 characters. Messages exceeding this limit will fail to send.

### Filtering

Make sure to filter events to only those that contain a valid phone number property, as this is required for sending SMS messages.

### Testing

Once you've configured your Twilio destination, click **Start testing** to verify everything works the way you want. Switch off **Mock out async functions** in order to send a test SMS message via Twilio.

---

## FAQ

### Is the source code for this destination available?

PostHog is open-source and so are all the destinations on the platform. The [source code](https://github.com/PostHog/posthog/blob/master/nodejs/src/cdp/templates/_destinations/twilio/twilio.template.ts) is available on GitHub.

### What happens if the SMS body exceeds 1600 characters?

If your SMS body template generates a message longer than 1600 characters, the message will fail to send. Make sure to keep your templates concise or include logic to truncate long messages.

### What phone number format is required?

Phone numbers should be in E.164 format (e.g., +1234567890). This includes the country code preceded by a plus sign, followed by the phone number without spaces or special characters.

### Who maintains this?

This is maintained by PostHog. If you have issues with it not functioning as intended, please [let us know](https://us.posthog.com/#panel=support%3Asupport%3Aapps%3A%3Atrue)!

### What if I have feedback on this destination?

We love feature requests and feedback. Please [tell us what you think](https://us.posthog.com/#panel=support%3Afeedback%3Aapps%3Alow%3Atrue).

### What if my question isn't answered above?

We love answering questions. Ask us anything via [our community forum](/questions.md).

### Community questions

Ask a question

### Was this page useful?

HelpfulCould be better