Products

Getting Started With The Infobip SMS API: A Quick Start Guide

With an easy-to-integrate SMS API, it's simpler than ever to start sending text messages to your consumers.

May 31 2016

Getting started with the Infobip SMS API is simple and easy. The API is designed so any developer can quickly integrate SMS API into your applications and start sending messages to customers right away.

Once your developer access has been approved, and we’ve set up international SMS messaging on your account, you can reach your customers whenever you want, wherever they are, anywhere in the world. The basic Infobip SMS API is just eight lines of code, that’s all that’s required to start sending messages to customers.

Approved accounts and developers can use the SMS API to:

  • Send basic SMS text messages anywhere in the world
  • See message cost and delivery rates by country
  • Send social shares and invites (e.g. links to download apps)
  • Send Flash SMS messages anywhere in the world

We Speak Your Language

The SMS API is based on REST standards, with all requests generated through the PUSH, POST, and GET methods. Infobip’s API accepts JSON and XML content types. The API supports Java, PHP, python, C#, and Ruby on Rails.

When you have questions, our API developer hub has detailed examples and tutorials to help you get started and answer your questions.

How to Start Sending SMS Messages with the SMS API

Let’s dig into the Infobip SMS API with a few examples and code samples. First, the basics of SMS. SMS standards are simple:

  • Each message should be 160 characters or fewer
  • The phone number you are sending to should use E.164 number formatting

The Infobip SMS API handles different mobile network operators (MNOs) and country-specific requirements so you only have to worry about writing code. Here is the most basic example of sending a message through the API—all eight lines of it:

JSON
POST /sms/1/text/single HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{  
   "from":"InfoSMS",
   "to":"41793026727",
   "text":"Test SMS."
}

 

Sending To Multiple Recipients

Using the API to send multiple text messages (or sending to messages multiple recipients) isn’t much more complicated than sending a single message (see below):

JSON
POST /sms/1/text/multi HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{  
   "messages":[  
      {  
         "from":"InfoSMS",
         "to":[  
            "41793026727",
            "41793026731"
         ],
         "text":"May the Force be with you!"
      },
      {  
         "from":"41793026700",
         "to":"41793026785",
         "text":"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire."
      }
   ]
}

 

Sending Social Invites and App Links

The API allows you to integrate Social Invites and app sharing. The sample below would send the link and also allow you track the link through the Infobip Portal. Social Invites are powerful and easy ways to drive app downloads and user engagement.

JSON
POST /sms/1/text/advanced HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json

{
   "bulkId":"BULK-ID-123-xyz",
   "messages":[
      {
         "from":"InfoSMS",
         "destinations":[
            {
               "to":"41793026727",
               "messageId":"MESSAGE-ID-123-xyz"
            },
            {
               "to":"41793026731"
            }
         ],
         "text":"Hey, take a look at this awesome application :  https://play.google.com/store/apps/details?id=com.myApp"
      }
    ],
   "tracking":{
         "track":"URL",
         "type":"SOCIAL_INVITES"
    }
}

 

Fully-Featured Messages

The fully featured text messaging options built into the SMS API let you specify additional parameters that will make your campaigns more compelling—and easier to track for reporting and analysis.

Language Support

Customers want to see messages in their preferred alphabet, but the standard alphabet used for SMS doesn’t have every letter in the world. You can use Unicode characters, but doing that reduces how long your message can be. This means you may need to send two texts, doubling your costs. Infobip has two solutions to reduce costs and improve customer experience when using complex alphabets.

Transliteration automatically converts Unicode to the regular character set. Your developer simply sets a parameter in the code to one of the supported alphabets (Turkish, Greek, Cyrillic, Serbian Cyrillic, Central European, or Baltic) and the API handles the rest.

National Language Identifier is an encoding technology that accomplishes a similar goal as transliteration for languages that require many diacritical marks. It too can be set as a parameter. Our API currently supports Turkish, Spanish, and Portuguese.

Flash SMS

A bank detects possible fraud. An airline makes a last-minute gate change. When your customers need to see urgent messages, Flash SMS messages skip their mobile inbox and appear right on your customer’s home screen. Just one additional line of code enables Flash SMS messages in your application through the SMS API.

Perfect Timing For Your Messages

