Initial setup and connection
In this section, you will learn how to configure your application and establish a connection with the SMPP API.
- Account Setup: If you don't already have a Twilio account, create one on the Twilio Sign Up page.
- Sign In: Access your Twilio account through the Twilio Console.
Info
Note your Account SID and Auth Token, as you will need them in future steps.
-
Contact your dedicated Account Manager to express interest in the SMPP API.
-
Set up an SMPP dedicated Account SID in the Console.
-
Complete the questionnaire:
- Your account manager will send you an onboarding questionnaire.
- Complete the questionnaire and notify your account manager. Once this is done, your account manager will create a support ticket on your behalf.
-
Receive your credentials: Twilio provides you with the necessary credentials and an integration guide. The information will come via a secure email. Only the "technical contact" specified in the onboarding questionnaire will be able to complete the secure email flow.
Your SMPP API credentials will be provided in the following format (note that the values shown below are examples):
- Account SID:
ACXXXXXXXXXXXXXXXX
- System ID:
user123456789123
- Password:
A1b2C3d4
- Inbound Routing URL:
https://smpp-mo.twilio.com/mo-groups/{YMXXXXXXXX}
- Number of Binds allowed per system_id:
5
(default value) - Segments per second per bind allowed:
20
(default value)
- Account SID:
-
Once you've obtained your credentials, you can start using them to establish connection between your client and the SMSC and begin sending messages.
Next, you need to obtain and set up your phone numbers for sending and receiving messages in the Twilio Console. This process involves two steps:
- Navigate to the Account SID of your SMPP integration using the dropdown menu in the top right corner.
- On the left-hand side, click on Phone Numbers or Short Codes
- Select Manage > Active Numbers.
- Click on the phone number you want to configure.
- Scroll down to the Messaging section. In the A Message comes in field, select Webhook. Paste the MO Routing URL (
https://smpp-mo.twilio.com/mo-groups/{MO Routing SID}
) where you want to receive incoming messages. - Select HTTP
POST
from the dropdown menu. - Click Save.
- To configure your Twilio phone number to receive incoming messages, you can submit an HTTP
POST
request to the IncomingPhoneNumber resource associated with that number. To complete this request, you will need the following information:- Phone number SID: The PN SID (long code) or SC SID (short code) for the phone number you wish to update.
- Twilio messaging app details: The URL for your Twilio app (webhook, TwiML Bin, Function, etc.).
- Your credentials: The Account SID and Auth Token for your Twilio account.
Here is an example of how to configure your Twilio phone number to receive incoming messages via the API:
1curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json \2--data-urlencode "SmsUrl=http://www.example.com/twilio" \3-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
Navigate to the ShortCode resource page to learn how to configure short code phone numbers to receive incoming messages.
To establish a TCP socket with Twilio, send a request to their Fully Qualified Domain Name (FQDN) via an encrypted port. Ensure you're using TLS version 1.2 or higher from one of the IP addresses allowlisted during onboarding.
During the TLS handshake, public and private keys are exchanged, and Twilio's SMPP service certificate is presented for validation.
Once completed, you'll initiate an SMPP session by issuing a bind_sm
command PDU to establish a persistent connection, enabling the sending of outbound messages and the receiving of inbound messages and delivery receipts.
To connect your client with the SMPP API, please refer to the table below for the required SMPP settings configuration.
Settings | Values | Description |
---|---|---|
Twilio Host | *************** | Twilio SMPP API domain name. This will be provided with your initial onboarding email that also includes your system_id and password . |
Twilio Port | **** | Twilio SMPP API port. This will be provided with your initial onboarding email that also includes your system_id and password . |
SMPP version | 3.4 | SMPP protocol version used by the Twilio SMPP API. |
system_id | Example: 12A34b56C78d91E | A 15 Character long System ID string provided by your Twilio account manager. |
password | Example: i0oLw3pa | A 8 Character long password for your Twilio SMPP account provided by your Twilio account manager. |
Security | TLS v.1.2 and above | Connection encryption protocol. |
Info
If you experience any errors during the initial connection process, please reply to the email where you received your SMPP credentials. Alternatively, you can contact us by opening a new support ticket at help.sms@twilio.com.
If Twilio rejects a bind request during an initial bind attempt, the command_status
field of the bind requests response will be used to communicate an error message.
Twilio SMPP API doesn't send non-SMPP specification errors on bind requests. For a list of errors and brief descriptions, please visit the SMPP Error Codes page.