Agentless WhatsApp 400 Error

Hi, I am trying to build a Data Action for Agentless WhatsApp:

I am getting the following 400 error:

{
  "message": "The request could not be understood by the server due to malformed syntax.",
  "code": "bad.request",
  "status": 400,
  "messageParams": {},
  "contextId": "fbbf33a6-139f-4fc4-a288-ad66ae30d8a1",
  "details": [
    {
      "errorCode": "ACTION.REMOTE_ENDPOINT"
    }
  ],
  "errors": [
    {
      "message": "REST call for action execute failed. Message: Request to backend service failed.  Response from web service: {\"message\":\"Bad request: Message text cannot be sent with messengerType <whatsapp>\",\"code\":\"bad.request\",\"status\":400,\"messageWithParams\":\"Bad request: {details}\",\"messageParams\":{\"details\":\"Message text cannot be sent with messengerType <whatsapp>\"},\"contextId\":\"e788abfd-f8d3-4199-9fc2-50400d1d12ab\",\"details\":[],\"errors\":[]} [fbbf33a6-139f-4fc4-a288-ad66ae30d8a1]",
      "code": "BAD_REQUEST",
      "status": 400,
      "messageParams": {},
      "details": [],
      "errors": []
    }
  ]
}

The input configuration looks like this:

> {
>   "title": "body",
>   "type": "object",
>   "properties": {
>     "fromAddress": {
>       "type": "string"
>     },
>     "toAddress": {
>       "type": "string"
>     },
>     "toAddressMessengerType": {
>       "type": "string"
>     },
>     "textBody": {
>       "type": "string"
>     }
>   },
>   "additionalProperties": true
> }

Any help would be greatly appreciated.

Hi Dimitri,

A 400 hundred error means you are not passing a JSON payload that the WhatsApp API is expecting. I will usually use something like Ngrok to help debug this code. We have a great blog post here that demonstrates how to use NGrok as a debugging tool to inspect what is being passed to an endpoint.

Thanks and I hope that helps.

Thanks,
John Carnell
Manager, Developer Engagement

Hi John

Just looking at the integration that Dimitri created, we are now getting a 200 ok response and looks like the message is being sent however we are not receiving the message on whatsapp.

I pushed through a new conversation (Whatsapp) and disconnected it.

Then ran the data action manually which shows as sent.

My question here is about the WhatsApp Opt-in Policy, how can we ensure we have opt-ed the number in as in the documentation I believe this should be asked to the customer within the conversation, but this be the first message or the in the template we are trying to push out?

If you could provide some clarity on this that would be great.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.