IN THIS ARTICLE

    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

    When they ask how you found ClickSend, be sure to let them know you heard about them from PubNub.

    ClickSend

    Next, they’ll send you to the ClickSend dashboard. Click on Accounts > Add/Edit Subaccounts and copy your username and API key. You’ll need them in a second.

    ClickSend

    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

    How ClickSend SMS Works

    The sample block invokes the webservice 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.

    Try PubNub today!
    Build realtime applications that perform reliably and securely, at global scale.
    Try Our APIs
    Try PubNub today!

    More From PubNub