You say you have a great idea for an application and all you need is a toolkit to help you add texting capabilities to it?
Maybe you’re sending out delivery notifications, or using text messages for two-factor authentication, or you just want to use texting in your marketing campaigns.
You’re in luck, because you can add the ability to send and receive text messages easily with the help of a cloud communications platform.
A communications platform as a service (CPaaS) provides APIs that you can call from your programs.
On the back end, these APIs connect to the telecommunications network to exchange SMS messages and make and receive voice calls. By using a CPaaS, developers are insulated from the complexities of the telecom infrastructure; they can concentrate on making their applications better.
To see how this works, let’s walk through the exact process you might use as a developer.
CPaaS platforms provide software development kits (SDK) to make it easy to use their services in various languages — Python, PHP, Java, and more. We’ll use JavaScript and Node.js.
For our CPaaS, we picked
You also have to reserve a phone number from which to send messages, which you can do with a few clicks on the Plivo management console.
Since you’re reading this article I’m going to assume you’re already familiar with JavaScript and Node.js. Plivo provides a Node.js SDK, which is
<pre>
var plivo = require('plivo');
(function main() {
'use strict';
var client = new plivo.Client("<auth_id>", "<auth_token>");
client.messages.create(
{
src: "<sender_id>",
dst: "<destination_number>",
text: "Appointment reminder: 12:00 noon tomorrow"
}
).then(function (response) {
console.log(response);
});
})();
</pre>
It should be obvious what this code snippet does. The tokens in <angle brackets> are placeholders.
You have to replace the auth placeholders with authentication credentials that you can copy from the home page of the Plivo console. Replace the source and destination phone number placeholders with actual phone numbers in E.164 format (for example, +12025551234). Boom — you’re done.
In a production environment, you would never hard-code authentication credentials into the code. You can store your credentials in environment variables instead.
If you set the variables `auth_id` and `auth_token`, you can initialize the client with no arguments and Plivo will automatically fetch the values from the environment variables.
You can use
Many organizations are concerned more with sending text messages than receiving them, but chances are some of the people you send messages to are going to text you back.
Fortunately, once you’ve got a CPaaS account, receiving texts is almost as simple as sending them. If you’re using Plivo, you can visit their “
Before you roll your newly text-enabled application out to the masses, be sure to educate yourself about
If you’re in the US, you should also learn about