Hi I am trying to send an image with Whatsapp api, I did my template like this one:
Hola *{{1}}* π¦ΈββοΈπ¦ΈββοΈ
Hemos cargado una nueva noticia en la intranet, si quieres visualizar la misma haz click en el
siguiente enlace: {{2}}
π *Jis Parking*
and my code is this one:
{
"to": "xxxxx",
"recipient_type": "individual",
"type": "template",
"template": {
"namespace": "88b39973_f0d5_54e1_29cf_e80f1e3da4f2",
"name": "noticia",
"language": {
"code": "es"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Richard"
},
{
"type": "image",
"image": {
"link": "image_url"
}
}
]
}
]
}
}
I added the image_url and it’s weird because I see all good and the api displays this error:
{
"error": {
"message": "(#100) The parameter messaging_product is required.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AxtiGLSBvAZltlMkJAw-GIk"
}
}
I wonder what am I doing wrong? Thanks!
2
Answers
Hey did you upload the image first?
To get an
id
or alink
first you need to upload the media using the API which would return a media object withID
and alink
.I use the Whatsapp Ruby SDK for connecting with the API which looks like this:
First, the current error says you need to add the below parameter in your request,
Second, I notice in your request, that the
image
type is not supported inbody
type component, the body type supports these 3 types of valuestext
,currency
,date_time
, for more details review the documentation,If you want to add an image to your message, you have to create a new template with a
header
type asimage
, for ex:After that, you can add an image to the
header
component, for more details review the documentation.