The V2 of WhatsAPI Go
PHP 7.4 and later. Should also work with PHP 8.0.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/WhatsAPI/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
$config = WhatsAPI\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = WhatsAPI\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new WhatsAPI\Api\BusinessManagementApi(
// 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
);
$instance_key = 'instance_key_example'; // string | Instance key
try {
$result = $apiInstance->fetchCatlog($instance_key);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BusinessManagementApi->fetchCatlog: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to /api
Class | Method | HTTP request | Description |
---|---|---|---|
BusinessManagementApi | fetchCatlog | GET /instances/{instance_key}/business/catalog | Fetches the catlog. |
BusinessManagementApi | sendPaymentRequest | POST /instances/{instance_key}/business/payment-request | Send a payment request. |
GroupManagementApi | addParticipant | POST /instances/{instance_key}/groups/{group_id}/participants/add | Add participant. |
GroupManagementApi | createGroup | POST /instances/{instance_key}/groups/create | Create group. |
GroupManagementApi | demoteParticipant | PUT /instances/{instance_key}/groups/{group_id}/participants/demote | Demote participant. |
GroupManagementApi | getAdminGroups | GET /instances/{instance_key}/groups/admin | Get admin groups. |
GroupManagementApi | getAllGroups | GET /instances/{instance_key}/groups/ | Get all groups. |
GroupManagementApi | getAllParticipants | GET /instances/{instance_key}/groups/{group_id}/participants | Get all participants. |
GroupManagementApi | getGroup | GET /instances/{instance_key}/groups/{group_id} | Get group. |
GroupManagementApi | getGroupFromInviteLink | GET /instances/{instance_key}/groups/invite-info | Get group from invite link. |
GroupManagementApi | getGroupInviteCode | GET /instances/{instance_key}/groups/{group_id}/invite-code | Get group invite code. |
GroupManagementApi | joinGroupWithLink | GET /instances/{instance_key}/groups/join | Join group with invite code. |
GroupManagementApi | leaveGroup | DELETE /instances/{instance_key}/groups/{group_id}/ | Leaves the group. |
GroupManagementApi | promoteParticipant | PUT /instances/{instance_key}/groups/{group_id}/participants/promote | Promote participant. |
GroupManagementApi | removeParticipant | DELETE /instances/{instance_key}/groups/{group_id}/participants/remove | Remove participant. |
GroupManagementApi | setGroupAnnounce | PUT /instances/{instance_key}/groups/{group_id}/announce | Set group announce. |
GroupManagementApi | setGroupDescription | PUT /instances/{instance_key}/groups/{group_id}/description | Set group description. |
GroupManagementApi | setGroupLocked | PUT /instances/{instance_key}/groups/{group_id}/lock | Set group locked. |
GroupManagementApi | setGroupName | PUT /instances/{instance_key}/groups/{group_id}/name | Set group name. |
GroupManagementApi | setGroupPicture | PUT /instances/{instance_key}/groups/{group_id}/profile-pic | Set group picture. |
InstanceApi | changeWebhookUrl | PUT /instances/{instance_key}/webhook | Change Webhook url. |
InstanceApi | createInstance | POST /instances/create | Creates a new instance key. |
InstanceApi | deleteInstance | DELETE /instances/{instance_key}/delete | Delete Instance. |
InstanceApi | getContacts | GET /instances/{instance_key}/contacts | Get contacts. |
InstanceApi | getInstance | GET /instances/{instance_key}/ | Get Instance. |
InstanceApi | getQrCode | GET /instances/{instance_key}/qrcode | Get QrCode. |
InstanceApi | listInstances | GET /instances/list | Get all instances. |
InstanceApi | logoutInstance | DELETE /instances/{instance_key}/logout | Logout Instance. |
MessageSendingApi | sendAudio | POST /instances/{instance_key}/send/audio | Send raw audio. |
MessageSendingApi | sendButtonMessage | POST /instances/{instance_key}/send/buttons | Send a button message. |
MessageSendingApi | sendButtonWithMedia | POST /instances/{instance_key}/send/button-media | Send a button message with a media header. |
MessageSendingApi | sendContact | POST /instances/{instance_key}/send/contact | Send a contact message. |
MessageSendingApi | sendDocument | POST /instances/{instance_key}/send/document | Send raw document. |
MessageSendingApi | sendGroupInvite | POST /instances/{instance_key}/send/group-invite | Send a group invite message |
MessageSendingApi | sendImage | POST /instances/{instance_key}/send/image | Send raw image. |
MessageSendingApi | sendListMessage | POST /instances/{instance_key}/send/list | Send a List message. |
MessageSendingApi | sendLocation | POST /instances/{instance_key}/send/location | Send a location message. |
MessageSendingApi | sendMediaMessage | POST /instances/{instance_key}/send/media | Send a media message. |
MessageSendingApi | sendPollMessage | POST /instances/{instance_key}/send/poll | Send a Poll message. |
MessageSendingApi | sendTemplate | POST /instances/{instance_key}/send/template | Send a template message. |
MessageSendingApi | sendTemplateWithMedia | POST /instances/{instance_key}/send/template-media | Send a template message with media. |
MessageSendingApi | sendTextMessage | POST /instances/{instance_key}/send/text | Send a text message. |
MessageSendingApi | sendVideo | POST /instances/{instance_key}/send/video | Send raw video. |
MessageSendingApi | uploadMedia | POST /instances/{instance_key}/send/upload | Upload media. |
MessageSendingApi | uploadMediaFromUrl | POST /instances/{instance_key}/send/upload-url | Upload media from url. |
MiscellaneousApi | downloadMedia | POST /instances/{instance_key}/misc/download | Download media |
MiscellaneousApi | getProfilePic | GET /instances/{instance_key}/misc/profile-pic | Get profile pic. |
MiscellaneousApi | getUsersInfo | POST /instances/{instance_key}/misc/user-info | Fetches the users info. |
MiscellaneousApi | setChatPresence | POST /instances/{instance_key}/misc/chat-presence | Set chat presence |
MiscellaneousApi | updateProfilePic | PUT /instances/{instance_key}/misc/profile-pic | Update profile picture |
- APIResponse
- ButtonMessagePayload
- ButtonMessageWithMediaPayload
- ContactMessagePayload
- ContactMessagePayloadVcard
- CreateInstancePayload
- FileUpload
- GroupCreatePayload
- GroupInviteMessagePayload
- GroupUpdateDescriptionPayload
- GroupUpdateNamePayload
- GroupUpdateParticipantsPayload
- ListItem
- ListMessagePayload
- ListSection
- LocationMessagePayload
- LocationMessagePayloadLocation
- PaymentRequestPayload
- PollMessagePayload
- ReplyButton
- SendAudioRequest
- SendDocumentRequest
- SendMediaPayload
- SendVideoRequest
- SetGroupPictureRequest
- TemplateButton
- TemplateButtonPayload
- TemplateButtonWithMediaPayload
- TextMessage
- UpdateProfilePicRequest
- UploadMediaRequest
- UrlMediaUploadPayload
- UserInfoPayload
- WebhookPayload
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
To run the tests, use:
composer install
vendor/bin/phpunit
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
2.0
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen