lucassmacedo/whatsapp-chat-api

The SDK allows you to receive and send messages through your WhatsApp account. [Sign up now](https://app.chat-api.com/) The Chat 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 sy

dev-master 2020-06-02 19:19 UTC

This package is auto-updated.

Last update: 2024-03-29 04:12:32 UTC


README

The SDK allows you to receive and send messages through your WhatsApp account. Sign up now

The Chat 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 OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/lucassmacedo/whatsapp-chat-api.git"
    }
  ],
  "require": {
    "lucassmacedo/whatsapp-chat-api": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/OpenAPIClient-php/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: instanceId
$config = WhatsAppChatApi\Configuration::getDefaultConfiguration()->setApiKey('instanceId', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WhatsAppChatApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('instanceId', 'Bearer');

// Configure API key authorization: token
$config = WhatsAppChatApi\Configuration::getDefaultConfiguration()->setApiKey('token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WhatsAppChatApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer');


$apiInstance = new WhatsAppChatApi\Api\Class1InstanceApi(
    // 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
);

try {
    $result = $apiInstance->expiry();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling Class1InstanceApi->expiry: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://api.chat-api.com

Class Method HTTP request Description
Class1InstanceApi expiry POST /expiry Updates the QR code after its expired
Class1InstanceApi getQRCode GET /qr_code Direct link to QR-code in the form of an image, not base64.
Class1InstanceApi getSettings GET /settings Get settings
Class1InstanceApi getStatus GET /status Get the account status and QR code for authorization.
Class1InstanceApi logout POST /logout Logout from WhatsApp Web to get new QR code.
Class1InstanceApi reboot POST /reboot Reboot your whatsapp instance.
Class1InstanceApi retry POST /retry Repeat the manual synchronization attempt with the device
Class1InstanceApi setSettings POST /settings Set settings
Class1InstanceApi takeover POST /takeover Returns the active session if the device has connected another instance of Web WhatsApp
Class2MessagesApi forwardMessage POST /forwardMessage Forwarding messages to a new or existing chat.
Class2MessagesApi getMessages GET /messages Get a list of messages.
Class2MessagesApi sendContact POST /sendContact Sending a contact or contact list to a new or existing chat.
Class2MessagesApi sendFile POST /sendFile Send a file to a new or existing chat.
Class2MessagesApi sendLink POST /sendLink Send text with link and link's preview to a new or existing chat.
Class2MessagesApi sendLocation POST /sendLocation Sending a location to a new or existing chat.
Class2MessagesApi sendMessage POST /sendMessage Send a message to a new or existing chat.
Class2MessagesApi sendPTT POST /sendPTT Send a ptt-audio to a new or existing chat.
Class2MessagesApi sendVCard POST /sendVCard Sending a vcard to a new or existing chat.
Class3ChatsApi addGroupParticipant POST /addGroupParticipant Adding participant to a group
Class3ChatsApi demoteGroupParticipant POST /demoteGroupParticipant Demote group participant
Class3ChatsApi getChats GET /dialogs Get the chat list.
Class3ChatsApi group POST /group Creates a group and sends the message to the created group.
Class3ChatsApi promoteGroupParticipant POST /promoteGroupParticipant Make participant in the group an administrator
Class3ChatsApi readChat POST /readChat Open chat for reading messages
Class3ChatsApi removeGroupParticipant POST /removeGroupParticipant Remove participant from a group
Class4WebhooksApi setWebhook POST /webhook Sets the URL for receiving webhook
Class5QueuesApi clearActionsQueue POST /clearActionsQueue Clear outbound actions queue.
Class5QueuesApi clearMessagesQueue POST /clearMessagesQueue Clear outbound messages queue.
Class5QueuesApi showActionsQueue GET /showActionsQueue Get outbound messages queue.
Class5QueuesApi showMessagesQueue GET /showMessagesQueue Get outbound messages queue.
Class6BanApi banTest POST /banTest Test ban settings
Class6BanApi getBanSettings GET /banSettings Get settings
Class6BanApi setBanSettings POST /banSettings Set settings
Class7TestingApi instanceStatuses GET /instanceStatuses Returns instance status changes history.
Class7TestingApi webhookStatuses GET /webhookStatus Returns webhook status for message.

Documentation For Models

Documentation For Authorization

instanceId

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

token

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

Author

sale@chat-api.com