Set up Twilio¶
On a self-hosted install, SMS and phone calls go through your own Twilio account. Set it up once and every page by SMS or call uses it. On the cloud we run Twilio for you, so you can skip this page.
You need: a Twilio account with a balance, a phone number that can send SMS and make calls, and a public https:// address for your Argavon install.
1. Account and number¶
- Create a Twilio account and add a balance. A trial account is not enough for paging: when we tested, it blocked SMS with our own text and the call script that reads the page out and takes your keypress. Upgrade the account before you rely on it.
- Buy a number with SMS and Voice.
- Copy the Account SID and Auth Token from the Twilio console.
2. Settings¶
Add these to the server's environment (.env with Docker Compose):
TWILIO_ACCOUNT_SID=AC0123456789abcdef0123456789abcdef
TWILIO_AUTH_TOKEN=<your auth token>
TWILIO_FROM_NUMBER=+14155550100
TWILIO_CALLBACK_BASE=https://pager.example.com
| Setting | Required | What it does |
|---|---|---|
TWILIO_ACCOUNT_SID |
yes | Turns on SMS and calls. Without it, the SMS and phone call types don't appear. |
TWILIO_AUTH_TOKEN |
yes | Signs the API calls and checks Twilio's callbacks. |
TWILIO_FROM_NUMBER |
yes | The number pages come from, in international format. Calls always need it. |
TWILIO_MESSAGING_SERVICE_SID |
no | Send SMS through a messaging service instead of the from number. Calls still use TWILIO_FROM_NUMBER. |
TWILIO_CALLBACK_BASE |
no | The public address Twilio calls back. Defaults to FRONTEND_ORIGIN when that starts with https://. |
Restart the server. It checks the settings at start and refuses to start with a half-set Twilio, for example a missing TWILIO_FROM_NUMBER.
Without a callback address, pages still go out, but an SMS or call counts as sent as soon as Twilio accepts it. Nobody can acknowledge with the keypad or by SMS reply, unanswered calls don't ring again, and the incident page can't say whether a page reached the phone. Set it.
3. Point the number at Argavon¶
Argavon tells Twilio where to send delivery reports and keypresses with every message and call. You only set up one webhook by hand: the one for SMS replies.
In the Twilio console, open the number in TWILIO_FROM_NUMBER (or each number of the messaging service). Under Messaging, set A message comes in to Webhook, HTTP POST:
<TWILIO_CALLBACK_BASE>/api/v1/hooks/twilio/sms
The full list of webhook addresses:
| Address | Set by | Receives |
|---|---|---|
/api/v1/hooks/twilio/status/<workspace>/<delivery> |
Argavon, per message and call | Delivery reports |
/api/v1/hooks/twilio/voice/<workspace>/<delivery> |
Argavon, per call | The key pressed on a call |
/api/v1/hooks/twilio/sms |
you, on the number | SMS sent to the number (reply 1 to acknowledge) |
Twilio signs each request over its full address. TWILIO_CALLBACK_BASE must be exactly the public address Twilio calls, or the signature doesn't match and the request gets 403. Behind a proxy that changes the host or the scheme, set it explicitly.
4. Test with your own phone¶
- Open My notifications.
- Add a contact method of type SMS with your number in international format, such as
+14155550100, and click Verify. Type the 6-digit code you get. Do the same for Phone call: the code is read out in a call. - Click Send test next to each method.
- Check Recent deliveries on the same page (in the Classic interface). Reached you should say something like "reached the phone in 3 s" for the SMS and "answered in 8 s" for the call. "waiting for the network's report" that never changes means Twilio can't reach
TWILIO_CALLBACK_BASE. - Send yourself a real page: trigger a critical alert routed to you, or, in the Pro interface, use Send me a test page on the board. Reply 1 to the SMS. You should get "Acknowledged:
" back, and the incident shows as acknowledged.
Codes and test messages don't count against the plan's SMS and calls. Each person can send 10 a day, and a workspace 30.
If it doesn't work¶
| What you see | What to do |
|---|---|
The server doesn't start: TWILIO_FROM_NUMBER is required (calls always need it) |
Set TWILIO_FROM_NUMBER. |
| The SMS and phone call types are missing | TWILIO_ACCOUNT_SID isn't set on the server, or the server wasn't restarted. |
did not reach the phone: Twilio error ... |
Twilio's own error code. Look it up in the Twilio console's error log. On a trial account, upgrade it. |
| An SMS reply gets no answer | The number's A message comes in webhook isn't set, or the reply came from a number that isn't a verified SMS method. |
Twilio's request log shows 403 |
TWILIO_CALLBACK_BASE is not the exact public address Twilio calls. |
More on contact methods and rules: Notifications. Paging through Telnyx when Twilio is down: Telnyx failover.