Messente, for example, has multiple development libraries for most popular programming languages that do the heavy lifting and help avoid some general mistakes. Although libraries can't help you with everything and you should not overlook most common practices.

1. Check the response code and act accordingly

Usually, developers check if the SMS was successfully sent to the service provider and if there is an error, the app tries to send the text again or just skips it.

When an error code is returned there should be at least two different processes implemented:

  • When there is a temporary error, try again (but not indefinitely)
  • In case of a fatal error do not try to send again

In either case, the server administrator should be notified that an error occurred and someone should look into it, which lead us to the next point.

2. Show notifications in case of an error

When an error code is returned for the message sending request, there could be dozens of reasons why it failed.


In every case, the server administrator should be somehow notified that something unexpected happened with the SMS messaging service.

Having an internal notification system will help you avoid most common causes like for example when the account runs out of credits.

3. Keep track of your IP address changes

Messente has implemented IP-based filters for API calls to block requests from unwanted servers.

When possible, get your server a static IP address. You can also add a list of multiple IP addresses in the API settings to allow requests to be made from multiple servers.

4. Use correct encoding of the message body

The most commonly used character encoding in the web is UTF-8, that supports all the characters from all alphabets. This is also what Messente assumes you are using.

When testing out the API and everything seems to be working with simple “ABC”, you might run into trouble when suddenly you need to send a text with “ñ” character in it.

If you are using some other encoding like Western (ISO-8859-1) or Cryllic (KOI8-R), first convert the text to UTF-8.

5. Use GSM-friendly characters

A single SMS can contain 160 characters. However, SMS is built to use 7-bit GSM 03.38 character encoding set and this means that certain Unicode characters (that are not in GSM character set) don't fit into the message.

If your message contains any characters not listed in the 7-bit alphabet then the message encoding will be set to UCS-2. With it, the message length is limited to 70 characters.

This can get expensive quickly. To avoid the extra costs convert all non-GSM friendly characters to similar characters in GSM 03.38 encoding set or let Messente auto convert it for you.

Also, you can use our SMS length calculator to make sure your messages are within the limits.

Summary

Integrating an SMS API with development libraries is as simple as adding an automatic email to your application. However, with any integration, you need to be prepared for exceptions and edge cases. Hopefully, these tips help you avoid some common problems.