We’ve recently partnered with PubNub to offer a ClickSend Block. This allows you to send SMS using the PubNub platform. For example, if you wanted to send alerts for unusual conditions, such as sensors showing strange data or spammers trying to hack your chat app.
Create the ClickSend Block on PubNub
In a new browser tab go to this page and 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.
How it 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 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.