fix(template): send parameter_name for named-variable templates
WhatsApp API returns "(#100) Invalid parameter — Parameter name is missing or empty" for templates that use named variables. - chat.php sendTemplate(): collect params as [{name, value}] objects using data-var-index as the parameter name - WhatsAppService::sendTemplateMessage(): handle {name, value} objects in the indexed-array path by emitting {type, parameter_name, text} (backward-compatible — plain strings still work as positional params) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a8380ddc81
commit
3d6147bf0d
@@ -181,6 +181,13 @@ class WhatsAppService
|
||||
$bpCopy = $bp;
|
||||
unset($bpCopy['name']);
|
||||
$normalizedBody[] = $bpCopy; // already detailed
|
||||
} elseif (is_array($bp) && isset($bp['name'], $bp['value'])) {
|
||||
// {name: 'param_name', value: 'text'} — include parameter_name for named-variable templates
|
||||
$normalizedBody[] = [
|
||||
'type' => 'text',
|
||||
'parameter_name' => (string)$bp['name'],
|
||||
'text' => (string)$bp['value'],
|
||||
];
|
||||
} elseif (is_string($bp) || is_numeric($bp)) {
|
||||
$normalizedBody[] = [
|
||||
'type' => 'text',
|
||||
|
||||
Reference in New Issue
Block a user