Problem geting ThingHTTP to send sms from Twilio

1 view (last 30 days)
I hate to ask but I have been struggling with this and just can't get it working.
I set up a Twilio trial account and tested it sending an SMS to my cell phone.
I set up a Thingspeak REACT to respond to data in one of my channels and then use ThingHTTP to write data to another channel.
The part I can't get working is for a REACT to use ThingHTTP to get Twilio to send an SMS to my cell. I have read several tutorials and watched videos but just can't get there.
The ThingHTTP screen has the following:
API Key XXXYYYYZZZZ // there is a long key that thingspeak generates - as far as I know I don't use this anywhere
URL https://api/twilio.com/2014-04-01/Accounts/xxxxmynumberyyyy/Messages // have aslo tried ...mynumberyyy/SMS/Messages
HTTP Auth Username XXXXmyTwilioAccountSIDyyyy
HTTP Auth Password XXXmyTwilioAuthTokenyyyy
Method POST
Content Type application/x-www-forms-urlencoded
HTTP Version 1.1
HOST I left this blank
Headers None added
Body From=+15875555555&To=+15875555555&Body=Test Message 1 // not my real hone numbers
Parse String I left this blank
Any pointers would be greatly appreciated.
  10 Comments
Sheila Hill
Sheila Hill on 20 Nov 2020
Thanks Vinod, I hope to send very few emails - ideally none. An alert means I may have to drive several hours to go light a pilot light or fix something else.
Thanks Christopher, posting that detailed code for me did the trick. I set up a react to check for a temperature > 9 and if so, trigger the MATLAB send SMS via Twilio. It works and works very fast!
Another question - maybe I should post separately?? I see a React can easliy be set up to check for "no data". And I specify what channel to check. Is there a way to check individual fields in that channel? If I have several devices sending data to different fields in the same channel, I want to know if one of them stops sending data, even if the others are still sending data.
Christopher Stapels
Christopher Stapels on 20 Nov 2020
Edited: Christopher Stapels on 8 Dec 2020
We reccomend one channel per device for several reasons. One is that asynchronous posts could be within the update frequency and result in lost data. Another is that you get null values in the other fields when a device posts to a shared channel. If you put each device in its own channel, you can then create a summary channel that combines the two channels.
To check individual fields, I would use a MATLAB analysis script and then run it regularly with TimeControl.
thingSpeakRead() lets you specify a field to read from, or you can read a bunch of data and parse it to find missing values.

Sign in to comment.

Answers (0)

Communities

More Answers in the  ThingSpeak Community

Categories

Find more on Act on Data in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!