This guide explains how to create and manage QR codes 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, send a POST request to the WhatsApp Business Phone Number > Message Qrdls endpoint.
In your post body, include an object with a prefilled_message
property set to your message text and a generate_qr_image
property set to your preferred image format, either SVG
or PNG
.
curl 'https://graph.facebook.com/v21.0
/106540352242922/message_qrdls' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"prefilled_message": "Cyber Monday",
"generate_qr_image": "SVG"
}'
{ "code": "4O4YGZEG3RIVE1", "prefilled_message": "Cyber Monday 1", "deep_link_url": "https://wa.me/message/4O4YGZEG3RIVE1", "qr_image_url": "https://scontent-iad3-2.xx.fbcdn.net/..." }
To get a list of all QR codes on a business phone number, send a GET request to the WhatsApp Business Phone Number > Message Qrdls endpoint.
curl 'https://graph.facebook.com/v21.0
/106540352242922/message_qrdls' \
-H 'Authorization: Bearer EAAJB...'
{ "data": [ { "code": "4O4YGZEG3RIVE1", "prefilled_message": "Cyber Monday", "deep_link_url": "https://wa.me/message/4O4YGZEG3RIVE1" }, { "code": "WOMVT6TJ2BP7A1", "prefilled_message": "Tell me more about your production workshop", "deep_link_url": "https://wa.me/message/WOMVT6TJ2BP7A1" } ] }
To get information about a specific QR code, send a GET request to the WhatsApp Business Phone Number > Message Qrdls endpoint and append the QR code ID as a path parameter.
curl 'https://graph.facebook.com/v21.0
/106540352242922/message_qrdls/4O4YGZEG3RIVE1' \
-H 'Authorization: Bearer EAAJB...'
{ "data": [ { "code": "4O4YGZEG3RIVE1", "prefilled_message": "Cyber Monday", "deep_link_url": "https://wa.me/message/4O4YGZEG3RIVE1" } ] }
To update a QR code, send a POST request to the WhatsApp Business Phone Number > Message Qrdls endpoint.
In the post body, include a code
property set to the ID of the QR code you wish to update, and a prefilled_message
property set to the new QR code text.
curl 'https://graph.facebook.com/v21.0
/106540352242922/message_qrdls' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"code": "4O4YGZEG3RIVE1",
"prefilled_message": "Cyber Tuesday"
}'
{ "code": "4O4YGZEG3RIVE1", "prefilled_message": "Cyber Tuesday", "deep_link_url": "https://wa.me/message/4O4YGZEG3RIVE1" }
QR codes do not expire automatically. 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/v21.0
/106540352242922/message_qrdls/4O4YGZEG3RIVE1' \
-H 'Authorization: Bearer EAAJB...'
{ "success": true }