Hello
I am using this Github Brevo Library to send transactional emails and SMS. I would now like to use the WhatsApp feature.
I have gone through the WhatsApp setup process and am able to send messages successfully, but I am having trouble populating the parameters set out in my template.
I have created a parameter in my template: {{unitNumber}}
I run the following code which populates the number into an object with property « unitNumber »,
$params = new stdClass();
$params->unitNumber = '357001';
try {
$sendWhatsappMessage["templateId"] = 8;
$sendWhatsappMessage["senderNumber"] = "447870219640";
$sendWhatsappMessage["contactNumbers"] = ["447843915605"];
$sendWhatsappMessage["params"] = $params;
$result = $wapInstance->sendWhatsappMessage($sendWhatsappMessage);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TransactionalWhatsAppApi->sendWhatsappMessage: ', $e->getMessage(), PHP_EOL;
}
However when I send it, the message just shows the template field « {{unitNumber}} ».
What am I doing wrong? I have tried several ways of adding the parameters, including defining it as an array etc array(« unitNumber » => « 357001 »); but it makes so difference…