部分的な機能停止share-external
How to create a carousel template under the template section.
1

There is no option under the "marketing" category to create a carousel template.

Mukesh
質問日時: 約3ヶ月前
選択された回答
1

As of now you can create via API, there's no option in Whatsapp manager.

9月9日 5:13
Purusothaman
Purusothaman

https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/carousel-templates

9月9日 5:16
Mukesh

Will you please provide a working API for the same.

9月9日 5:18
Mukesh

Because, I have gone through above URL but not succeed.

9月9日 5:19
Mukesh

Will you please provide cURL for the same?

9月9日 5:22
Mukesh

Also let me know 'header_handle' and how to get this details?

9月9日 5:23
Purusothaman

POST your cURL, i will check

9月9日 5:23
Purusothaman

OK Got it, Follow these steps. 1. Use upload session like this https://graph.facebook.com/v20.0/{{APP_ID}}/uploads?file_name=8-Titanium Grey.png&file_length=97700&file_type=image/png 2. From the response use id to upload like this https://graph.facebook.com/v20.0/upload:{{id}} 3.From the response you will get header_handle

9月9日 5:33
Harshit

@Purushothaman...not able to create carousel template. Can you please help me out. PFB the details

Request: curl --request POST \ --url https://graph.facebook.com/v20.0/<WhatsApp_Business_Id>/message_templates \ --header 'Authorization: Bearer <auth_token>' \ --header 'Content-Type: application/json; charset=UTF-8' \ --header 'Cookie: ps_l=1; ps_n=1' \ --cookie 'ps_l=1; ps_n=1' \ --data '{ "name": "carousel_jobs", "language": "en_US", "category": "Utility", "allow_category_change": true, "components": [ { "type": "BODY", "text": "Here are some job opportunities for you:", "example": { "body_text": ["Here are some job opportunities for you:"] } }, { "type": "CAROUSEL", "cards": [ { "components": [ { "type": "BODY", "text": "{{1}} - {{2}} - {{3}} Per Month", "example": { "body_text": [ [ "", "", "" ] ] } }, { "type": "BUTTONS", "buttons": [ { "type": "URL", "text": "Apply Now", "url": "https://cply.me/{{1}}", "example": [ "" ] } ] } ] } ] } ] }'

Response: { "error": { "message": "Invalid parameter", "type": "OAuthException", "code": 100, "error_subcode": 2388043, "is_transient": false, "error_user_title": "Message template \"components\" param is missing expected field(s)", "error_user_msg": "component of type BODY is missing expected field(s) (example)", "fbtrace_id": "A-wm-OOCjaZsNYXkXmGGpfk" } }

9月9日 5:44
Mukesh

{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "91XXXXXXXXXX", "type": "template", "template": { "name": "carousel_template_media_cards_v11", "language": { "code": "en_US" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "Pablo" }, { "type": "text", "text": "20%" }, { "type": "text", "text": "20OFF" } ] }, { "type": "carousel", "cards": [ { "card_index": 0, "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "id": "1558081531584829" } } ] }, { "type": "button", "sub_type": "quick_reply", "index": "0", "parameters": [ { "type": "payload", "payload": "more-aloes" } ] }, { "type": "button", "sub_type": "url", "index": "1", "parameters": [ { "type": "text", "text": "blue-elf" } ] } ] }, { "card_index": 1, "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "id": "861236878885705" } } ] }, { "type": "button", "sub_type": "quick_reply", "index": "0", "parameters": [ { "type": "payload", "payload": "more-crassulas" } ] }, { "type": "button", "sub_type": "url", "index": "1", "parameters": [ { "type": "text", "text": "buddhas-temple" } ] } ] }, { "card_index": 2, "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "id": "1587064918516321" } } ] }, { "type": "button", "sub_type": "quick_reply", "index": "0", "parameters": [ { "type": "payload", "payload": "more-echeverias" } ] }, { "type": "button", "sub_type": "url", "index": "1", "parameters": [ { "type": "text", "text": "black-prince" } ] } ] } ] } ] } }

9月10日 1:36
Mukesh

I am using above code to create carousel (Image) template

9月10日 1:37
Mukesh
  1. Use upload session like this https://graph.facebook.com/v20.0/{{APP_ID}}/uploads?file_name=8-Titanium Grey.png&file_length=97700&file_type=image/png
  2. From the response, use the ID to upload like this https://graph.facebook.com/v20.0/upload:{{id}}
  3. From the response, you will get header_handle

As per suggested steps, I am able to perform step 1 and 2 but not getting desire details after performing step 3 and getting an error i.e.,

{"debug_info":{"retriable":false,"type":"NotAuthorizedError","message":"User not authorized to perform this request"}}

And I am using below URL as step 3 i.e.,

https://graph.facebook.com/v20.0/upload:MTphdHRhY2htZW50OjZiNzEzM2VjLTYwOTMtNDc2YS04MmFlLTNmNGE0Zjc1YTE5Nj9maWxlX25hbWU9UHJvZHVjdDEmZmlsZV9sZW5ndGg9OTc3MDAmZmlsZV90eXBlPWltYWdlJTJGanBn?sig=ARYS9qcR6BFOIXCQIsQ

9月10日 1:49
Mukesh

@Purusothaman help me to come out from this issue

9月10日 3:31
Purusothaman

Step 1,2,3 is used for getting template approval. If your carousel cards contains image then it must be done. For sending carousel - you have upload image and use the returned image id For ex : curl -X POST 'https://graph.facebook.com/v20.0/<PHONE_NUMBER_ID>/media' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -F 'file=@"2jC60Vdjn/cross-trainers-summer-sale.jpg"' \ -F 'type="image/jpeg"' \ -F 'messaging_product="whatsapp"'

From your JSON : don't use {{1}} like this in JSON, instead you should use parameters field

Reference : https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates/media-card-carousel-templates#post-body-parameters

9月10日 5:58