This is PHP library for mywaapi
Install with composer
composer require yama/mywaapi-php-lib
<?php
require_once __DIR__ . "/vendor/autoload.php";
use Yama\MywaapiPhpLib\Mywaapi;
$wa = new Mywaapi("http://localhost:8000/");
for send message to contact
echo $wa->sendMessage('6281292267204', 'example message');
Parameter | Type | Description |
---|---|---|
number |
string |
Required. 6281292267204 |
message |
string |
Required. example message |
for information of connection
echo $wa->info();
for check the number is registered or not
echo $wa->isRegistered("6281292267204");
Parameter | Type | Description |
---|---|---|
number |
string |
Required. 6281292267204 |
for set the webhook/callback
echo $wa->setWebhook("https://webhook.site/365b1f55-5334-48e0-8380-91443516515b");
Parameter | Type | Description |
---|---|---|
url |
string |
Required. webhook url |
for get the webhook/callback
echo $wa->getWebhook();
for send media to contact or group
echo $wa->sendMedia('6281292267204', 'example media caption', "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/479px-WhatsApp.svg.png");
Parameter | Type | Description |
---|---|---|
numberOrGroupId |
string |
Required. 6281292267204 (you can use a number or group id) |
caption |
string |
example media caption (you can fill with empty string) |
file |
string |
Required. (you can fill it with base64 url data) |
for send message to group
echo $wa->sendGroupMessage('[email protected]', 'example group message');
Parameter | Type | Description |
---|---|---|
id |
string |
Required. [email protected] |
message |
string |
Required. example group message |
for clear all message in the chat
echo $wa->clearMessage('6281292267204');
Parameter | Type | Description |
---|---|---|
numberOrGroupId |
string |
Required. 6281292267204 (you can use a number or group id) |
for delete chat
echo $wa->deleteChat('6281292267204');
Parameter | Type | Description |
---|---|---|
numberOrGroupId |
string |
Required. 6281292267204 (you can use a number or group id) |