Currently trying to create a Whatsapp message to be sent via This custom Javascript code on Zapier shown via Twilio API. It successfully reaches out to twilio but returns "Authentication Error - No credentials provided".
var messagesUrl = "/<accountSID>/Messages.json";
var payload = {
"To": "whatsapp:<tonumber>",
"Body" : "Hey This is a test",
"From" : "whatsapp:<fromnumber>"
};
var options = {
"method" : "post",
"payload" : payload
};
options.headers = {
"Authorization" : "Basic <accountsid>:<accounttoken>"
};
fetch(messagesUrl, {options, body: JSON.stringify(payload)})
.then(function(binaryResponse) {
return binaryResponse.json();
})
.then(function(jsonResponse){
callback(null, {result: jsonResponse});
}).catch(callback);
What is the best approach to take to simply send a confirmation text on whatsapp to prospects on zapier? Thanks in advance
Currently trying to create a Whatsapp message to be sent via This custom Javascript code on Zapier shown via Twilio API. It successfully reaches out to twilio but returns "Authentication Error - No credentials provided".
var messagesUrl = "https://api.twilio./2010-04-01/Accounts/<accountSID>/Messages.json";
var payload = {
"To": "whatsapp:<tonumber>",
"Body" : "Hey This is a test",
"From" : "whatsapp:<fromnumber>"
};
var options = {
"method" : "post",
"payload" : payload
};
options.headers = {
"Authorization" : "Basic <accountsid>:<accounttoken>"
};
fetch(messagesUrl, {options, body: JSON.stringify(payload)})
.then(function(binaryResponse) {
return binaryResponse.json();
})
.then(function(jsonResponse){
callback(null, {result: jsonResponse});
}).catch(callback);
What is the best approach to take to simply send a confirmation text on whatsapp to prospects on zapier? Thanks in advance
Share Improve this question edited Jan 3, 2020 at 16:27 Conroy asked Oct 21, 2019 at 12:50 ConroyConroy 811 silver badge7 bronze badges4 Answers
Reset to default 3fetch
takes an options
object as its second argument. You're currently doing:
fetch (messagesUrl, {
options: {
method: 'post',
payload: payload,
headers: {
Authorization: '...'
}
},
body: JSON.stringify(payload)
}) // ...
You shouldn't have a nested option
object. Assuming the twilio stuff is set up correctly (I have no idea), this should work:
fetch (messagesUrl, {
method: 'post',
payload: payload, // probably remove this, it's not part of the syntax (see below)
headers: {
Authorization: '...'
}
body: JSON.stringify(payload)
}) // ...
all options you can pass to the second argument: https://developer.mozilla/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax
Thank you for your help, i ended up solving this by using a much simpler Custom web hook POST method, i was over-plicating it. Details on how i did this for anybody else wanting to send whats-app messages through Twilio on Zapier Below:
Method
Post
URL
https://api.twilio./2010-04-01/Accounts/<accountSID>/Messages.json
Data
To=whatsapp:%2B<toNumber>&From=whatsapp:%2B<fromNumber>&Body=Put your message body here
Note: The + of your E.164 number will concatenate hence the %2B to replace it
Basic Auth
<AccountSID>|<AccountToken>
Headers
Content-Type | application/x-www-form-urlencoded
I found this post very very interesting. I also use ZAPIER and TWILIO and I would like to have a customer who registers on my googlesheet receive a confirmation whatsapp message.
I can't configure ZAPIER. I did a lot of tests but I don't understand much about programming and I certainly made a mistake.
When I launch the test from ZAPIER it gives me this error: The request could not be sent to Webhooks by Zapier. The app returned "A 'To' phone number is required.".
I have attached the image with the inserted configuration. Where did I go wrong? How should I correct it?
UPDATE: my approved template on whatsapp is this:
Ciao {{1}}, la tua registrazione è avvenuta con successo.
Ricordati che lo SCONTO che hai scelto è attivo fino al {{2}}.
Ti aspettiamo - nei prossimi giorni - nel tuo Centro LIGHT di fiducia.
Nell'attesa ti facciamo ancora i migliori Auguri
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744301608a4567528.html
评论列表(0条)