32

Does anyone know of any SMS APIs that I can use in my web application to send SMS messages to users?

tadman
  • 208,517
  • 23
  • 234
  • 262

3 Answers3

22

Most mobile providers support SNPP (Simple Network Paging Protocol). Despite the name, SNPP is also used to send text messages to cell phones. It's really easy to use. Just determine which mobile provider each user is using and then dispatch a "page" to the corresponding SNPP server.

For example, Sprint's SNPP server is snpp.messaging.sprint.com:444. The basic process goes like this:

  1. Open a connection to the SNPP server.
  2. Send PAGE The phone number
  3. Check for status code 250 in the reply.
  4. Send MESS Your message
  5. Check for status code 250 in the reply.
  6. Send SEND
  7. Again, check for status code 250
  8. Send QUIT

Some servers also support subject lines and delayed messages, along with two-way messaging.

David Brown
  • 35,411
  • 11
  • 83
  • 132
  • 1
    this is super interesting... the only problem is, so many different providers means lots of messiness with registration with your users. – Jason Jul 30 '09 at 01:15
  • 2
    True. You would have to ask them which carrier they are using, as I can't find any kind of API to resolve a phone number to a carrier. Could have sworn there was one, though... – David Brown Jul 30 '09 at 01:40
  • How does one "open a connection"? Like a web connection? I am missing something. – dthree May 26 '14 at 03:35
  • dc2: A TCP/IP connection. You can also connect to an SNPP server interactively using Telnet. This answer might be outdated, though. I don't know how many carriers continue to support SMS via SNPP. – David Brown May 26 '14 at 07:34
  • Between step 1 and step 2 you have to authenticate, of course :) – Ian Ellis Feb 28 '16 at 15:10
  • @IanEllis Authentication is an optional SNPP extension and, at least when I wrote this answer, Sprint's server didn't require it. I've not tested it since then. – David Brown Feb 28 '16 at 18:09
  • Wasn't criticising David :) – Ian Ellis Mar 09 '16 at 18:24
  • Didn't say you were. :) I was just clarifying for future readers that authentication is not necessarily required to use SNPP. – David Brown Mar 09 '16 at 20:01
  • @DavidBrown, Google, "cell carrier from number". A list of websites comes up including http://www.freecarrierlookup.com/ which worked on my cell number. – RattleyCooper Mar 28 '16 at 21:53
4

I think you may have a problem here...

SMS's always end up costing someone, something... You may get lucky and find a provider that has a beta or test account that allows you to send out a handful, but they may not last that long.

I used to use a place that put a 20 character advert on the end of every message, but even they stopped.

Just did a quick google for you and could not come up with any... If you are more specific such as country, you may get better answers...

edit - Just seen someone else answering with a site that looks good! - My comment is based on the UK! I am still not aware of any free provider here.

Wil
  • 10,234
  • 12
  • 54
  • 81
4

They're not free, but without a doubt the best supplier I've worked with is Clickatell http://www.clickatell.com/

They're in over 200 countries, 800 networks and their pricing is quite reasonable. They support REST HTTP/S, SOAP HTTP, FTP, SMTP, SMPP. They also support premium rate messages and MMS to generate revenue.

Doobi
  • 4,844
  • 1
  • 22
  • 17