---
title: Twilio
description: Configure Twilio as an SMS provider in Notiflows
---

Twilio is a global SMS delivery platform with carrier-grade reliability.

## Prerequisites

Before configuring Twilio in Notiflows, you need:

1. A [Twilio account](https://www.twilio.com/try-twilio)
2. Your Account SID and Auth Token
3. A phone number, messaging service, or short code to send from

## Configuration

| Field | Required | Description |
|-------|----------|-------------|
| Account SID | Yes | Your Twilio Account SID |
| Auth Token | Yes | Your Twilio Auth Token |
| From Type | Yes | How to identify the sender: **Phone Number**, **Messaging Service SID**, or **Short Code** |
| Phone Number | Conditional | Sender phone number in E.164 format (e.g., `+15551234567`) |
| Messaging Service SID | Conditional | Twilio Messaging Service identifier |
| Short Code | Conditional | Your registered short code |

You must provide one of Phone Number, Messaging Service SID, or Short Code based on your selected From Type.

## Step 1: Find your Account SID and Auth Token

1. Log in to the [Twilio Console](https://www.twilio.com/console)
2. On the dashboard, locate the **Account Info** section
3. Your **Account SID** is displayed directly — copy it
4. Your **Auth Token** is hidden by default — click **Show** to reveal it, then copy it

<Callout>
Your Auth Token is effectively your account password. Never share it, commit it to version control, or expose it in client-side code.
</Callout>

## Step 2: Set up a sender

You need something to send SMS from. Choose one of the three options below.

### Option A: Buy a phone number (simplest)

1. In the Twilio Console, click **Phone Numbers** > **Manage** > **Buy a number** in the left navigation
2. Select your country and search for available numbers
3. Ensure the number has **SMS** capability (check the SMS column)
4. Click **Buy** and confirm the purchase
5. Copy the phone number in E.164 format (e.g., `+15551234567`)

### Option B: Create a messaging service

Messaging services let you manage a pool of sender phone numbers with automatic load balancing and failover. Recommended if you send high volumes or need multiple sender numbers.

1. In the Twilio Console, click **Messaging** > **Services** in the left navigation
2. Click **Create Messaging Service**
3. Enter a name (e.g., `Notiflows Notifications`)
4. Select the use case that best describes your traffic
5. Click **Create Messaging Service**
6. In the **Sender Pool** step, click **Add Senders** and add one or more phone numbers
7. Complete the setup and copy the **Messaging Service SID** (starts with `MG`)

### Option C: Use a short code

If you have a registered short code, you can use it directly. Short codes are provisioned through Twilio's sales team and are typically used for high-volume marketing or two-factor authentication.

## Step 3: Set up in Notiflows

1. Navigate to **Channels** in your project
2. Click **Create Channel**
3. Select **SMS** as the channel type
4. Select **Twilio** as the provider
5. Enter your **Account SID** and **Auth Token**
6. Select your **From Type** and enter the corresponding value:
   - **Phone Number** — enter the number in E.164 format
   - **Messaging Service SID** — enter the SID starting with `MG`
   - **Short Code** — enter your short code
7. Save the channel

## Recipient phone numbers

Notiflows sends SMS to the phone number stored on the recipient user. Phone numbers must be in E.164 format:

```
+15551234567   (US)
+447911123456  (UK)
+61412345678   (Australia)
```

Set the phone number on a user via the Admin API:

```bash
curl -X PUT https://api.notiflows.com/admin/v1/users/USER_ID \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+15551234567"
  }'
```

## Templates

SMS templates use plaintext only.

Use Liquid templating for dynamic content:

```liquid
Hi {{ recipient.first_name }}, your order #{{ data.order_id }} has shipped!
```

Available variable contexts:
- `recipient.*` - Recipient user data (first_name, last_name, phone_number, etc.)
- `actor.*` - User who triggered the notification
- `data.*` - Custom payload passed when triggering the notiflow
