Based on this documentation: https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/#sending-templates, you can set TTL when sending an outbound message for the Authentication category. This option will works when your recipient does not receive your message after the specified time, the message will not delivered to your customer.
To implement this custom option, you can create the authentication template with this sample:
curl --location --globoff 'https://omnichannel.qiscus.com/whatsapp/v7.0/{AppCode}}/{{channel_id}}/message_templates' \
--header 'Qiscus-App-Id: {{AppCode}}' \
--header 'Qiscus-Secret-Key: {{SecretKey}}' \
--header 'Content-Type: application/json' \
--data '{
"name": "{{template_name}}",
"language": "{{template_language}}",
"category": "authentication",
"message_send_ttl_seconds": 60,
"components": [
{
"type": "body",
"add_security_recommendation": true
},
{
"type": "footer",
"code_expiration_minutes": 5
},
{
"type": "buttons",
"buttons": [
{
"type": "otp",
"otp_type": "copy_code",
"text": "Copy Code"
}
]
}
]
}'
response:
{
"id": "17791xxxxx22xx22",
"status": "APPROVED",
"category": "AUTHENTICATION"
}
Then you can send the approved authentication template using this sample:
curl --location --globoff 'https://omnichannel.qiscus.com/whatsapp/v1/{{AppCode}}/{{channel_id}}/messages' \
--header 'Qiscus-App-Id: {{AppCode}}' \
--header 'Qiscus-Secret-Key: {{SecretKey}}' \
--header 'Content-Type: application/json' \
--data '{
"to": "{{phone_number}}",
"type": "template",
"template": {
"namespace": "{{namespace}}",
"name": "{{template_name}}",
"language": {
"policy": "deterministic",
"code": "{{template_language}}"
},
"components": [
{
"type" : "body",
"parameters": [
{
"type": "text",
"text": "{{otp_number}}"
}
]
},
{
"type":"button",
"sub_type": "url",
"index": 0,
"parameters": [
{
"type": "text",
"text": "{{otp_number}}"
}
]
}
]
}
}'
You can try this implementation with this step:
- Please turn off the wifi/data on your recipient device.
- Sent the message with the curl above.
- Please wait until the message TTL has been reached, then turn on the wifi/data on the device again.
- The message should not be delivered to the recipient number.
Related to
Comments
0 comments
Article is closed for comments.