Skip to content

How Do I: Create a WhatsApp template #963

Open
@acidfernando

Description

How do I

Create a WhatsApp template

API/Product

Messages

Code Sample

Hello!

I've been trying to send WhatsApp messages via /v1/messages endpoint, but it's throwing this error: "1340: Outside of Allowed Window"

From reading this I understand I need to create a template.

I could find only two resources that explain how to create a template. One of them is through jumper.ai's dashboard. I'm not sure how to go with this approach. I assume jumper.ai is not free, so I'd prefer not to go through with that option

The other way I found was through the API

I tried it and I could create a template with this payload:

{
   "name": "template_name",
   "language": "es",
   "category": "UTILITY",
   "allow_category_change": true,
   "components": [
      {
         "type": "BODY",
         "text": "example text for the issue"
      }
   ]
}

I then deleted because it had placeholder text. Then, I went to create a template with real data with this payload:

{
   "name": "upcoming_videoconsultations_administrator",
   "language": "es",
   "category": "UTILITY",
   "allow_category_change": true,
   "components": [
      {
         "type": "BODY",
         "text": "¡Buen día! Aquí tienes el resumen de tus videoconsultas de tu centro para mañana. Más detalles en {{1}}",
	"example": {
		      "body_text": "[['https://domain.com/path']]"
    	}
      }
   ]
}

This one fails with this error:

{
	"type": "https://developer.vonage.com/api-errors",
	"title": "Message template \"components\" param is missing expected field(s)",
	"detail": "component of type BODY is missing expected field(s) (example)",
	"instance": "uuid-v4-blabla-bla"
}

But I'm a little confused since I'm sending the example field just as the documentation says.

Am I doing something wrong?

Sorry in advance for posting this in vonage-node-sdk, I know it's not related to the sdk but I can't find another way of asking 🙏

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

questionQuestion about how to use the SDK

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions