Error 400 "Contact is invalid" when sending second WhatsApp template message

Hi everyone,

I'm having issues sending WhatsApp template messages.

I'm using the endpoint:
https://api.sendpulse.com/whatsapp/contacts/sendTemplateByPhone

Request body:

{
  "bot_id": "xxxxxxxx",
  "phone": "xxxxxxx",
  "template": {
    "name": "xxx_xxx",
    "language": {
      "policy": "deterministic",
      "code": "pt_BR"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "xxxxx"
          },
          {
            "type": "text",
            "text": "xxxxx"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "quick_reply",
        "index": 0,
        "parameters": [
          {
            "type": "payload",
            "payload": {
              "to_chain_id": "xxxxxxxxx"
            }
          }
        ]
      }
    ]
  }
}

The issue is:

  • The first message is sent successfully

  • The second message fails with the following error:

{
  "success": false,
  "data": null,
  "errors": {
    "contact_id": [
      "Contact is invalid"
    ]
  },
  "error_code": 400
}

Additionally, the contact is being flagged as duplicated for some reason.

This happens for every phone number I test.

I also tried a different approach:

  1. Check if the contact exists using:
    https://api.sendpulse.com/whatsapp/contacts/getByPhone

  2. If it exists, send the template using:
    https://api.sendpulse.com/whatsapp/contacts/sendTemplate

However, I get the exact same error.

I tried contacting support, but no one seems to know what is happening.

What could be causing this issue? What am I doing wrong?

1
3 replies