Required credentials
You need three values from your Twilio account:| Environment variable | Description |
|---|---|
TWILIO_ACCOUNT_SID | Your Twilio Account SID (starts with AC) |
TWILIO_AUTH_TOKEN | Your Twilio Auth Token (32+ characters) |
TWILIO_FROM_NUMBER | The Twilio phone number used as the SMS sender |
| Environment variable | Description |
|---|---|
TWILIO_MESSAGING_SERVICE_SID | Optional. A Twilio Messaging Service SID for outbound SMS |
.env
These server-level env vars configure the system-default Twilio credentials. Individual users can also connect their own Twilio accounts through the UI at Settings → Twilio Setup. Per-user credentials are stored encrypted in the database and take precedence over the env vars for that user’s calls.
Connecting a per-user Twilio account
Each authenticated user can link their own Twilio account under Settings → Twilio Setup (/twilio/setup). Sniko handles the full configuration automatically:
Enter your Account SID and Auth Token
Navigate to Settings → Twilio Setup. Enter your Twilio Account SID and Auth Token, then click Verify.Sniko calls
POST /twilio/verify to validate your credentials against the Twilio API. The Account SID must begin with AC and the Auth Token must be at least 32 characters.Select a phone number
After verification, Sniko fetches all incoming phone numbers on your Twilio account. Select the number you want to use for calls.
Save and auto-configure
Click Save. Sniko calls
POST /twilio/credentials and automatically:- Creates a TwiML App in your Twilio account with the correct voice webhook URL
- Generates an API Key and API Key Secret for the Voice SDK
- Configures the selected phone number’s webhook URLs
- Stores all values (auth token encrypted) in the database
Webhook URLs
If you need to register webhooks manually (for example, if you are using a phone number not managed through the auto-configuration flow), register the following URLs in your Twilio Console:Voice webhooks
Voice webhooks
These endpoints receive TwiML instructions for inbound and outbound call routing:
Configure the Voice Request URL on your TwiML App inside the Twilio console (under Develop → Voice → TwiML Apps).
| Webhook | Method | URL |
|---|---|---|
| Voice Request URL (TwiML App) | POST | {APP_URL}/twiml/inbound |
| Manual outbound call | POST | {APP_URL}/webhooks/twilio/voice |
Call status callbacks
Call status callbacks
Sniko tracks call state (answered, completed, failed, recording) through these status callbacks:
Set the Status Callback URL on your Twilio phone number to
| Webhook | Method | URL |
|---|---|---|
| Call status | POST | {APP_URL}/webhooks/twilio/call-status |
| Call status (with call ID) | POST | {APP_URL}/webhooks/twilio/call-status/{callId} |
| Recording available | POST | {APP_URL}/webhooks/twilio/recording |
| Recording (with call ID) | POST | {APP_URL}/webhooks/twilio/recording/{callId} |
| DTMF input | POST | {APP_URL}/webhooks/twilio/dtmf |
{APP_URL}/webhooks/twilio/call-status.SMS status webhook
SMS status webhook
Delivery status updates for outbound SMS messages are posted to:Set this as the Status Callback on your Twilio messaging service or phone number.
Voice SDK tokens (softphone)
Sniko’s browser softphone uses the Twilio Voice JavaScript SDK. To initiate or receive calls in the browser, the frontend requests a short-lived access token:SMS providers
Sniko’s SMS layer is provider-agnostic. Twilio is the default and currently supported provider. The active provider is set inconfig/sms.php:
.env
Removing Twilio credentials
To disconnect Twilio from a user account, visit Settings → Twilio Setup and click Delete. This sendsDELETE /twilio/credentials, which removes the stored credentials from the database. The TwiML App and API keys previously created in the user’s Twilio account are also cleaned up.