2

I am trying to send a WhatsApp message using the WhatsApp API with a template that includes a video. When I send templates without media content, they are successfully delivered. However, when I include a video in the template, the message is not sent without any error message.

Here is the code I'm using:

{
"messaging_product": "whatsapp",
"to": "01123456789",
"type": "template",
"template": {
    "namespace": "your-trainer",
    "name": "my_template_name",
    "language": {
        "code": "DE",
        "policy": "deterministic"
    },
    "components": [
        {
            "type": "header",
            "parameters": [
                {
                    "type": "video",
                    "video": {
                        "link": "https://scontent.whatsapp.net/v/t61....."
                    }
                }
            ]
        },
        {
            "type": "body",
            "parameters": [
                {
                    "type": "text",
                    "text": "Some custom text for variable"
                }
            ]
        }
    ]
}}

Here is my template:

    "data": [
    {
        "name": "my_template_name",
        "components": [
            {
                "type": "HEADER",
                "format": "VIDEO",
                "example": {
                    "header_handle": [
                        "https://scontent.whatsapp.net/v/t61..."
                    ]
                }
            },
            {
                "type": "BODY",
                "text": "Hallo {{1}}\n\",
                "example": {
                    "body_text": [
                        [
                            "stackoverflow"
                        ]
                    ]
                }
            },
            {
                "type": "FOOTER",
                "text": "Some Footer-Text"
            },
            {
                "type": "BUTTONS",
                "buttons": [
                    {
                        "type": "QUICK_REPLY",
                        "text": "Promotions stoppen"
                    }
                ]
            }
        ],
        "language": "de",
        "status": "APPROVED",
        "category": "MARKETING",
        "id": "myid"
    }

Here is the response

{
"messaging_product": "whatsapp",
"contacts": [
    {
        "input": "1234567899",
        "wa_id": "1234567899"
    }
],
"messages": [
    {
        "id": "wamid.HBgLNDE3OTQ2NDg4NjYVAgARGDFSDFSDFSDF"
    }
]}

Is there something I'm doing wrong?

syntax412
  • 81
  • 1
  • 9

1 Answers1

1

The solution is to upload a video via Upload API and then use the videoId.

See: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media

General Grievance
  • 4,555
  • 31
  • 31
  • 45
syntax412
  • 81
  • 1
  • 9