# Handle SMS with your own Twilio account

> How to create an SMS inbox with your Twilio Account SID and Auth Token, pick the number and set up the webhook for incoming SMS.

The **SMS (Twilio)** inbox sends and receives SMS with a number from your own Twilio account. The account and the number are yours: TalkVend stores the credentials encrypted and uses Twilio to send and receive the messages.

## What you need

In the Twilio Console, on the account home page, copy:

- the **Account SID**, which starts with `AC`;
- the primary **Auth Token**.

You also need an SMS-capable number on Twilio.

> **Warning:** use the primary Auth Token. Twilio signs webhooks with it. A secondary token passes the check, but incoming messages would be rejected.

## Create the inbox

1. In the sidebar, open **Inboxes** and click **New inbox**.
2. Choose **SMS (Twilio)**.
3. Fill in the **Name**, the **Account SID** and the **Auth Token**.
4. Click **Find numbers**. TalkVend lists the SMS-capable numbers from your Twilio account that aren't used by an inbox yet.
5. In **Twilio number**, pick the number from the list. If the number isn't there, click **Type another number** and enter it in international format, with the country code (for example, +1 555 123 4567).
6. Click **Create inbox**.

A number can only be in one inbox at a time. The Auth Token is stored encrypted and never shown again.

## The incoming SMS webhook

For customer SMS to reach TalkVend, the number on Twilio must point to the **Webhook URL (incoming SMS)**. The last creation screen shows this URL and tells you which case happened:

- Automatic setup: when the number was found in your account, TalkVend sets the URL on the number for you. You see the message "All set! We already configured this URL on your Twilio number to receive SMS."
- Manual setup: when it couldn't be set automatically, do it yourself. In the Twilio Console, open the number and paste the URL into "A message comes in", with the HTTP POST method.

The URL stays available on the inbox page, under **Webhook URL (Twilio number)**.

## Keep the connection healthy

On the inbox page:

- **Sync** checks the Twilio account and re-applies the webhook URL on the number, when possible. The result shows as **Connected** or **Failed — check the credentials**.
- **Rotate** on the **Auth Token** replaces the token. Paste the account's primary token. Every inbox in this account with the same Account SID switches to the new token.

## What is supported

- Sending and receiving text SMS, with one sender number per inbox.
- Starting a conversation with a contact from TalkVend, with no 24-hour window.
- Delivered or failed marks on sent messages, as reported by Twilio.
- Messages up to 1,600 characters.

Not supported:

- attachments and images (MMS): only the text of incoming messages comes in;
- SMS templates and campaigns.

> **Warning:** sending from a US number to phones in Brazil works, but the carrier replaces the sender with another number. That's why those customers' replies don't come back to the inbox.
