I’m experiencing an issue when trying to send messages through the WhatsApp API using AppSheet. I’ve configured a task to send messages through the WhatsApp API, but the task fails with a “400 Bad Request” status code. Below, I provide details about the request and the response received:
Request Details:
- Destination URL: https://graph.facebook.com/v17.0/206090892578783/messages
- HTTP Method: POST
- Headers:
- Authorization: Bearer [Access Token]
Received Response:
- Status Code: 400 Bad Request
- Error Message: “The remote server returned an error: (400) Bad Request.”
Observations:
- The task to send messages through the WhatsApp API utilizes AppSheet.
- The access token used in the authorization header is valid.
- It has been verified that the destination URL and the request payload are correct and in the expected format.
- Most importantly, the task only works when using one variable in the payload. It fails when attempting to use more than two variables.
I would appreciate any guidance or assistance in resolving this issue and ensuring that the task of sending messages works correctly through the WhatsApp API using AppSheet.
Thank you for your help!
Request Payload (Working):
{
“messaging_product”: “whatsapp”,
“to”: “51964221743”,
“type”: “template”,
“template”: {
“name”: “orden2”,
“language”: {
“code”: “es”
},
“components”: [
{
“type”: “body”,
“parameters”: [
{
“type”: “text”,
“text”: “<<[CLIENTE]>>”
}
]
}
]
}
}
Request Payload (Not Working):
{
“messaging_product”: “whatsapp”,
“to”: “51964221743”,
“type”: “template”,
“template”: {
“name”: “orden2”,
“language”: {
“code”: “es”
},
“components”: [
{
“type”: “body”,
“parameters”: [
{
“type”: “text”,
“text”: “<<[CLIENTE]>>”
},
{
“type”: “text”,
“text”: “<<[BANCOS]>>”
},
{
“type”: “text”,
“text”: “<<[BANCOS CARGO]>>”
},
{
“type”: “text”,
“text”: “<<[No de Documento]>>”
},
{
“type”: “text”,
“text”: “<<[PKID]>>”
},
{
“type”: “text”,
“text”: “<<[FECHA]>>”
},
{
“type”: “text”,
“text”: “<<[HORA]>>”
},
{
“type”: “text”,
“text”: “<<[Tipo de Operacion]>>”
},
{
“type”: “text”,
“text”: “<<[Monto USD]>>”
},
{
“type”: “text”,
“text”: “<<[FX COTIZAR]>>”
},
{
“type”: “text”,
“text”: “<<[Monto PEN]>>”
},
{
“type”: “text”,
“text”: “<<[BANCOS DESTINO]>>”
},
{
“type”: “text”,
“text”: “<<[BANCOS ABONO]>>”
},
{
“type”: “text”,
“text”: “<<[CUENTA ABONO VALOR]>>”
}
]
}
]
}
}