Skip to content

drdim/chat-api-com

Repository files navigation

Chat Api Com

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)

Requirements

PHP 5.5 and later

Installation & Usage

Composer

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

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/chat-api-com/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

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;
}
?>

Documentation for API Endpoints

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.

Documentation For Models

Documentation For Authorization

token

  • Type: API key
  • API key parameter name: token
  • Location: URL query string

Author

About

Chat-api-com php library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages