Guide: Twilio WhatsApp Message API WebHook with Appsheet Bot

Here is the guide on setup your webhook with Twilio REST API

URL: https://api.twilio.com/2010-04-01/Accounts/#yourAccountSid#/Messages.json

Body: To=whatsapp:%2B60xxxxxxx&From=whatsapp:%2B14xxxxxxxBody=TestTest
Header: Authorization: โ€œBasic QUM3OTVjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxโ€

Example: Authorization: "Basic " + Base64Encoded(TwilioAccountSID + โ€œ:โ€ + TwilioAuthToken)
URL Encode and Decode - Online (urlencoder.org)

6 5 2,346
5 REPLIES 5

Feel free to share if anyone found other better method of doing this.

Is it working? Iโ€™ll be following what youโ€™ve showed here and Iโ€™ll probably comment backโ€ฆ I am currently using whatsapp public api, building the link with one killer expression and using action to send the order to my clients. When they confirm, I manually change status on the app. Not perfect, but better than what was before. But if I can get the chatbot to work for me here on appsheet, thatโ€™s seems to be a good solution for speed things up on production.

I donโ€™t know which part I did wrong, itโ€™s not working. If it is okay with you, will you please help me out?
Thanks!
From Bot Monitor:
โ€œExceptionโ€: "Webhook HTTP post request failed with exception The remote server returned an error: (401) Unauthorized. "
I provided my own Twilio SID and Auth Token, what else did I miss?

Task Properties
{
โ€œExceptionโ€: "Webhook HTTP post request failed with exception The remote server returned an error: (400) Bad Request. ",
โ€œTask Typeโ€: โ€œWebhookโ€,
โ€œTask Nameโ€: โ€œTwilio Whatsapp Webhookโ€,
โ€œUrlโ€: โ€œhttps://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Messages.jsonโ€,
โ€œVerbโ€: โ€œPostโ€,
โ€œMimeTypeโ€: โ€œapplication/jsonโ€,
โ€œHeadersโ€: โ€œAuthorization:Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxโ€,
โ€œPayloadโ€: "{โ€œtoโ€: โ€œwhatsapp:+91xxxxxxxxxxโ€,โ€œfromโ€: โ€œwhatsapp:+1xxxxxxxxxxโ€,โ€œbodyโ€: "Your Yummy Cupcakes Company order of 1 dozen frosted cupcakes has shipped and should be delivered on July 10, 2019. Details: http://www.yummycupcakes.com/"}"
}

And with URL Encode

Task Properties
{
โ€œExceptionโ€: "Webhook HTTP post request failed with exception The remote server returned an error: (400) Bad Request. ",
โ€œTask Typeโ€: โ€œWebhookโ€,
โ€œTask Nameโ€: โ€œTwilio Whatsapp Webhookโ€,
โ€œUrlโ€: โ€œhttps://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxxxxxxxxxxxxxxxxxxx/Messages.jsonโ€,
โ€œVerbโ€: โ€œPostโ€,
โ€œMimeTypeโ€: โ€œapplication/x-www-form-urlencodedโ€,
โ€œHeadersโ€: โ€œAuthorization:Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxโ€,
โ€œPayloadโ€: โ€œTo=whatsapp:%291xxxxxxxxxx&From=whatsapp:%2B1xxxxxxxxxxBody=TestTestโ€
}

Twilio Help:
400 : Bad Request There was an error with the request. The body of the response will have more info

Will this help in semding automated messages through whatsapp? Like of i want to send same message to 100s of my customers, will it let me do it?

Top Labels in this Space