Webhooks + Sending a text message


#1

Hey all -

Loved the recent announcement of webhook support, and couldn’t wait to go try out an integration. Integrating with an external API is incredibly simple; I’ve documented the process in the following post:

http://www.starkiller.net/2015/03/10/twilio-spark/ dead
https://github.com/hoxworth/spark-twilio

Disclaimer: I work for Twilio and thus was fairly familiar with the API, but the process I describe is applicable to most external web API providers.


Send a text message from Photon using Twilio
[SOLVED] Auth problem with electron twilio webhook
#2

Awesome! Thanks for sharing @hoxworth ! Can’t wait to integrate text messaging into my projects at home :slight_smile:

Thanks,
David


#3

@hoxworth, just one minor item. At then end, the call to the Spark.function() is:

$ spark call DEVICE_ID sendMessage

I believe it should be:

$ spark call DEVICE_ID sendSMS

Thanks for the great work! :smile:


#4

Ack thanks! That will teach me to cut and paste from my code rather than something I pre-formatted. Since I was sending an MMS I didn’t like the SMS function name… blargh. Fixed!


#6

Thanks for sharing this walkthrough, @hoxworth! I might tinker with trying to replicate this process with Sheetsu (https://sheetsu.com/) this coming weekend. I want a slightly more passive method of checking the status of a sensor for a project I’m working on, so a Google Spreadsheet makes the most sense for my project. If I’m successful (however unlikely) I’ll share back the changes I make to your code!


#8

Hi, the above link doesn’t seem to work, can you please advice where I can find the example.


#9

@Falcon : In case you just need an example to send a twilio text from photon, here’s what I use:

the webhook code:

{
    "eventName": "twilio",
    "url": "https://api.twilio.com/2010-04-01/Accounts/AccountSid/Messages", //replace AccountSid with your own
    "requestType": "POST",
    "auth": {
        "username": "Ba78453209dea6548777777", //twilio AccountSid, same as above
        "password": "cd78a653456464646464646abf" //twilio AUTH
    },
    "form": {
        "From" : "+19999999999", //your twilio number
        "To" : "+18888888888",  //recipient's number
        "Body" : "{{SPARK_EVENT_VALUE}}"
    },
    "mydevices": true
}

and this is my photon code:

Particle.publish(“twilio”, textMSG, 60, PRIVATE);


#10

@hoxworth the link is not working, can you please provide another alternative?


#11

Hello! Following up to swapn’s comment, I would also like to know if there is a working link that someone is aware of for hoxworth’s tutorial? I’m really interested in learning how to integrate twilio’s API with a photon.

Thanks!


#12

I am attempting to get sending an SMS working with an Electron via Twilio.

The Dec '15 example in this thread works fine. But I want to use a variable as the “To” field for sending the SMS. The above example uses a fixed value for the ‘To’ field. I have tried many combinations,and can’t get a variable to work. I always get a 400 error back from Twilio.


split this topic #13

2 posts were merged into an existing topic: Water Tank Sensor