The WhatsApp coupon template messages are templates which contain a button to allow recipients to easily copy the coupon code to their clipboard. This kind of template message has the following limitations:
The following JSON code illustrates how to create a template with a text header, a body and two buttons: a quick reply and a copy code button. The values used as examples can be customised when sending the template messages. The following JSON must be the payload of a POST request to the Integrations API create templates endpoint.
{"name": "whatsapp_coupon_template","wabaId": "5661415107263419","category": "MARKETING","language": "en_US","components": [{"type": "HEADER","format": "TEXT","text": "BLACK FRIDAY is coming!"},{"type": "BODY","text": "Hello {{1}}, use our coupon {{2}} to get {{3}} off during the Black Friday 2024!","example": {"body_text": [["Robert","25OFF","25%"]]}},{"type": "BUTTONS","buttons": [{"type": "QUICK_REPLY","text": "Unsubscribe"},{"type": "COPY_CODE","example": ["250FF"]}]}]}
The template created in WhatsApp will look like the following:
The following JSON code illustrates how to send the WhatsApp coupon template created previously using the Conversations API send message endpoint.
{"type": "hsm","content": {"hsm": {"namespace": "c5437a4f_80d2_4019_a6fd_170cce7d7b76","templateName": "whatsapp_coupon_template","language": {"code": "en_US"},"components": [{"type": "body","parameters": [{"type": "text","text": "Robert"},{"type": "text","text": "BLACKFRIDAY"},{"type": "text","text": "30%"}]},{"type": "button","sub_type": "COPY_CODE","index": 1,"parameters": [{"type": "coupon_code","coupon_code": "BLACKFRIDAY"}]}]}},"to": "+1234567890","from": "b489e76b-c740-4c1c-97da-322390c426e0"}
The COPY_CODE button must contain a parameter to indicate the coupon code.
The following image shows how the coupon template message is displayed in WhatsApp: