Please document urlVariables for dynamic WhatsApp template URLs
Status: Closed · Asked by f g b on · 0 views
It took me many hours to figure out how to pass a URL parameter to a template; this might help others.
When using a WhatsApp template with a dynamic URL button, the correct field is urlVariables, not urlParams.
urlParams may be accepted in the JSON payload, but it is silently ignored, so the message can still return success while the button URL keeps the Meta placeholder instead of the real value.
urlVariables works correctly, and urlVariables[0] replaces the first dynamic URL parameter.
For example, if the template button URL in Meta is:
https://example.com/hola_mundo.php?name=
and you send:
"urlVariables": ["juan"]
the final button URL becomes:
https://example.com/hola_mundo.php?name=juan
Working PHP sender example:
<?php $api_key = 'YOUR_PABBLY_API_KEY'; $to = '56912345678'; $payload = [ 'to' => $to, 'type' => 'template', 'templateName' => 'your_template_name', 'bodyParams' => ['Juan'], 'urlVariables' => ['juan'], ]; $json = json_encode($payload, JSON_UNESCAPED_UNICODE); $ch = curl_init('https://chatflow.pabbly.com/api/v1/messages'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $api_key, 'Content-Type: application/json', 'Accept: application/json', ]); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $curl_error = curl_error($ch); curl_close($ch); if ($curl_error) { echo "cURL error: " . $curl_error; } elseif ($http_code === 200) { $obj = json_decode($response); if (isset($obj->status) && $obj->status === 'success') { echo "Sent successfully"; } else { echo "Pabbly error: " . $response; } } else { echo "HTTP " . $http_code . ": " . $response; }
Receiver example (hola_mundo.php):
<?php $name = isset($_GET['name']) ? htmlspecialchars($_GET['name']) : ''; echo "<h1>hello $name</h1>";
If the parameter is passed correctly, the page shows:
texthello juan
If urlParams is used instead, the send may still look successful, but the dynamic URL value is not replaced.
This would be very helpful to document clearly, because the current behavior looks like a successful API send, while the button URL is actually wrong.
Hello there,
Thanks for contacting us.
Could you please specify which document you are referring to? Can you share the specific URL or the screenshot?
Thanks & Regards,
Adeel Akhtar
🌐 Pabbly.com
Here: https://apidocs.pabbly.com/pabbly/chatflow/guides/overview
We need a section: "how to send a message with button dynamic url"
Hello there,
Kindly check at this link - https://apidocs.pabbly.com/pabbly/chatflow/messages/send-cta-buttons-template
Thanks & Regards,
Adeel Akhtar
🌐 Pabbly.com