To help you send your messages when they’ll be most effective at reaching your customers, our text messaging API includes two timing parameters:

  • “sendAt” lets you schedule messages to be delivered at a set time
  • “Validity Period” lets you send messages within a predetermined window of time

You don’t need to worry about whether to use twelve or twenty four hour time or not—Infobip’s API documentation shows the time formats required.

No one wants to get text messages at 4 a.m., but the correct timing doesn’t just keep you from waking up your customers, it keeps you from violating local laws and regulations too. In India marketing messages can only be sent between 9 a.m. and 9 p.m (even if you have permission to send the message to your customer). The SMS API and our team of mobile messaging experts will help keep you on the right side of local rules and regulations as you expand into global markets. Navigating local laws and regulations is just one part of our developer support programs we offer at no additional cost.

Campaign Tracking

Our simple and powerful reporting tools help you identify what’s working and what isn’t within your campaigns. The SMS API gives you the data so you make changes quickly to improve opens, actions, and delivery rates.

Basic Reporting

Every message you send generates a response code, which will be delivered to you through the API. 200 OK means the message went through, if something went wrong, the API will let you know. The response code tells you what the problem was and our documentation and developer resources will help you determine the cause and how to fix the problem.

The API gives you access to delivery reports for your application and campaigns. These reports identify each text message and give developers access to data like:

  • Price per message
  • Message status
  • Errors, if any

These data can be used as is or made into custom reports for other stakeholders and team members.

Fully-Featured Reporting

The SMS API allows setting campaign and message-specific tracking parameters. Accurate tracking is essential for critical messages—like sending one-time PINs for two-factor authentication—but also helps determine the results from any messaging campaign.

Custom Bulk ID and Message ID

You can track the performance of a single campaign by setting an ID for a group of messages. These IDs can be automatically generated or defined by you. Setting up tracking IDs with the SMS API is simple:

JSON
POST /sms/1/text/advanced HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json

{
   "bulkId":"CUSTOM-BULK-ID-1",
   "messages":[
      {
         "from":"InfoSMS",
         "destinations":[
            {
               "to":"41793026727",
               "messageId":"CUSTOM-MESSAGE-ID-1"
            },
            {
               "to":"41793026731",
               "messageId":"CUSTOM-MESSAGE-ID-2"
            }
         ],
         "text":"A long time ago, in a galaxy far, far away..."
      },
      {
         "from":"41793026700",
         "destinations":[
            {
               "to":"41793026785"
            }
         ],
         "text":"It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire."
      }
   ]
}

 

Intermediate, Real-time Delivery Reports

The API can send real-time reports whenever a delivery error occurs so you can take immediate action and not have to wait for the campaign to finish to fix problems, for example if one-time-pins aren’t getting to some customers. You can see which countries and mobile network operators are causing the most errors. Real-time reporting lets you adjust campaigns while they are running to optimize delivery and actions.

Conversion Rates

Are your messages being opened? Are people clicking on links? Which users, in which countries? Are iOS users more engaged than Android?

Setting a simple parameter in your code, flags a message as a possible conversion once an action is taken. Once you have actions on your app or site, you’ll send that information back to Infobip. We’ll pair it up with our report and send you the conversion rates, which can be segmented by:

  • Country
  • Mobile Network Operator
  • Operating System
  • Time Received

You can use the SMS API to build custom reports for error reporting, marketing, or campaign costs.

URL Shortening and Tracking

You can track click-throughs from your message to your website or other destination. The API can shorten URLs so they fit within SMS character limits and automatically track click-throughs for you.

When a user clicks a link, you’ll receive a report that includes users’:

  • Phone number
  • Country
  • Mobile network operator
  • Phone operating system

Going Beyond Text

Now that you’ve got the basics of using the Infobip SMS API, you can use it to generate, track, and optimize international text message campaigns quickly and easily.

When you’re ready for your app to do more, the SMS API can handle Number Lookup, two-factor authentication, and messaging across additional platforms (email, voice, and chat/OTT). All of these advanced functions are available using the same API, and can reuse much of the same code you developed for your initial campaigns.

Start connecting your apps to SMS with the Infobip SMS API and help your company reach billions of people around the world.

Test Our Platform