Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How Do I: Create a WhatsApp template #963

Open
acidfernando opened this issue Oct 2, 2024 · 2 comments
Open

How Do I: Create a WhatsApp template #963

acidfernando opened this issue Oct 2, 2024 · 2 comments
Assignees
Labels
question Question about how to use the SDK

Comments

@acidfernando
Copy link

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 🙏

@acidfernando acidfernando added the question Question about how to use the SDK label Oct 2, 2024
@acidfernando acidfernando changed the title How Do I: How Do I: Create a WhatsApp template Oct 2, 2024
@manchuck
Copy link
Contributor

manchuck commented Oct 3, 2024

@acidfernando The SDK still needs to implement our WhatsApp template API. This is due to it being in beta. You can make calls by extending the Client in @vonage/server-client and then making the calls directly. Client will handle all the Auth when making requests.

I will leave this issue open to keep you updated as I get new information. It might be a while until we can get those endpoints implemented, so please keep checking back

@acidfernando
Copy link
Author

For the record, I ended up creating the templates directly on WhatsApp Business' Dashboard. This works well, I was able to then retrieve the created templates using Vonage's Template Beta endpoints and see their status, id, and etc.

I just wanted to leave that here just in case someone else stumbles with this thread 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about how to use the SDK
Projects
None yet
Development

No branches or pull requests

4 participants