Webhook to Twilio with customer phone number

Hi all, I’m trying to develop a product which will send a text message to the customer upon a publish event happening. I have figured out how to webhook the publish event to Twilio but I need a method to pull my customer phone number into the webhook. What is the best way to accomplish this?

Thank you.

Hmm… Is there some Twilio API that allows you to get a response?

No I dont see how Twilio could help here? Ideally without using a middle man, I would like my particle devices to send a webhook through the particle cloud to Twilio. I have followed this guide but I am unsure how to change the “TO:” phone number to my clients dynamically.

I have thought about using IFTTT but I dont see a method where I remain in control of the devices. Our company would like to pay for the data usage as one big package.

Thanks for any tips.

You can modify the webhook to take in a mobile number as a variable that the webhook will use to perform the API call to Twilio.

Right. But how can I dynamically pull that phone number from a customer database? What kind of code can I put in that box to perform the query?

That’s going to depend a lot on where that database is & how you authenticate the user with the device etc, and if it needs to be databse.
If you were using simple authentication where you operate none of the backend yourself and one user has one device, you wouldn’t (presumably) need a database of numbers, instead that user could store their number on the device.
OTOH if you are a suitably confident web programmer then you have the skills needed for an externally hosted database of numbers, settings controls etc that would allow you to reliably provide access to the right number for the right person and you could get those using a webhook or published event.

Can you elaborate on how to do this? I have a webhook with the following Form;
“To”: “{{{To}}}”,
“From”: “{{{From}}}”,
But this sends a text message that looks like this;
{ “To”:"+1xxxxxxxxxx", “From”:"+1xxxxxxxxxx", “Message”:“hello World”}

What do I need to change so that all the SMS contains is “hello World”?


Oh, that was easy! Thanks