1. Go to this page and download the library: Download luannsr12/apiwpp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
luannsr12 / apiwpp example snippets
use Apiwpp\Config\Api;
Api::setConfigs('SEU_TOKEN_ADMIN', 'URL_DA_SUA_API');
Api::debug(true); // Ativa o modo debug (opcional)
use Apiwpp\Api\Evolution2\Device;
$response = Device::create('TOKEN_DA_INSTANCIA', 'NOME_DA_INSTANCIA');
print_r($response);
use Apiwpp\Api\Evolution2\Message;
Message::type('text');
Message::phone('551199999999');
Message::text('Olá, esta é uma mensagem de teste.');
if (Message::send()) {
echo 'Mensagem enviada com sucesso!';
} else {
echo 'Falha ao enviar mensagem.';
}
Message::type('image'); // audio, document, video
Message::phone('551199999999');
Message::file('https://link-da-imagem-ou-caminho-local.jpg');
Message::caption('Legenda da imagem'); // opcional
Message::send();
use Apiwpp\Api\Evolution2\Account;
if (Account::checkPhone('551199999999')) {
echo 'Número existe no WhatsApp.';
} else {
echo 'Número não encontrado.';
}
use Apiwpp\Api\Evolution2\Device;
Device::setWebhook('https://seusite.com.br/webhook');
use Apiwpp\Error\ExceptionError;
try {
// Código da SDK
} catch (Exception $e) {
echo ExceptionError::getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.