Send Template with media using Whatsapp Cloud API

22 views Asked by At

I am trying to send a message template with media using WhatsApp cloud API.

the endpoint is: https://graph.facebook.com/v19.0/phone_number_id/messages.

the body of the request is:

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "phone-number",
    "type": "template",
    "template": {
        "name": "announcement",
        "language": {
            "code": "ar"
        },
        "components": [{
            "type": "body",
            "parameters": [{
                    "type": "text",
                    "text": "نص الرسالة"
                },
                {
                    "type": "document",
                    "document": {
                        "id": "334125649192266",
                        "filename": "test name"
                    }
                }

            ]
        }]
    }
}

The Error is:

{
    "error": {
        "message": "(#131000) Something went wrong",
        "type": "OAuthException",
        "code": 131000,
        "error_data": {
            "messaging_product": "whatsapp",
            "details": "Something went wrong"
        },
        "fbtrace_id": "Ajghr-SrBwG4dShZ7XNYv3e"
    }
}

Note: I have uploaded the file to the WhatsApp server successfully, and I can get it using the get media endpoint

0

There are 0 answers