How to send sms from Twilio

This page gives information on how to send texts with Twilio using Ozeki 10 SMS Gateway. Twilio is an SMS service provider company based in San Francisco, so it offers SMS service to people in the United States of America. If you have installed Ozeki 10 SMS Gateway, it is easy to create a connection to the SMS service provided by Twilio. Follow the instructions below to setup this connection in 3 minutes. This article presents an example configuration.

How to send sms from Twilio
Figure 1 - How to send sms from Twilio

How would you send sms from Twilio (quick steps)

To send sms from Twilio use these instructions:

  1. Install Ozeki 10 SMS Gateway, then navigate to the red Ozeki 10 icon on your Windows desktop. This will open the Ozeki graphical user interface. To send sms from Twilio you can continue with the configuration in this user interface.
  2. In the Ozeki desktop start the SMS Gateway application. This can be achieved by clicking on the desktop icon. The SMS Gateway app is needed to send sms from Twilio.
  3. To send your first text messages from Twilio the only thing left is to install the Twilio connection by opening the 'Add new connection...' page.

How does Twilio SMS work?

Twilio is an SMS aggregator and their service works the same way as the service of any other SMS service provider. They connect their server to other SMS service providers and to mobile networks and they negotiate SMS prices. They make money by selling the SMS at a premium. Twilio offers an HTTP SMS API, that allows you to connect to their service through web requests. Every sms is a single web request. Web requests are HTTP requests or REST api requests.

Are there any Twilio alternatives?

Yes, there are many alternative SMS service providers on the Internet. If you setup Ozeki SMS Gateway, you can connect to multiple service providers at the same time, or you can switch providers if you find better conditions. Another alternative is to connect a mobile phone to your SMS Gateway PC and send SMS directly to the mobile network (Figure 1).

Twilio alternatives
Figure 2 - Backup routes if Twilio fails

How to handle Twilio service failure

Reliable IT systems avoid a single point of failure. Since Ozeki SMS Gateway can be installed on multiple computers in your premises or on a virtual system, and Ozeki offers the ability to reroute the SMS messages to other SMS service providers automatically if Twilio fails. With the help of Ozeki SMS Gateway you can build a reliable fail safe SMS service. When you build a business, it is important to decrease the number of dependencies, with Ozeki you can do this, because you won't depend on Twilio. Ozeki will give you the freedom to choose and change your SMS connection type and your SMS service provider.

To handle service failure, you should setup backup SMS routes, and have connections to multiple SMS service providers. It is a good idea to setup a direct wireless connection to the mobile network using a mobile phone as a final backup.

How much does Twilio cost per SMS?

The cost of a Twilio SMS depends on destination. The cost ranges from around USD 0.01 to USD 0.20. The price list is displayed on their website. This price range can be considered a standard price range in the United States of America.

Detailed instructions to send sms from Twilio

To send sms from Twilio:

  1. Navigate to ozeki-sms-gateway.com
  2. Click on download to download Ozeki 10 SMS Gateway
  3. Install the downloaded installation package
  4. Open the Ozeki dashboard
  5. Open 'Add new connection...' in the 'Connections' panel
  6. Locate Twilio, and click install
  7. Ozeki SMS Gateway will send the sms over this connection
  8. Type in the Twilio account details
  9. To send sms, use the Test tab
  10. Type in the recipient, the text and click send
  11. Read the logs to see if your sms messages was successfully sent to Twilio

Open the Ozeki Dashboard

Ozeki SMS Gateway is a great Twilio Client. After you have installed it on your Windows or Linux PC, you can configure the Twilio connection with a few simple steps. The first step is to click on the "Add new connection..." link in the Ozeki Management Console. The Ozeki Management Console is often referred to as Ozeki Dashboard. This is the main Graphical User Interface (GUI) of Ozeki.

Open the Ozeki Management Console
Figure 3 - Open the Ozeki Management Console

Select the Twilio connection

After you have clicked on the "Add new connection..." link, a list of available connections will appear on your screen. You need to scroll down in the list and find the Twilio connection. Next the "Twilio" name, you will see an Install link. Use this link to install the Twilio connection. (Note that you may install multiple Twilio connections, each with a separate user account and you may add connections of other SMS service providers on this screen).

Setup the Twilio connection
Figure 4 - Setup the Twilio connection

Configure the Twilio account details

After you have installed the Twilio connection, you need to enter the Account Sid and Auth token into the configuration form. This is your username and password. You should also configure the Telephone number you got from Twilio to be used as Sender ID.

Configure the Twilio account
Figure 5 - Configure the Twilio account

Send a test SMS through Twilio

To send a test SMS through Twilio, open the Test tab, type in the recipient phone number into the To field, and enter the messages text. To send the SMS click Send.

Figure 6 - Send sms from Twilio

Protect your phone number list

