Skip to main content
Sniko integrates with Twilio for all telephony features: inbound and outbound voice calls, the browser-based softphone (Twilio Voice SDK), and SMS delivery. Each user in Sniko stores their own Twilio credentials, so multiple customers can use the platform with their own Twilio accounts.

Required credentials

You need three values from your Twilio account:
Environment variableDescription
TWILIO_ACCOUNT_SIDYour Twilio Account SID (starts with AC)
TWILIO_AUTH_TOKENYour Twilio Auth Token (32+ characters)
TWILIO_FROM_NUMBERThe Twilio phone number used as the SMS sender
Additionally, Sniko supports a dedicated messaging service:
Environment variableDescription
TWILIO_MESSAGING_SERVICE_SIDOptional. A Twilio Messaging Service SID for outbound SMS
.env
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token_here
TWILIO_FROM_NUMBER=+1xxxxxxxxxx
TWILIO_MESSAGING_SERVICE_SID=
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:
1

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.
2

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.
3

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
You never need to manually configure webhook URLs in the Twilio console — Sniko’s auto-configuration step handles this for you when you save credentials.

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:
These endpoints receive TwiML instructions for inbound and outbound call routing:
WebhookMethodURL
Voice Request URL (TwiML App)POST{APP_URL}/twiml/inbound
Manual outbound callPOST{APP_URL}/webhooks/twilio/voice
Configure the Voice Request URL on your TwiML App inside the Twilio console (under Develop → Voice → TwiML Apps).
Sniko tracks call state (answered, completed, failed, recording) through these status callbacks:
WebhookMethodURL
Call statusPOST{APP_URL}/webhooks/twilio/call-status
Call status (with call ID)POST{APP_URL}/webhooks/twilio/call-status/{callId}
Recording availablePOST{APP_URL}/webhooks/twilio/recording
Recording (with call ID)POST{APP_URL}/webhooks/twilio/recording/{callId}
DTMF inputPOST{APP_URL}/webhooks/twilio/dtmf
Set the Status Callback URL on your Twilio phone number to {APP_URL}/webhooks/twilio/call-status.
Delivery status updates for outbound SMS messages are posted to:
POST {APP_URL}/webhooks/sms/twilio
Set this as the Status Callback on your Twilio messaging service or phone number.
Twilio webhook endpoints in Sniko do not require authentication (they are called by Twilio’s servers). Sniko verifies incoming requests using Twilio’s request signature validation to prevent spoofed calls.

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:
GET /twilio/token
This endpoint is authenticated. It uses the user’s stored API Key SID and API Key Secret (created during auto-configuration) to generate a capability token scoped to their TwiML App. Tokens expire and must be refreshed periodically by the frontend.

SMS providers

Sniko’s SMS layer is provider-agnostic. Twilio is the default and currently supported provider. The active provider is set in config/sms.php:
.env
SMS_DEFAULT=twilio
SMS_TWILIO_ENABLED=true
Multiple Twilio credential sets are supported. Per-user Twilio credentials stored in the database are used when an SMS is sent on behalf of a specific user, while the server-level env vars serve as the fallback for system-generated messages.

Removing Twilio credentials

To disconnect Twilio from a user account, visit Settings → Twilio Setup and click Delete. This sends DELETE /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.

Build docs developers (and LLMs) love