Build

Add SMS Real-time Alerts + Notifications with ClickSend SMS

2 min read PubNub Staff on Nov 30, 2016
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

SMS can be a headache, so we're very excited to announce our newest BLOCKS partner, ClickSend SMS. The ClickSend SMS API lets you send and receive SMS from web-enabled computers and mobile phones. The...

SMS can be a headache, so we’re very excited to announce our newest BLOCKS partner, ClickSend SMS. They offer a wide variety of communication APIS, one of those enabling you to send and receive SMS from web-enabled computers and mobile phones.

The ClickSend SMS block allows you to send SMS alerts and notifications via the PubNub Programmable Network. For example, you might have a number of IoT sensors in the field streaming readings, and if one crosses a certain threshold, the ClickSend SMS block will automatically deliver a customizable SMS alert to any number of subscribers. Or you might want to deliver an SMS notification to a user’s phone if they are offline in a chat app.

In this tutorial, we’ll show you how to get started with the ClickSend SMS block to send your phone a simple SMS.

Create your Free ClickSend account

Sign up for your free Clicksend account here. As you go through the setup process, they will send a verification code to your mobile phone to make sure you’re a human.

ClickSend Verification

Next, they’ll send you to the ClickSend dashboard. Click on Developers > API Credentials and copy your username and API key. You’ll need them in a second.

ClickSend Credentials

Clone the ClickSend Block

Open a new browser tab with the ClickSend SMS block page. Click the try it now button to create a copy of the ClickSend Block example block. Find the lines to set your username and api key (apiUsername and apiKey), then paste in the correct values from the ClickSend dashboard. Now save the event handler then start the block. It may take a few seconds the first time you start the block for it to be fully propagated to the network.

Modify the test payload with your cellphone number, then press the publish button. You should immediately see output in the console. If you don’t then stop and start the block again. A few seconds later you should see an SMS message on your cellphone.

Clicksend Block
The ClickSend block code should look like this.

How ClickSend SMS Works

The sample block invokes the web service at https://rest.clicksend.com/v3/sms/send using the body and to fields of an incoming message. When the webservice request returns, the block forwards the response to a response channel, which is just the name of the main channel with -response appended.  That’s all there is to it!

Like many of the example blocks, this one is pretty simple. Just a webservice request triggered when a message comes in. The nice thing is that most of ClickSend’s services work with a similar easy interface. You can send SMS, emails, and even physical letters with ClickSend. Go give it a try.

More from PubNub

Top Trends to Engage Your App Users
InsightsSep 27, 20224 min read

Top Trends to Engage Your App Users

Take a look at the top trends that are the most effective in attracting customers and reducing churn, and how you can incorporate...

PubNub Staff

PubNub Staff

Comparing Game Engines: Unity vs Unreal vs the Rest
Real-Time Gaming BlogSep 21, 20225 min read

Comparing Game Engines: Unity vs Unreal vs the Rest

Comparing the major game engines: Unity vs Unreal Engine vs Corona SDK vs GameMaker Studio, including the benefits and cons of...

PubNub Staff

PubNub Staff

Python Socket Programming: Client, Server and Peer Libraries
BuildSep 21, 20226 min read

Python Socket Programming: Client, Server and Peer Libraries

Sockets (aka socket programming) enable programs to send and receive data, bi-directionally, at any given moment. This tutorial...

PubNub Staff

PubNub Staff