Integrations
SMS
Twilio

How to send SMS messages with Twilio

Get started sending SMS notifications with Twilio and Knock.

Knock integrates with Twilio to send SMS notifications to your recipients.

Features

#
  • Delivery tracking
  • Bounce Support
  • Knock link tracking
  • Per environment configuration
  • Sandbox mode

Getting started

#

You can create a new Twilio channel in the dashboard under the Channels and sources page in your account settings. From there, you'll need to take some steps in Twilio before you can configure your Twilio channel within Knock.

1

Sign up for Twilio

Sign up for a Twilio account if you haven't already.

2

Get a Twilio phone number

Get your first SMS-enabled phone number in Twilio. You'll use this as the "From" phone number in your channel configuration within Knock.

(We also support Twilio short codes and messaging services.)

3

Verify phone numbers (trial accounts only)

If your Twilio account is in trial mode, you'll need to pre-verify any phone numbers that you plan to send SMS messages to during testing with Knock.

4

Configuring Twilio in Knock

Now that you have your Twilio phone number, account ID and auth token, you're ready to configure your Twilio channel in the Knock dashboard under the Channels and sources page in your account settings.

Channel configuration

#

The following channel settings should be configured per environment. Navigate to Channels and sources in your dashboard account settings, select your Twilio channel, then click "Manage configuration" under the environment that you'd like to configure.

Fields marked with an * are required.

Knock settings

Sandbox modeboolean

Whether to enable sandbox mode for your Twilio channel.

Knock link trackingboolean

Whether to enable Knock link-click tracking.

Provider settings for Twilio

Account IDstring*

The account ID from Twilio.

Auth tokenstring*

The auth token from Twilio.

Fromenum*

The method used to send your SMS messages. One of Phone number, Short code, or Messaging Service SID.

Phone numberstring*

The phone number to send messages from. Required when From is set to Phone number.

Short codestring*

The short code to send messages from. Required when From is set to Short code.

Messaging Service SIDstring*

The Messaging Service SID to send messages from. Required when From is set to Messaging Service SID.

Set optional per-environment conditions for this channel. These conditions are evaluated each time a workflow run encounters a step that uses this channel in the configured environment. If the conditions are not met, the step will be skipped.

Recipient data requirements

#

In order to send an SMS notification you'll need a valid phone_number property set on your recipient.

Delivery status webhooks

#

When enabled, Twilio will send delivery status updates directly to Knock via webhooks, allowing you to track the full lifecycle of your SMS messages in real-time.

Prerequisites

#

Before enabling delivery status webhooks, you need:

  1. A Twilio account with an SMS-enabled phone number, short code, or messaging service
  2. A Twilio channel configured in Knock (see the getting started section above)
  3. Access to your Twilio phone number or messaging service configuration

Setting up delivery status webhooks

#
1

Enable delivery status webhooks in Knock

  1. Navigate to Channels and sources in your Knock dashboard
  2. Select your Twilio channel
  3. Click "Manage configuration" for the environment you want to configure
  4. Scroll to the "Incoming message status updates" section and enable incoming webhooks
  5. Copy the generated webhook URL - you'll need this in the next step
2

Configure status callback in Twilio

The setup process depends on whether you're using a phone number/short code or a messaging service:

For phone numbers or short codes:

  1. Go to the Phone Numbers page in your Twilio Console
  2. Select the phone number or short code you're using with Knock
  3. Scroll to the "Messaging" section
  4. Under "Status Callback URL", paste the webhook URL from Knock
  5. Click "Save" to apply the changes

For messaging services:

  1. Go to the Messaging Services page in your Twilio Console
  2. Select the messaging service you're using with Knock
  3. Go to the "Integration" settings
  4. Under "Status Callback URL", paste the webhook URL from Knock
  5. Click "Save" to apply the changes

Supported delivery statuses

#

When delivery status webhooks are enabled for Twilio, Knock will update message statuses based on these Twilio status callback events:

Twilio StatusKnock StatusDescription
delivereddeliveredThe SMS was successfully delivered to the recipient's device
failedbouncedThe SMS failed due to invalid phone number or carrier rejection
undeliveredundeliveredThe SMS could not be delivered due to a temporary error

Troubleshooting

#

If delivery status updates aren't appearing in Knock:

  1. Check status callback URL. Verify the Status Callback URL is correctly configured in your Twilio phone number or messaging service settings.
  2. Verify phone number format. Ensure recipients have valid phone numbers in E.164 format (e.g., +1234567890).
  3. Check trial account limits. If using a trial account, verify the recipient phone number has been verified in Twilio.
  4. Review Twilio logs. Check the Messaging Logs in Twilio Console to see if messages are being sent and if status callbacks are being triggered.
  5. Test with a real number. Send a test SMS to a real phone number to verify the full delivery flow.