This guide explains how to create, update, get a list of, and delete QR Code Messages using the WhatsApp Business Management API.
Customers can scan a QR code from their phone to quickly begin a conversation with your business. The WhatsApp Business Management API allows you to create and access these QR codes and associated short links.
If you can use the Business Manager to manage your QR codes instead of the API, see Manage your WhatsApp QR Codes.
You will need:
whatsapp_business_messages
permissionTo create a QR code for a business, send a POST request to the WhatsApp Business Phone Number > Message Qrdls endpoint with the prefilled_message
parameter set to your message text and generate_qr_image
parameter set to your preferred image format, either SVG
or PNG
.
curl -X POST "https://graph.facebook.com/v16.0
/{phone-number-ID}/message_qrdls
?prefilled_message={message-text}
&generate_qr_image={image-format}
&access_token={user-access-token}"
On success, a JSON array is returned:
{ "code": "{qr-code-id}", "prefilled_message": "{business message text}", "deep_link_url": "{short-link-to-qr-code}", "qr_image_url": "{image-url}" }
To get a list of all the QR codes messages for a business, send a GET request to the WhatsApp Business Phone Number > Message Qrdls endpoint.
curl -X GET "https://graph.facebook.com/v16.0
/{phone-number-ID}/message_qrdls
&access_token={user-access-token}"
On success, a JSON array is returned:
{ "data": [ { "code": "ANOVZ6RINRD7G1", "prefilled_message": "I need help with my account.", "deep_link_url": "https://wa.me/message/ANOVZ6RINRD7G1" }, { "code": "TNGSHG326AIHH1", "prefilled_message": "What are your store hours?", "deep_link_url": "https://wa.me/message/TNGSHG326AIHH1" }, { "code": "R3LUI5KILJUYA1", "prefilled_message": "When is the next sale?", "deep_link_url": "https://wa.me/message/R3LUI5KILJUYA1" }, ] }
To get information about a specific QR code message, send a GET request to the WhatsApp Business Phone Number > Message Qrdls endpoint and append the QR code ID as a path parameter.
curl -X GET "https://graph.facebook.com/v16.0
/{phone-number-ID}/message_qrdls/{qr-code-id}
&access_token={user-access-token}"
On success, a JSON array is returned:
{ "data": [ { "code": "ANOVZ6RINRD7G1", "prefilled_message": "I need help with my account.", "deep_link_url": "https://wa.me/message/ANOVZ6RINRD7G1" } ] }
To update a QR code for a business, send a POST request to the WhatsApp Business Phone Number > Message Qrdls endpoint and append the QR code ID as a path parameter.
curl -X POST "https://graph.facebook.com/v16.0
/{phone-number-ID}/message_qrdls/{qr-code-id}
?prefilled_message={new-message-text}
&access_token={user-access-token}"
On success, a JSON array is returned:
{ "code": "{qr-code-id}", "prefilled_message": "{business message text}", "deep_link_url": "{short-link-to-qr-code}" }
QR codes do not expire. You must delete a QR code in order to retire it.
To delete a QR code, send a DELETE request to the WhatsApp Business Phone Number > Message Qrdls endpoint and append the ID of the QR code you wish to retire as a path parameter.
curl -X DELETE "https://graph.facebook.com/v16.0
/{phone-number-ID}/message_qrdls/{qr-code-id}
&access_token={user-access-token}"
On success, a JSON array is returned:
{ "success": true }