Pubnub

Updated 3 days ago

Pubnub Integration

The ClickSend SMS block allows you to send SMS 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 customisable SMS alert to any number of subscribers.

Step 1. Create a 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.

Step 2. Get API Key

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

Step 3. 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.

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!

Step 4. Integrate with your system

Once familiar with how the ClickSend block works, integrate it with the system you want to use the ClickSend functionality with.

Like many of the example blocks, this one is pretty simple. Just a webservice request triggered when a message comes in. The good news is that all of our products are compatible, so you can send SMS, Voice, Email, Faxes, and even physical letters.

Also be sure to check out the many other example blocks PubNub have in the BLOCKS Catalog.


How Did We Do?

Powered by HelpDocs (opens in a new tab)