Your customer phone number list is a very valuable asset. You must make sure you take good care of it and you protect it. When you send text messages through Twilio or any other on-line SMS service provider, your customer phone numbers and the message texts will be visible to Twilio. It is a good practice to setup connections to multiple SMS service providers and to distribute your messages among them to make sure no entity has all your data. It is even a better practice to send messages wirelessly directly to the mobile network using an Android mobile phone or GSM modem attached to your computer with a phone-to-pc data cable. Note that this option is only viable if you send less then 10 000 SMS per day. Ozeki 10 SMS Gateway has a version that can be installed on an Android mobile. It is called Android sms gateway. It also offers the same APIs (e.g. C# SMS API), as the desktop version, it allows Office clients to connect, you can create E-mail to SMS configs, and you may even provide an Android SMPP SMS gateway service

How to save the messages sent through Twilio into a database

You can configure SQL logging for a Twilio connection. This is very useful, because it will help you keep track of all the SMS messages you have sent or received through the Twilio connection. This database log, can not only be used to lookup old message in case of disputes, but it can also be used to create weekly or monthly reports. These reports will let you know which user or application in your system sent the messages and what was the pattern of your sms traffic.

Save texts sent through Twilio into an SQL database
Figure 7 - Save texts sent through Twilio into an SQL database

How to send sms from an SQL database through Twilio

If you have a Twilio connection setup up, you can easily send and receive sms messages from an SQL database. You can use Microsoft SQL Sever, Oracle, MySQL or any other ODBC/OleDB compatible database. SMS messages from your database can be achieved by creating two databases tables: ozekimessageout and ozekimessagin. The first table ozekimessageout will be used for sending sms, the other, ozekimessagein will be used to store incoming sms. If you want to send an SMS, all you have to do is create an SQL record using an SQL INSERT command. in the ozekimessageout table. Ozeki 10 sms gateway will pick up the message, it will deliver it to the mobile network, and it will update the status field and timestamp fields in the database to let you know when the SMS was sent from your system, when was it received by the recipient mobile and if an error occurred, why wasn't it delivered.

Send texts from C# .Net through Twilio

Computer driven text messaging solutions perform significantly better than human employees. Due to this fact most companies choose to build automated sms services. Ozeki's C# SMS API provides an excellent tool to achieve this goal. This C# api is great because it comes with the full source code and you can use it and modify it without any limitations. By implementing this single application programming interface, you can reach many SMS services with a single code base.

Twilio sms api
Figure 8 - Single SMS api multiple networks

Email to sms from Twilio

If you configure Twilio, you can effortlessly provide an email to sms and sms to email functionality to your customers. Any email user that can send an email to an sms e-mail address can send sms. The email address format is phonenumber@hostname. An e-mail address may look like this: 079619671@email.domain.com. The recipient telephone number can also be put into the email subject. In either case the email text will be forwarded as the sms to the specified phone number.

email to sms from Twilio
Figure 9 - Send SMS from office clients

Best practice to implement an SMS API

Implementing the SMS API of a single SMS service provider is dangerous, because you will be locked into that service. It is a much better practice to run your own SMS gateway on premises or at a virtual hosting company, and let your apps connect to it. Ozeki SMS Gateway provides outstanding API, such as C# sms api, a HTTP rest api, and free to use (and modify) programming examples for SMS messaging for almost all programming languages.

Figure 10 - Send SMS from business apps

How to send sms using text files through Twilio

Every software developer can create and read text files. Text files provide the most simple interface to send and receive SMS messages. Whether you use SAP or a custom built business application, you will likely have the option of exporting data in the form of csv, excel or plain txt files. If you have this option, you can send and receive SMS messages using Ozeki 10 SMS Gateway through Twilio. In this case two directories will be created, one for storing SMS messages to be sent, and another for saving incoming sms messages. Ozeki can be configured to save incoming SMS in the file format you prefer and it can pick up text files containing SMS messages to be sent. Once a text file is read, SMS messages are created and they are sent to the mobile network through the Twilio connection.

Possible unexpected charges while using Twilio

While most sms service providers do not charge their customers for incoming sms, Twilio put a hefty price tag on incoming sms. This is not an issue if your application is only sending texts, and is not interested in incoming messages, but if you want your customers or employees to reply to or to confirm your texts, this can become a significant, unexpected cost. The problem with charging inbound sms is that you have no control over who is sending a messages to you and when.

Final thoughts

We hope you didn’t get lost in the explanations. By following the above instructions you can configure the connection in a short period of time. Now you can use Twilio to send and receive sms messages, and you can see how easy it is to use Ozeki 10 SMS Gateway to connect to such a service. The HTTP SMS service of Twilio is not difficult to setup, and although it does not provide the same performance as an SMPP sms service, it is still a good option to use in 2021. The biggest benefit of Twilio is that an account can be setup in a few minutes on their website.

One of the biggest advantage to using Ozeki is that it let's you to connect to multiple sms service providers simultaneously. This gives you provider independence, and the ability to go truly international. This could be a good time to connect to another SMS service provider. Creating connections to multiple SMS providers greatly increases the operational reliability of your system. Multiple service provider connections offer fault tolerance, give you the ability to do least cost routing and give you a peace of mind, that you can always switch providers in a matter of seconds in case some unexpected happens.

More information