# Webhooks + Sending a text message

**URL:** <https://community.particle.io/t/webhooks-sending-a-text-message/10560>\
**Category:** Tutorials\
**Created:** [March 11, 2015, 3:42pm UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560 "2015-03-11T15:42:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoxworth](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/hoxworth/32/4761_2.png) [@hoxworth](https://community.particle.io/u/hoxworth)\
**Post date:** [March 11, 2015, 3:42pm UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/1 "2015-03-11T15:42:47Z")

</div>

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/](http://www.starkiller.net/2015/03/10/twilio-spark/)~~ dead  
[https://github.com/hoxworth/spark-twilio](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.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [March 11, 2015, 4:13pm UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/2 "2015-03-11T16:13:16Z")

</div>

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

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [March 11, 2015, 4:17pm UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/3 "2015-03-11T16:17:18Z")

</div>

@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! 😄

---

<div class="post-metadata">

**Author:** ![hoxworth](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/hoxworth/32/4761_2.png) [@hoxworth](https://community.particle.io/u/hoxworth)\
**Post date:** [March 11, 2015, 4:22pm UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/4 "2015-03-11T16:22:50Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![jmorrison](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jmorrison/32/7217_2.png) [@jmorrison](https://community.particle.io/u/jmorrison)\
**Post date:** [October 6, 2015, 4:49am UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/6 "2015-10-06T04:49:34Z")

</div>

Thanks for sharing this walkthrough, @hoxworth! I might tinker with trying to replicate this process with Sheetsu ([https://sheetsu.com/](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!

---

<div class="post-metadata">

**Author:** ![Falcon](https://avatars.discourse-cdn.com/v4/letter/f/49beb7/32.png) [@Falcon](https://community.particle.io/u/Falcon)\
**Post date:** [December 11, 2015, 5:38am UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/8 "2015-12-11T05:38:02Z")

</div>

> [@hoxworth](#):
>
> [http://www.starkiller.net/2015/03/10/twilio-spark/](http://www.starkiller.net/2015/03/10/twilio-spark/)

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

---

<div class="post-metadata">

**Author:** ![bpr](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@bpr](https://community.particle.io/u/bpr)\
**Post date:** [December 11, 2015, 6:31am UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/9 "2015-12-11T06:31:40Z")

</div>

@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);

---

<div class="post-metadata">

**Author:** ![swapn](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@swapn](https://community.particle.io/u/swapn)\
**Post date:** [August 9, 2016, 7:37pm UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/10 "2016-08-09T19:37:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin1](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@Colin1](https://community.particle.io/u/Colin1)\
**Post date:** [August 12, 2016, 4:57pm UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/11 "2016-08-12T16:57:25Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Awake](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Awake](https://community.particle.io/u/Awake)\
**Post date:** [December 31, 2016, 4:43am UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/12 "2016-12-31T04:43:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [November 22, 2017, 7:03am UTC](https://community.particle.io/t/webhooks-sending-a-text-message/10560/13 "2017-11-22T07:03:53Z")

</div>

2 posts were merged into an existing topic: [Water Tank Sensor](https://community.particle.io/t/water-tank-sensor/37401)
