Twilio

Configure the OptiPub Twilio Integration

Integrations can be found in OptiPub > Administration > System Settings > Integrations

Activate the Twilio Integration

  1. Click Add on the Twilio integration card from the Integrations page in OptiPub.
  2. Retrieve the API Token, Twilio Account SID, and Messaging Service ID from the Twilio Console.
  3. The Prefix is for a brand name, such as OptiPub or OptiPub Alerts.
  4. The Help Text should include directions to unsubscribe and contact support, such as Reply STOP to opt-out or visit our website [www.example.com]. For more help, contact support at [[email protected]] or call [1-800-123-4567]. Msg & data rates may apply.".
  5. The Stop Text should include confirmation of opt-out, and directions to opt back in, such as You have successfully opted out. You will not receive any more messages from this number. Reply START to resubscribe.

OptiPub Twilio Integration

Configure the Webhook in Twilio Messaging Services

The Twilio Messaging Service uses a webhook to forward incoming SMS messages to OptiPub.

Configure the webhook in Twilio > Develop > Messaging > Services > [Service Name] > Integration.

  • Select the 'Send a webhook' radio button.
  • Add the URL - https://{APP_DOMAIN}/auth/twilio- to both Request URL and Fallback URL and select HTTP Post from the drop down options.
  • Click [Save]

Twilio Webhook

The Twilio Webhook forwards all message, and notifies OptiPub if the Twilio configured Keywords for Opt-in,Opt-out, or Help are matched. OptiPub will auto-reply with the corresponding messages configured in the OptiPub Twilio Integration. View the configured Keywords in the Twilio Campaign configuration from Twilio > Develop > Messaging > Regulatory Compliance > Campaigns > [Campaign Name]

Twilio Webhook Keywords

Purchase Twilio Phone Numbers

Twilio > Develop > Phone Numbers > Manage > Active Numbers

Configure Incoming Messages to use the Messaging Service

Select an Active number and in the Configure tab navigate down to Messaging Configuration.

Choose a Messaging Service to use for incoming messages for the phone number.

Configuring SMS with Twilio

Twilio phone number types

Both Short Codes and A2P 10DLC SMS phone numbers have an application process that can take up to a few weeks for verification.

Twilio provides 2 types of phone numbers for sending SMS - Short Codes and 10DLC (10-digit long codes).

Short Codes have a high quarterly fee that can cost well over $10,000 per year.

Short codes can only process keywords from incoming messages, and can only send outgoing messages to US phone numbers.

Their advantage used to be that they can send outgoing messages at a rate of 100/second with no daily limit, but Trusted A2P Brands now have comparable outgoing sending rates and limits in Twilio.

A2P 10DLC Compliance is now required for sending outgoing SMS with Twilio using 10-digit phone numbers.

10DLC (10-digit long code) phone numbers have a minimal monthly lease cost, and can fully process incoming messages, and are able to send outgoing domestic and international messages.

Outgoing sending rates are determined by your A2P Brands Trust Score. A decent score can send 40/second per carrier, while a perfect score can send over 250/second.

Review Twilio A2P 10DLC Message Throughput for outgoing message rates and limits for different Campaign Types and Brand Trust Scores.

Review Twilio Pricing for per-message rates and carrier fees, and phone number lease charges.

Short Code Senders

Twilio must manually verify applications which can take a few days or up to a few weeks to complete.

Required Information

Registration requires your company name, address, website, contact information, short code use case, opt-in procedures

Twilio > Develop > Messaging > Senders > Short Codes > +[Apply for a New Short Code]

Complete the US Short Code Application and Submit for review.


Review more Short Code information in the Twilio Documentation


Twilio A2P 10DLC Compliance (10-digit long codes)

Review A2P 10DLC Campaign Approval Requirements in the Twilio Documentation

A2P 10DLC Registration

Twilio must manually verify applications which can take a few days or up to a few weeks to complete.

Required Information

Registration requires your Federal EIN (Employer Identification Number), company name, address, website, contact information, a detailed description of how you plan to use the short code (e.g., marketing, customer service), opt-in procedures, terms of service, privacy policy

Twilio > Develop > Messaging > Regulatory Compliance > Onboarding

Navigate in Twilio's Console to the Compliance Onboarding page to start registering an A2P 10DLC Campaign:

  • Create a Customer Profile
  • Register Brand
  • Campaign Registration (a Messaging Service will be linked during this step)
  • Register and Connect existing Phone Numbers to the Campaign

Brands are used to configure a brand identity and create Campaigns.

Campaigns connect a Brand, Messaging Service, and Phone Numbers.

Phone Numbers must be connected to both the Campaign and the Messaging Service.

Messaging Services are used by the Twilio API to identify your configuration and process incoming and outgoing messages.


Review A2P 10DLC Registration steps in the Twilio Documentation and Campaign Use Cases


Connect Phone Numbers to Messaging Service

Twilio > Develop > Messaging > Services

Select a Messaging Service > openSender Pool from the left menu > click [Add Senders]

Add a Phone Number or a Short Code


A 10DLC phone number must be connected to both the Messaging Service it's assigned Campaign.

Short Codes do not need a compliant brand and campaign.


Send a test SMS from OptiPub

Once you have completed the steps above and your Brand is registered and your Campaign is verified, you are ready to send a test SMS message in OptiPub.