How to add SMS text messaging functionality to my website?

  • I want to add the ability to send reminders to people via email and SMS for specific events that they have signed up for on a web application that I am building. The email part is not difficult, but I am wondering where to find a good solution for sending SMS messages.

    It would also be a plus if this solution allowed two-way SMS communication with my web application so that people would be able to reply with a CONFIRM or CANCEL type of a message.

    Has anyone implemented something like this? Does anyone know of good tools out there?

    EDIT: I am realizing that this is more of a "lots of ways to skin this cat" type of question and so I changed it to community wiki.

    +1, I know of a dozen one way SMS API providers, but none that post back if a reply is received.

    I added a bounty on this question in hopes of improving the answers on this question.

    jessegavin, If you feel like selecting a best answer, feel free to--the bounty ends tomorrow!

  • Adam

    Adam Correct answer

    10 years ago

    I believe that the new industry leader is Twilio, they have an excellent API and reasonable prices. Some alternatives worth considering are Tropo, Plivo, and Nexmo.

    You can also use an SMS Gateway like ClickATell.

    Best of luck!

    EDIT: I found a question on StackOverflow that has lots more suggestions, some may be outdated.

    I'm using CLickATell as well and I'm satisfied with their service.

    I am going to chime in for Plivo paid service, its very good. We used to use Twilio which is also outstanding but costs more.

  • I had a friend who managed to implement this via email. I believe he did it exactly the same way this site recommends:

    T-Mobile: phonenumber@tmomail.net
    Virgin Mobile: phonenumber@vmobl.com
    Cingular: phonenumber@cingularme.com
    AT&T: [email protected]
    Sprint: phonenumber@messaging.sprintpcs.com
    Verizon: phonenumber@vtext.com
    Nextel: phonenumber@messaging.nextel.com

    where phonenumber = your 10 digit phone number

    And does this show up in their email inbox? Or their text messaging interface?

    When he used it for me, it went directly to my phone (at the time was verizon). I've also just tested it to my sprint number and it did the same.

    I just tested this out and my carrier (AT&T) added the FROM: [Sender Name], SUBJ: [Subject Line], MSG: [Message Contents] to the beginning of the text message. - So that is (at the very least) 21 characters that get used up with this method. I am thinking that (at least for me) this would not be acceptable for most public facing web applications.

    This answer is very NA-centric, however for the rest of the world it's very similar. I assume these methods above charge the *receiver* of the SMS rather than the sender? The US is the only place in the world where I've heard of that happening, most of the time you need to have a pre-paid account for sending text messages.

    Also, where you say "your 10 digit phone number" I believe you mean "the customers 10 digit phone number"

    Is there a better resource for the formats of the equivalent email addresses.

    Just testing this for my phone on Rogers (in Canada) and it took a couple minutes to receive it (normal SMS messages are nearly immediate). It also required me to reply back with "Read" to get the actual message, something that regular messaging doesn't require.

    In my country (Argentina) you have to pay the SMS received through email (Your customers may not like)

    How do you determine who the carrier is?

    @Adam - The user should specify the carrier.

    @Eduardo - Because of that, it should be explicitly stated to the user that charges may be incurred.

    @arlung oops, i forgot to add a space before 'is'. Thanks.

    If you force the user to tell you which carrier they're with, what happens when they switch from AT&T to Verizon?

    If your user changes to another carrier he will stop receiving messages.

  • I've been using Twilio for voice and I've been quite impressed. I'm sure their SMS system isn't much different. This will allow you to send to any carrier without knowing the email address to send to (as I've noticed they change over time).

    So you're using their API? How are you using it?

    I'm using their voice API to make calls triggered through PHP scripts. I'm using it to make calls and using it to do voice to text and then accept responses from the user.

  • This is for sending only, but I've used Penny SMS for a project and had good luck with it. If you happen to be using Ruby, check out the penny_sms_muncher gem.

  • Other two options I've considered in the past:

    Skype API
    Send and receive SMS using new Skype API. I guess Twilio is cheaper, but Skype is available in more countries (if you want to receive SMSs)

    Plug a phone to your server
    If you live in a country (like Argentina) where SMS gateway companies charge a lot, you may find it cheaper to buy a phone and plug it to your server (depending on your hosting enviroment, of course). Then you can use a software like SMSToolkit to interact with the phone.

  • I would recommend looking into the two way api provided by http://www.world-text.com/.

  • I've written such a two ways SMS system using Vidicom UK as the SMS provider (not sure if they are still going). Basically they have an HTTP based API where you can send and receive SMS messages. It's too complex to explain in detail, but in essence I had two database tables, one for incoming messages received from the gateway and another one for outgoing messages that are queued and then sent on to the gateway.

    I basically then had to parse the incoming messages to see if they contained keywords such as CANCEL or STOP and then process the message accordingly. Unfortunately, you get a lot of garbage messages - you'd be surprised how many people send SMS messages to the wrong number - so you have to respond back saying "Message not understood" etc.

  • If you want an affordable bulk SMS provider, with a developer API you could use www.SourceSMS.com - they offer international coverage, and they have scripts you can simply download and integrate into your website.

  • Another option is to use PHP's mail function and a list of carrier's email servers, like so:

    Make an HTML form on a PHP file,

    <select name="carrier" style="width: 130px" >
    <option selected="" value="1">Verizon Wireless</option>
    <option value="2">Alltel</option>
    <option value="3">Boost Mobile</option>
    <option value="4">Cingular</option>
    <option value="5">Nextel</option>
    <option value="6">Sprint</option>
    <option value="7">T-Mobile</option>
    <option value="8">Virgin Mobile</option>
    <option value="9">AT&T</option>
    </select>
    

    Then set where the mail will be sent:

    if ($carrier == "1") {
        $email = "[email protected]";
    } elseif ($carrier == "2") {
        $email = "[email protected]";
    } elseif ($carrier == "3") {
        $email = "[email protected]";
    } elseif ($carrier == "4") {
        $email = "[email protected]";
    } elseif ($carrier == "5") {
        $email = "[email protected]";
    } elseif ($carrier == "6") {
        $email = "[email protected]";
    } elseif ($carrier == "7") {
        $email = "[email protected]";
    } elseif ($carrier == "8") {
        $email = "[email protected]";
    } elseif ($carrier == "9") {
        $email = "[email protected]";
    }
    

    Send the mail: ($email, $subject, $msg, $mailfrom will need to be defined and in proper format, recommend also sanitizing inputs)

    if (mail($email, $subject, $msg, $mailfrom)) {
        echo "<h4>Your Text Was Successfully Sent.</h4>";
        echo "<br />";
        if ($backurl == "") {
            echo "<a href='javascript:history.back(1);'>Back</a>";
        } else {
            echo "<a href='" . $backurl . "'>Back</a>";
        }
        echo "</body></html>";
    } else {
        echo "<h4><b>Error Sending Message</b></h4><br>Can't send txt to $to. <br> Contact the site Administrator.";
    }
    

    Make sure PHP has valid mail settings in php.ini. If you have any questions, just ask.

  • There are many producers and service providers. I know Ozeki SMS Gateway. The following URLs can help you if you want inhouse solution with own gsm modem or SMPP/UCP/CMD or else provider. When you make a decesion the first question: how many SMS do you want to send or receive?

    HTTP SMS API with examples.

    SMS API for ASP/ASP.NET Developers and Examples for PHP Developers on how to setup SMS functionality pages can give you usefull information.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM