Adding SMS functionality to websites

This article was born to guide you through the process of adding SMS functionality to your website. With making it able to send sms messages directly from your site you can attract much more visitors (customers, business partners, etc.). First of all, let's see the basics of SMS sending.

For sending messages you most importantly need an SMS gateway to connect to the mobile network. This can be happened in two ways: with a GSM modem, or over the Internet. If you choose the appropriate software it will support both connections. Ozeki Message Server Next is probably the best of this type. By configuring more GSM modems and/or Internet (IP) connections you can achieve high performance and outstanding stability.

If you have a GSM modem connectivity it means that a GSM modem (or GSM phone) is attached to your PC with a phone to PC data cable. The modem has a SIM card which allows to connect to the GSM network. To setup this connection method, you need the following components:

SIM card + Modem + Data cable + Computer + SMS Gateway (SMS software)

In the case of having an Internet based connection (IP SMS connection) a TCP/IP link is used to connect to the Short Message Service Center (SMSC) of a mobile network or an SMS service provider. So you need to find an SMS service provider who can reach the mobile phones in your area and is able to provide SMS service through the Internet. In order to setup this solution you need the following prerequisites:

SMS Service Subscription + Internet connection + Computer + SMS Gateway

In general, when you make a decision whether you want to use an Internet SMS connection or a GSM modem the first and most important thing to check is the volume of SMS messages you expect to be sent or received in the system. If you will send or receive less then 12000 SMS messages per day a GSM modem will probably be a good option. If you will send or receive more, you should consider to use some kind of Internet SMS connection.

Let's assume you have set up your SMS system, and come straight to the point. The method I'm presenting uses HTTP communication between the SMS Gateway and your website. The website visitor only has to fill in a form (with the recepient's number and the message), which will be sent to the Webserver by the browser. This HTML form can be submitted by clicking on a button (with „OK” or „SEND” on it, for example). When the visitor presses the button, the phone number and the message will be sent to the Webserver in HTML form. There, the utilized scripting support processes the submitted request (and forwards them to the database). This script will post the SMS message to the SMS Gateway. Once the message is in the Gateway, it is converted to sms, then is sent to the recipient's mobile phone. The process looks like this:

HTML form -- Webserver -- SMS Gateway -- Mobile users

It isn't neccesary for the Webserver and the SMS software to be on the same computer. But scripting support has to be enabled on your Webserver. This is the most important condition. The support can be PHP or ASP, too.

To make it more understandable, let's repeat the main steps of the process:
  1. The User's browser queries your website from the Webserver.
  2. The Webserver sends back an HTML form.
  3. The User fills in the form, and submits the request by clicking on the sending button.
  4. The script (e.g. ASP, PHP) processes the form, and records the data in the right database.
  5. The request is sent to the SMS Gateway by an HTTP API.
  6. The Gateway sends out the message to the given phone number.

So, if you already have a website (that is on a webserver) you only have to install your SMS software and verify, that you can send SMS messages from the gateway manually. After your SMS gateway is functioning you can create the HTML form and the PHP script. With a little work and a decent SMS Gateway, website visitors will be able to send messages from your site in no time.

SMS sending from a website can be very tempting for people, so you can be sure of that if you implement a function like this to your site, visitors will crowd. Examine your needs and opportunities, and give this standalone function a chance. You won't regret.

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now