fix(wa): enviar solo el token como parámetro del botón URL, no la URL completa

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-03 11:11:54 -05:00
co-authored by Claude Sonnet 4.6
parent b47f6019cd
commit 538af86407
2 changed files with 8 additions and 10 deletions
+1 -3
View File
@@ -216,14 +216,12 @@ if (isset($_GET['test_cel'])) {
$rawComps = [ $rawComps = [
['type' => 'body', 'parameters' => [['type' => 'text', 'text' => 'A001']]] ['type' => 'body', 'parameters' => [['type' => 'text', 'text' => 'A001']]]
]; ];
if ($testLink) {
$rawComps[] = [ $rawComps[] = [
'type' => 'button', 'type' => 'button',
'sub_type' => 'url', 'sub_type' => 'url',
'index' => '0', 'index' => '0',
'parameters' => [['type' => 'text', 'text' => $testLink]], 'parameters' => [['type' => 'text', 'text' => 'TEST123']],
]; ];
}
$wa->sendTemplateMessage($testCel, $testTpl, $testLang, [], [], $rawComps); $wa->sendTemplateMessage($testCel, $testTpl, $testLang, [], [], $rawComps);
echo "✅ Mensaje enviado a {$testCel}\n"; echo "✅ Mensaje enviado a {$testCel}\n";
} catch (\Throwable $e) { } catch (\Throwable $e) {
+2 -2
View File
@@ -185,12 +185,12 @@ try {
$rawComps = [ $rawComps = [
['type' => 'body', 'parameters' => [['type' => 'text', 'text' => $codigo]]] ['type' => 'body', 'parameters' => [['type' => 'text', 'text' => $codigo]]]
]; ];
if ($enlaceConsentimiento) { if ($conToken) {
$rawComps[] = [ $rawComps[] = [
'type' => 'button', 'type' => 'button',
'sub_type' => 'url', 'sub_type' => 'url',
'index' => '0', 'index' => '0',
'parameters' => [['type' => 'text', 'text' => $enlaceConsentimiento]], 'parameters' => [['type' => 'text', 'text' => $conToken]],
]; ];
} }
$wa->sendTemplateMessage($cel, $waTemplate, $waLang, [], [], $rawComps); $wa->sendTemplateMessage($cel, $waTemplate, $waLang, [], [], $rawComps);