Invalid Documentation
1

Hello Dear Team, 1- I found an invalid example on this page: https://developers.facebook.com/docs/whatsapp/cloud-api/messages/document-messages#example-request

Please se below (I copied from the page): The example talking about sending PDF file with caption but in the example there is no PDF file and this must be corrected

Example request to send a PDF in a document message with a caption to a WhatsApp user.

curl 'https://graph.facebook.com/v20.0/106540352242922/messages' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer EAAJB...' \ -d ' { "messaging_product": "whatsapp", "recipient_type": "individual", "to": "+16505551234", "type": "text", "text": { "preview_url": true, "body": "As requested, here'\''s the link to our latest product: https://www.meta.com/quest/quest-3/" } }'

The correct structure of the POST Body must be like this: { "messaging_product": "whatsapp", "recipient_type": "individual", "to": "<WHATSAPP_USER_PHONE_NUMBER>", "type": "document", "document": { "id" : "<MEDIA_ID>", /* Only if using uploaded media / "link": "<MEDIA_URL>", / Only if linking to your media */ "caption": "<DOCUMENT_CAPTION>", "filename": "<DOCUMENT_FILENAME>" } }

2- On this page: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media/#example-3 Example given for downloading MEDIA (For example an image): curl \ 'URL' \ -H 'Authorization: Bearer ACCESS_TOKEN' > media_file

I tested this example it dosen't work, but after many trials I realized that there must be User-Agent in the header to get the binary of the file, "Authorization: Bearer EAAJ...", "Accept: image/*", "User-Agent: node"

The example must be corrected to: curl \ 'URL' \ -H 'Authorization: Bearer ACCESS_TOKEN' \ -H 'User-Agent: Node' \

media_file

3- https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/payload-examples#status--message-delivered Below example provided (Supposed to be for delivered message payload) but the status is sent it must be delivered { "object": "whatsapp_business_account", "entry": [ { "id": "<WHATSAPP_BUSINESS_ACCOUNT_ID>", "changes": [ { "value": { "messaging_product": "whatsapp", "metadata": { "display_phone_number": "<BUSINESS_DISPLAY_PHONE_NUMBER>", "phone_number_id": "<BUSINESS_PHONE_NUMBER_ID>" }, "statuses": [ { "id": "<WHATSAPP_MESSAGE_ID>", "status": "sent", //this must be delivered "timestamp": "<WEBHOOK_SENT_TIMESTAMP>", "recipient_id": "<WHATSAPP_USER_ID>", "conversation": { "id": "<CONVERSATION_ID>", "origin": { "type": "<CONVERSATION_CATEGORY>" } }, "pricing": { "billable": <IS_BILLABLE?>, "pricing_model": "CBP", "category": "<CONVERSATION_CATEGORY>" } } ] }, "field": "messages" } ] } ] }

Akam
Asked about 4 months ago