Trying to send a message to WhatsApp but getting error

“Action Name”: “Urgent Team WhatsApp Notification”,
“Errors”: “Error: The webhook url 'https://api.whatsapp.com/send?phone=SELECT(Users[WhatsApp],AND(IN(“10”,[GET_URGENT]), CONTAINS([Urgent_Method],{“WhatsApp”}), [KEY_PRAYER]<>TRUE, IN([_THISROW].[TEAM_NO],[TEAM_NO]))) is not well formed Error: Failed to parse JSON due to Unexpected character encountered while parsing value: h. Path ‘’, line 0, position 0…”,
“Url”: “https://api.whatsapp.com/send?phone=SELECT(Users[WhatsApp],AND(IN(“10”,[GET_URGENT]), CONTAINS([Urgent_Method],{“WhatsApp”}), [KEY_PRAYER]<>TRUE, IN([_THISROW].[TEAM_NO],[TEAM_NO])))”,
“Verb”: “Post”,

I need the select statement to include only the records which fit the criteria.
questions: 1. can whatsapp process a list of numbers like an SMS workflow can?
2. How do I filter to get that list?

I’m sending the same notification, a link to a specific record in my app, via Email and Text and need to do the same for WhatsApp for international users since Text only works for U.S. and Canada.

Any help will be appreciated.

0 12 1,332
12 REPLIES 12

Steve
Platinum 4
Platinum 4

Maybe enclose the SELECT() expression in << and >>?

Thanks Steve, that got me closer. It passed the phone number on correctly

“ActionNotPerformed”: “1 errors present.”,
“ActionResults”: “Created 1 ActionResults”,
“Action Type”: “Webhook”,
“Action Name”: “Urgent Team WhatsApp Notification”,
“Errors”: “Error: Failed to parse JSON due to Unexpected character encountered while parsing value: h. Path ‘’, line 0, position 0…”,
“Url”: "https://api.whatsapp.com/send?phone=1222333444,

The select appears to be putting a comma after the number, possibly since the result could easily be a list, but I think that is throwing the error.

I think the comma is an artifact of the error report format, not the output of your expression.

The result of a SELECT() expression is always a list, even if a list of just one item. If that comma has to do with the result of the SELECT() expression, it suggests there is more than one phone number, and that the second number is blank. Typically, though, the list of values produced by SELECT() would be separated by space-comma-space (,) rather than just comma (,).

Please post a screenshot of the error message, and a screenshot of the template.

I’m not using a template. Here is the full text of the URL field:
https://api.whatsapp.com/send?phone=<<SELECT(Users[WhatsApp#],AND(IN(“10”,[GET_URGENT]), CONTAINS([Urgent_Method],{“WhatsApp”}), [KEY_PRAYER]<>TRUE, IN([_THISROW].[TEAM_NO],[TEAM_NO])))>>

Try this instead:

https://api.whatsapp.com/send?phone=<<ENCODEURL(SELECT(Users[WhatsApp#],AND(IN(“10”,[GET_URGENT]), CONTAINS([Urgent_Method],{“WhatsApp”}), [KEY_PRAYER]<>TRUE, IN([_THISROW].[TEAM_NO],[TEAM_NO]))))>>

That got me a second phone number but still an error.

I suspect the Url line isn’t the problem at this point, as it is valid. Instead, I’m concerned the Payload data does not appear to be JSON. Whatever the case, webhooks are outside my wheelhouse. Maybe @LeventK or @Aleksi might chime in?

Thanks for your help Steve. I appreciate it.

Firstly;
I believe rather than SELECT(), the expression shall be SUBSTITUTE((ANY(SELECT(...)),"+","") as phone parameter will only accept numbers. And as HTTP content is chosen as JSON, the payload body shall be:

{
    "text": "<<ENCODEURL([MessageColumnName])>>"
}

@Lucinda_Mason
@Steve
The main problem is this:
When you invoke this REST API, it automatically redirects you to a webpage to ensure that you have a WhatsApp account, so that you can send the text via WhatsApp web:


POSTMAN API CALL



JSFIDDLE FOR THE API CALL RESPONSE



CONCLUSION


Provided WhatsApp messaging is a must and you want to send those messages directly from an AppSheet App thru a webhook workflow, I might advise 2 options:
Option#1: Create your own Twilio Account and use their WhatsApp endpoint > https://www.twilio.com/whatsapp
Option#2: Create your own WhatsApp Business Account and then enroll for WhatsApp Business API > https://www.whatsapp.com/business/api/?lang=fb

Thanks Levent.

SO I changed a few things and got it to work, at least NO errors, but nothing opens in my browser and nothing comes through to my whatsapp app on my phone.

In other words, the webhook is running and working but won’t produce what I want unless I get either a twilio account or whatsapp business? Are those expensive?

here is what shows:
Response": "\n<html lang=“en” id=“facebook” class=“no_js”>\n<meta charset=“utf-8” /><meta name=“referrer” content=“default” id=“meta_referrer” /><script nonce=“14CLNRu1”>window._cstart=+new Date();<script nonce=“14CLNRu1”>function envFlush(a){function b(b){for(var c in a)b[c]=a[c]}window.requireLazy?window.requireLazy([“Env”],b):(window.Env=window.Env||{},b(window.Env))}envFlush({“ajaxpipe_token”:“AXjfB20W-Rr18g8sEsY”,“timeslice_heartbeat_config”:{“pollIntervalMs”:33,“idleGapThresholdMs”:60,“ignoredTimesliceNames”:{“requestAnimationFrame”:true,“Event listenHandler mousemove”:true,"Event listenHandler

“ActionResults”: “Created 1 ActionResults”,
“Action Type”: “Webhook”,
“Action Name”: “Urgent Team WhatsApp Notification”,
“Url”: “https://api.whatsapp.com/send?phone=14072324214”,
“Verb”: “Post”,
“MimeType”: “application/json”,
“Headers”: “”,
“Payload”: "{“text”: "https://tinyurl.com/y6rlyhks#appName=Requests-1778436&page=detail&rowc78f692f&table=Pri_Req_Visible_...,
“AppTemplateName”: “922dbed2-5196-4caa-9581-401fc815a472”,
“Operation”: “Workflow action”,
“Result”: “Success”

@Lucinda_Mason
You can review Twilio pricing from here > https://www.twilio.com/whatsapp/pricing/us

Top Labels in this Space