# SMS channel (Twilio)

URL: https://aihio.ai/en/docs/chatbot/sms-channel
Description: Connect your own Twilio account and let the AI agent answer SMS. You own the numbers and pay Twilio directly.

Aihio supports a BYO Twilio model: you connect your own Twilio account, and the AI agent answers inbound SMS from the same number your customer texted. The numbers stay under your ownership and Twilio usage charges hit your Twilio account directly — Aihio never relays the bill.

## Prerequisites

- **Twilio account.** A trial account is enough for testing, but production use needs an active account (and Twilio's 10DLC registration if you send to U.S. numbers).
- **An SMS-capable number** on your Twilio account. Finnish, European, or any other Twilio-supported number — Aihio does not restrict by country.
- **An Aihio plan** with integrations enabled (Starter tier and above).

## Connect

1. **Fetch Twilio credentials**

   Sign in to the [Twilio Console](https://console.twilio.com). On the dashboard you'll see **Account SID** and **Auth Token** (click "View" to reveal the token). Copy both.

   Account SID always starts with `AC` and is 34 characters long. The Auth Token is 32 characters.
2. **Open SMS settings in Aihio**

   In the Aihio dashboard: **Chatbots → pick a chatbot → Integrations → Channels → SMS (Twilio)**.
3. **Paste credentials and the number**

   Paste your Account SID, Auth Token, and Twilio number in E.164 format (e.g. `+358401234567`). Optionally give the number a friendly name (e.g. "Product support").

   Aihio probes Twilio right away to confirm the credentials work and that the number actually belongs to the same Twilio account. Common errors:
   - **"Twilio rejected the credentials"** — double-check you copied the Auth Token in full.
   - **"The phone number you entered doesn't belong to this Twilio account"** — make sure you picked the right Twilio account and that the number is in E.164 format.
   - **"Couldn't reach Twilio right now"** — Twilio's API is momentarily unavailable; try again in a minute.
4. **Configure the webhook in Twilio Console**

   Once connected, Aihio shows the **webhook URL** as `https://app.aihio.ai/api/webhooks/twilio/sms`. Copy it.

   In the Twilio Console: **Phone Numbers → Manage → Active numbers → pick your number → Messaging Configuration**.
   - Under **"A message comes in"**, paste the Aihio webhook URL and pick `HTTP POST` as the method.
   - Save.
5. **Send a test message**

   Text your Twilio number from your own phone. Within a few seconds you'll get the AI agent's reply, and the conversation appears in the Aihio inbox tagged with the SMS channel badge.

   If no reply arrives, check:
   - Sentry error log (`channels/sms` tag)
   - The Aihio inbox — if you see a bot reply but delivery wasn't marked successful, click the conversation to see the failure reason.

## How it works

1. Your customer sends an SMS to the Twilio number.
2. Twilio fires a webhook to Aihio's server (signed with your Twilio Auth Token — Aihio verifies every request).
3. The Aihio AI agent generates a reply using the same logic as the website chat widget — same knowledge bases, same system prompt.
4. Aihio sends the reply through the Twilio REST API from your own Twilio account back to your customer's phone.
5. The conversation lands in the Aihio inbox where you can read it and escalate to a human agent if needed.

A reply can be up to 1,600 characters — Twilio splits longer messages into multiple SMS segments automatically. Usage is billed to your Twilio account per segment.

## What Aihio does NOT do

- **Does not relay Twilio usage charges.** Twilio bills you directly for SMS (typically around €0.05 per segment to Finland in 2026). Aihio's SaaS pricing does not scale with SMS volume.
- **Does not support MMS at this time.** Inbound attachments (images) are dropped; only the text content goes to the AI agent.
- **Does not register 10DLC brands for you.** If you send to the U.S., complete Twilio's own 10DLC flow before going live.

## Disconnect

In the Aihio dashboard: **Integrations → Channels → SMS (Twilio) → Disconnect Twilio**. Stored credentials are removed immediately. Don't forget to also remove the webhook URL from the Twilio Console so Twilio stops trying to deliver to Aihio.

## Privacy

Twilio acts as a sub-processor **only** when you've activated the SMS channel. You (the customer) are Twilio's direct controller — Aihio acts as a technical relay. Details in the [Data Processing Agreement](/en/data-processing-agreement) (section 6 — Sub-processors) and the [Privacy Policy](/en/privacy-policy).

Credentials (Account SID + Auth Token) are stored in the Aihio database AES-256-GCM encrypted. The encryption key lives in an environment variable, never in the database.
