/**
* número de WhatsApp que receberá a mensagem.
* (obrigatório conter o código do país e o DDD).
*/
$phoneNumber = "+55 (18) 99999-9999";
// mensagem que será enviada.
$message = "Testando API! š";
try {
// envia a mensagem de texto.
print_r($whatsApp->sendText($phoneNumber, $message));
} catch (Exception $e) {
// Caso dê erro, retornará o motivo.
die("Error: " . $e->getMessage());
}
// caminho da imagem
$image = "cat.jpg";
// legenda da imagem (opcional)
$caption = "Legenda da imagem";
// envia a imagem
$whatsApp->sendImage(5518999999999, $image, $caption);
// titulo do arquivo (opcional)
$title = "Aplicação";
// envia o arquivo pdf
$whatsApp->sendPDF(5518999999999, "https://www.africau.edu/images/default/sample.pdf", $title);
$buttons = [
[
'id' => 'resposta_01',
'text' => 'Botão 1ļøā£'
],
[
'id' => 'resposta_02',
'text' => 'Botão 2ļøā£'
],
[
'id' => 'resposta_03',
'text' => 'Botão 3ļøā£'
]
];
// envia a mensagem com botões.
$whatsApp->sendButtonMessage(5518999999999, [
'title' => "Titulo da mensagem",
'text' => "Imagine um texto bem legal aqui.\n\nšš",
'footer' => "Aqui vai o texto do rodapé da mensagem"
], $buttons);
// cria o botão (id, texto)
$whatsApp->createButton('resposta_01', "Botão 1ļøā£");
$whatsApp->createButton('resposta_02', "Botão 2ļøā£");
$whatsApp->createButton('resposta_03', "Botão 3ļøā£");
// envia a mensagem com botões.
$whatsApp->sendButtonMessage(5518999999999, [
'title' => "Titulo da mensagem",
'text' => "Imagine um texto bem legal aqui.\n\nšš",
'footer' => "Aqui vai o texto do rodapé da mensagem"
]);
composer
// Exemplo:
// Exemplo:
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.