The REST API allows you to receive and send messages through your WhatsApp account. Parameters in GET queries pass query string. Parameters in POST requests — through the JSON-encoded request body. The authorization token is always passed to query string (?token=xxxxxx). The WhatsApp API is based on the WhatsApp WEB protocol and excludes the ban both when using libraries from mgp25 and the like. Despite this, your account can be banned by anti-spam system WhatsApp after several clicking the "block" button.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
This package modify by drdim (fix bugs)
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/drdim/chat-api-com.git"
}
],
"require": {
"drdim/chat-api-com": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/path/to/chat-api-com/vendor/autoload.php');
To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: token
$config = ChatApiCom\Client\Configuration::getDefaultConfiguration()
->setApiKey('token', 'YOUR_API_KEY') // from LK
->setInstanceId('YOUR_INSTANCE_ID'); // from LK
$apiInstance = new ChatApiCom\Client\Api\BanApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \ChatApiCom\Client\Model\BanTestAction(); // \ChatApiCom\Client\Model\BanTestAction |
$phone = "phone_example"; // string |
try {
$result = $apiInstance->banTest($body$phone);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BanApi->banTest: ', $e->getMessage(), PHP_EOL;
}
?>
All URIs are relative to {protocol}://api.chat-api.com/instance{instanceId}
Class | Method | HTTP request | Description |
---|---|---|---|
BanApi | banTest | POST /banTest | Test ban settings |
BanApi | getBanSettings | GET /banSettings | Get settings |
BanApi | setBanSettings | POST /banSettings | Set settings |
ChatsApi | addGroupParticipant | POST /addGroupParticipant | Adding a participant to a group |
ChatsApi | creatGroup | POST /group | Creates a group and sends the message to the created group. |
ChatsApi | getChats | GET /dialogs | Get the chat list. |
ChatsApi | readChat | POST /readChat | Open chat for reading messages |
InstanceApi | getQRCode | GET /qr_code | Direct link to QR-code in the form of an image, not base64. |
InstanceApi | getSettings | GET /settings | Get settings |
InstanceApi | getStatus | GET /status | Get the account status and QR code for authorization. |
InstanceApi | logout | POST /logout | Logout from WhatsApp Web to get new QR code. |
InstanceApi | reboot | POST /reboot | Logout from WhatsApp Web to get new QR code. |
InstanceApi | setSettings | POST /settings | Set settings |
MessagesApi | forwardMessage | POST /forwardMessage | Forwarding messages to a new or existing chat. |
MessagesApi | getMessages | GET /messages | Get a list of messages. |
MessagesApi | sendContact | POST /sendContact | Sending a contact or contact list to a new or existing chat. |
MessagesApi | sendFile | POST /sendFile | Send a file to a new or existing chat. |
MessagesApi | sendLink | POST /sendLink | Send text with link and link's preview to a new or existing chat. |
MessagesApi | sendLocation | POST /sendLocation | Sending a location to a new or existing chat. |
MessagesApi | sendMessage | POST /sendMessage | Send a message to a new or existing chat. |
MessagesApi | sendPTT | POST /sendPTT | Send a ptt-audio to a new or existing chat. |
MessagesApi | setWebhook | POST /webhook | Sets the URL for receiving webhook notifications of new messages and message delivery events (ack). |
MessagesQueueApi | clearMessagesQueue | POST /clearMessagesQueue | clearMessagesQueue |
MessagesQueueApi | showMessagesQueue | GET /showMessagesQueue | Get outbound messages queue. |
- AddGroupParticipantAction
- AddGroupParticipantStatus
- Ask
- BanSettings
- BanTestAction
- BanTestStatus
- Chat
- ChatIdProp
- ChatUpdate
- Chats
- ClearMessagesQueueStatus
- CreateGroupAction
- CreateGroupStatus
- ForwardMessageRequest
- InlineResponse200
- InlineResponse2001
- InlineResponse401
- InstanceStatus
- Message
- Messages
- OutboundMessage
- OutboundMessages
- PhoneProp
- ReadChatAction
- ReadChatStatus
- SendContactRequest
- SendFileRequest
- SendLinkRequest
- SendLocationRequest
- SendMessageRequest
- SendMessageStatus
- SendPTTRequest
- SetWebhookStatus
- Settings
- WebhookUrl
- Type: API key
- API key parameter name: token
- Location: URL query string