Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi everyone!

Is anyone able to send WhatsApp templates using the ChatWoot API?

I wasted the whole afternoon trying in the most diverse ways and nothing... And look, I'm trying using the simplest pattern that exists, the "Hello World" created by Meta itself...

I am using this endpoint: /api/v1/accounts/{account_id}/conversations

The JSON is this:

{
  "source_id": "123",
  "inbox_id": "1",
  "contact_id": "11",
  "status": "open",
  "message": {
    "content": "Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.",
    "template_params": {
      "name": "hello_world",
      "category": "UTILITY",
      "language": "en_US"
    }
  }
}

The message is created correctly within the conversation, and I can view it. However, it never reaches the user. It only appears in ChatWoot.

print

I'm going crazy with this, can anyone help me?

Edit: Version v4.5.2

You must be logged in to vote

Guys, I finally managed to resolve the issue, which was occurring due to incorrect information in the API documentation, which I humbly suggest be updated.

This link provides instructions on how to CREATE a conversation.
https://developers.chatwoot.com/api-reference/conversations/create-new-conversation

One of the required parameters is the source_id:

The thing is, this parameter is not required (at least when trying to send a template) and if you try to generate any random number just to not sent it in blank, it will result in error.

What I did was simply not send it. I used the same code shown above. The only difference was that I didn't send the source_id:

{
"inbox_id": 1,
"contact_id…

Replies: 4 comments · 5 replies

Comment options

@rpetribu which channel provider are you using ?

You must be logged in to vote
1 reply
@rpetribu
Comment options

WhatsApp Cloud.

Comment options

Ok, I found an old post here #5958 where @munawar050 manage to solve this using a code that is not in Chatwoot's API documentation. And miraculously it works.

So, I am now facing another problem. Templates are only sent correctly if:

  1. There are no open conversations in the last 24 hours AND the template has no variables;

OR

  1. If there is an open conversation in the last 24 hours.

This makes no sense at all. All templates are approved by Meta. I can even send them normally via API to Meta and through ManyChat.

I would really like to know if anyone is able to use this feature normally, I am willing to pay for someone to be able to guide me....

You must be logged in to vote
3 replies
@munawar050
Comment options

@rpetribu thanks

My template messages go irrespective of the conversation status (open close etc)
If you can share more information maybe we can help

@muhsin-k
Comment options

@rpetribu We’ve recently made some updates to WhatsApp templates, you can find the guide here. Please also review the API documentation too ensure you’re using the correct flow. Could you check if anything is missing or unclear in the docs and let us know?

@rpetribu
Comment options

Thank you @munawar050 and @muhsin-k for your help.

I modified the code I was using following your instructions.

I'm using n8n and sending a POST to open a conversation with a template using this API documentation.

The code I'm using is this:

{
"source_id": "1234",
"inbox_id": 1,
"contact_id": 1,
"status": "open",
"message": {
  "content": "Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.",
"message_type": "outgoing",
"private": false,
"content_type": "text",
"template_params": {
"name": "hello_world",
"category": "UTILITY",
"language": "en_US"
}}}
image

The message isn't being sent, likely because the open conversation hasn't had any interaction with the contact in the last 24 hours. This doesn't make sense, as it's a template already approved by Meta.

I tried to change the approach and, instead of creating a conversation, I tried to create a message. To do this, I divided the action into two steps.

  1. Create a blank conversation:

POST: https://[MY URL]/api/v1/accounts/1/conversations/

{
"source_id": "1234",
"inbox_id": 1,
"contact_id": 1,
"status": "open",
"message": {
"content": ""
}
}
  1. Send the template within that conversation:

POST: https://[MY URL]/api/v1/accounts/1/conversations/[ID CREATED ABOVE]/messages

{
  "content": "Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.",
"message_type": "outgoing",
"private": false,
"content_type": "text",
"template_params": {
"name": "hello_world",
"category": "UTILITY",
"language": "en_US",
}
}

The result.... the same.

Now, if the contact send me a message and i pick this conversation ID, I can send the template using the code above to that conversation.

image

POST: https://[MY URL]/api/v1/accounts/1/conversations/32/messages

{
  "content": "Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.",
"message_type": "outgoing",
"private": false,
"content_type": "text",
"template_params": {
"name": "hello_world",
"category": "UTILITY",
"language": "en_US",
}
}
image

And I also received the tempalte in my Whatsapp....

In short...

The template only sends if I create a message in an already open conversation with the contact. Otherwise, it doesn't send.

Using the Chatwoot UI, I'm getting it working normally, without any issues.

Comment options

Guys, I finally managed to resolve the issue, which was occurring due to incorrect information in the API documentation, which I humbly suggest be updated.

This link provides instructions on how to CREATE a conversation.
https://developers.chatwoot.com/api-reference/conversations/create-new-conversation

One of the required parameters is the source_id:

image

The thing is, this parameter is not required (at least when trying to send a template) and if you try to generate any random number just to not sent it in blank, it will result in error.

What I did was simply not send it. I used the same code shown above. The only difference was that I didn't send the source_id:

{
"inbox_id": 1,
"contact_id": 1,
"status": "open",
"message": {
  "content": "Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.",
"message_type": "outgoing",
"private": false,
"content_type": "text",
"template_params": {
"name": "hello_world",
"category": "UTILITY",
"language": "en_US"
}}}

It worked!

Thanks again for your help.

You must be logged in to vote
1 reply
@munawar050
Comment options

Was just about to mention this, glad you found the resolution

Answer selected by rpetribu
Comment options

Sending WhatsApp templates with dynamic URL buttons via Chatwoot API + n8n

After hours of debugging, I found the correct format to send WhatsApp templates with dynamic URL buttons through the Chatwoot API. The official documentation does not cover this correctly.

The problem

The processed_params format for dynamic URL buttons is not documented. Common attempts like "button": {"1": "value"} or "buttons": ["value"] all fail with errors like #132000 or #131008.

The solution

Use the endpoint POST /api/v1/accounts/{account_id}/conversations/{conversation_id}/messages with this exact body:

{
  "message_type": "outgoing",
  "private": false,
  "content_type": "text",
  "content": "Your message text here",
  "template_params": {
    "name": "your_template_name",
    "category": "UTILITY",
    "language": "pt_BR",
    "processed_params": {
      "body": {
        "variable_name": "value"
      },
      "buttons": [
        {
          "type": "url",
          "parameter": "dynamic-url-suffix",
          "url": "https://yourdomain.com/{{1}}",
          "variables": ["1"]
        }
      ]
    }
  }
}

Key points

  • The buttons field must be an array of objects, not a key-value pair
  • Each button needs type, parameter, url and variables fields
  • The parameter field receives only the dynamic suffix, not the full URL
  • The url field must contain the base URL exactly as registered in Meta, including {{1}}
  • Do NOT send source_id when creating conversations with templates — it causes errors even though the API docs mark it as required

How I found this

The official docs were wrong. I inspected the actual network request made by the Chatwoot UI when sending a template manually via DevTools → Network → Fetch/XHR → Payload, and replicated the exact format.

Chatwoot version: 4.12.1
Channel: WhatsApp Cloud API (WABA)


É só copiar e colar no GitHub! Vai ajudar muita gente que passar pelo mesmo problema. 🚀

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.