Integrations

SMS (Twilio)

Let people text a phone number and get answers from your chatbot. Uses a Twilio number you own. Pro plan only.

SMS is currently marked Coming soon. Unlock it first — see Testing the new integrations.

Read this before you start — this one costs money

SMS is the only channel here that bills per message, and it bills per segment: 160 characters, or 70 if the text contains anything outside the basic GSM alphabet — an em dash, a curly quote, an accent, an emoji. Our answers routinely contain those.

An ordinary analytical answer would be twenty messages. So Aimy shortens SMS replies to about 1,200 characters and says "[message shortened]" at the cut. No other channel does this. If someone needs the full answer, they need a different channel.

You also need a Twilio account with credit and a purchased number — those are billed by Twilio, not by us.

Before You Start

  • A Twilio account.
  • An SMS-capable phone number bought in Twilio (Phone Numbers → Buy a number, with SMS ticked).
  • A chatbot in Aimy with at least one document uploaded.
On a Twilio trial account you can only message numbers you have verified in the console. Verify your own mobile first, or every reply fails with "this Twilio account is in trial mode".

Step 1 — Collect three values from Twilio

1. Account SID. On the Twilio console dashboard. Starts with AC.

2. Auth Token. Same panel — click to reveal it.

3. Your number. From Phone Numbers → Manage → Active numbers, in international format: +60123456789.

Step 2 — Connect in Aimy

4. Open the integration. Integrations → the SMS card → pick your chatbot from the tabs.

5. Paste all three and click Connect.

Verify: Aimy checks two separate things — that the SID and token are valid, and that the number actually belongs to that account. A valid account with someone else's number is rejected here rather than failing at the first real message.

Step 3 — Point the number at Aimy

6. Copy the Webhook URL from the box that appears.

7. Configure the number. In Twilio: Phone Numbers → Manage → Active numbers → click your number → scroll to Messaging.

8. Set the incoming handler. Under A message comes in, choose Webhook, paste the URL, and make sure the method is HTTP POST. Click Save configuration.

The method must be POST. Twilio's signature covers the URL and the POST fields, so a GET request cannot be verified and every message would be rejected as forged.

Step 4 — Test it

9. Text the number from your phone with a real question your documents can answer.

Verify: a reply should arrive within a few seconds, possibly ending in [message shortened] — that is correct behaviour, not a bug. Then check Chat History, and Twilio's Monitor → Logs → Messaging to see both directions and what each one cost.

How it works

Twilio gives a webhook about fifteen seconds before giving up. Our answers can take longer, so Aimy acknowledges immediately with empty TwiML and a background worker sends the reply afterwards through Twilio's REST API.

Replying inside the webhook response was deliberately avoided: it would mean sending a message we do not have yet, and an SMS cannot be amended once sent.

Each phone number is its own conversation. Unlike Slack and Discord, a phone number does not expire — so SMS is the one deferred channel where a live agent can pick up a handoff hours later and still reach the person.

Troubleshooting

  • Nothing happens when you text. Check Twilio's Monitor → Logs → Errors. An 11200 or 11205 means Twilio could not reach the URL.
  • "bad signature" in the error log. The URL Twilio calls does not match what Aimy expects. Usually a proxy stripping HTTPS — Aimy honours X-Forwarded-Proto, so check that your proxy sets it.
  • "That number is not one of this Twilio account's numbers." Wrong account, or the number was typed without the country code.
  • Replies cut off. Working as designed. See the cost note above.
  • Trial account, no reply. Verify the recipient number in Twilio first.

When SMS is the right channel

SMS is best where the audience has no app and the answers are short — an order status, an opening time, a price. It is the wrong channel for anything analytical, because those answers are exactly the ones that get shortened.