Skip to content

Commit 5d465d9

Browse files
authored
Merge branch 'master' into SW-5093
2 parents 7e97152 + 8c135b6 commit 5d465d9

7 files changed

Lines changed: 47 additions & 79 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ This method will be called when an incoming message is received. Next, process m
136136
| `account.reboot` | The method is designed to restart the account | [Reboot](https://green-api.com/en/docs/api/account/Reboot/) |
137137
| `account.logout` | The method is designed to unlogin the account | [Logout](https://green-api.com/en/docs/api/account/Logout/) |
138138
| `account.qr` | The method is designed to get a QR code | [QR](https://green-api.com/en/docs/api/account/QR/) |
139+
| `account.getAuthorizationCode` | The method is designed to authorize an instance by phone number | [GetAuthorizationCode](https://green-api.com/en/docs/api/account/GetAuthorizationCode/) |
139140
| `account.setProfilePicture` | The method is designed to set the avatar of the account | [SetProfilePicture](https://green-api.com/en/docs/api/account/SetProfilePicture/) |
140-
| `device.getDeviceInfo` | The method is designed to get information about the device (phone) on which the WhatsApp Business application is running | [GetDeviceInfo](https://green-api.com/en/docs/api/phone/GetDeviceInfo/) |
141141
| `groups.createGroup` | The method is designed to create a group chat | [CreateGroup](https://green-api.com/en/docs/api/groups/CreateGroup/) |
142142
| `groups.updateGroupName` | The method changes the name of the group chat | [UpdateGroupName](https://green-api.com/en/docs/api/groups/UpdateGroupName/) |
143143
| `groups.getGroupData` | The method gets group chat data | [GetGroupData](https://green-api.com/en/docs/api/groups/GetGroupData/) |
@@ -175,8 +175,8 @@ This method will be called when an incoming message is received. Next, process m
175175
| `serviceMethods.archiveChat` | The method archives the chat | [ArchiveChat](https://green-api.com/en/docs/api/service/archiveChat/) |
176176
| `serviceMethods.unarchiveChat` | The method unarchives the chat | [UnarchiveChat](https://green-api.com/en/docs/api/service/unarchiveChat/) |
177177
| `serviceMethods.setDisappearingChat` | The method is designed to change the settings of disappearing messages in chats | [SetDisappearingChat](https://green-api.com/en/docs/api/service/SetDisappearingChat/) |
178-
| `webhooks.startReceivingNotifications` | The method is designed to start receiving new notifications | |
179-
| `webhooks.stopReceivingNotifications` | The method is designed to stop receiving new notifications | |
178+
| `webhooks.startReceivingNotifications` | The method is designed to start receiving new notifications | |
179+
| `webhooks.stopReceivingNotifications` | The method is designed to stop receiving new notifications | |
180180

181181
## Service methods documentation
182182

README_RUS.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ body | тело сообщения (json)
135135
| `account.logout` | Метод предназначен для разлогинивания аккаунта | [Logout](https://green-api.com/docs/api/account/Logout/) |
136136
| `account.qr` | Метод предназначен для получения QR-кода | [QR](https://green-api.com/docs/api/account/QR/) |
137137
| `account.setProfilePicture` | Метод предназначен для установки аватара аккаунта | [SetProfilePicture](https://green-api.com/docs/api/account/SetProfilePicture/) |
138-
| `device.getDeviceInfo` | Метод предназначен для получения информации об устройстве (телефоне), на котором запущено приложение WhatsApp Business | [GetDeviceInfo](https://green-api.com/docs/api/phone/GetDeviceInfo/) |
138+
| `account.getAuthorizationCode` | Метод предназначен для авторизации инстанса по номеру телефона | [GetAuthorizationCode](https://green-api.com/docs/api/account/GetAuthorizationCode/) |
139139
| `groups.createGroup` | Метод предназначен для создания группового чата | [CreateGroup](https://green-api.com/docs/api/groups/CreateGroup/) |
140140
| `groups.updateGroupName` | Метод изменяет наименование группового чата | [UpdateGroupName](https://green-api.com/docs/api/groups/UpdateGroupName/) |
141141
| `groups.getGroupData` | Метод получает данные группового чата | [GetGroupData](https://green-api.com/docs/api/groups/GetGroupData/) |
@@ -168,19 +168,19 @@ body | тело сообщения (json)
168168
| `serviceMethods.getAvatar` | Метод возвращает аватар корреспондента или группового чата | [GetAvatar](https://green-api.com/docs/api/service/GetAvatar/) |
169169
| `serviceMethods.getContacts` | Метод предназначен для получения списка контактов текущего аккаунта | [GetContacts](https://green-api.com/docs/api/service/GetContacts/) |
170170
| `serviceMethods.getContactInfo` | Метод предназначен для получения информации о контакте | [GetContactInfo](https://green-api.com/docs/api/service/GetContactInfo/) |
171-
| `serviceMethods.editMessage` | Метод редактирует сообщение в чате | [EditMessage](https://green-api.com/docs/api/service/editMessage/) |
171+
| `serviceMethods.editMessage` | Метод редактирует сообщение в чате | [EditMessage](https://green-api.com/docs/api/service/editMessage/) |
172172
| `serviceMethods.deleteMessage` | Метод удаляет сообщение из чата | [DeleteMessage](https://green-api.com/docs/api/service/deleteMessage/) |
173173
| `serviceMethods.archiveChat` | Метод архивирует чат | [ArchiveChat](https://green-api.com/docs/api/service/archiveChat/) |
174174
| `serviceMethods.unarchiveChat` | Метод разархивирует чат | [UnarchiveChat](https://green-api.com/docs/api/service/unarchiveChat/) |
175175
| `serviceMethods.setDisappearingChat` | Метод предназначен для изменения настроек исчезающих сообщений в чатах | [SetDisappearingChat](https://green-api.com/docs/api/service/SetDisappearingChat/) |
176176
| `webhooks.startReceivingNotifications` | Метод предназначен для старта получения новых уведомлений | |
177177
| `webhooks.stopReceivingNotifications` | Метод предназначен для остановки получения новых уведомлений | |
178-
| `statuses.sendTextStatus` | Метод предназначен для отправки текстового статуса | [SendTextStatus](https://green-api.com/docs/api/statuses/SendTextStatus/) |
179-
| `statuses.sendVoiceStatus` | Метод предназначен для отправки голосового статуса | [SendVoiceStatus](https://green-api.com/docs/api/statuses/SendVoiceStatus/) |
180-
| `statuses.sendMediaStatus` | Метод предназначен для отправки медиа-файлов | [SendMediaStatus](https://green-api.com/docs/api/statuses/SendMediaStatus/) |
181-
| `statuses.getIncomingStatuses` | Метод возвращает крайние входящие статусы аккаунта | [GetIncomingStatuses](https://green-api.com/docs/api/statuses/GetIncomingStatuses/) |
182-
| `statuses.getOutgoingStatuses` | Метод возвращает крайние отправленные статусы аккаунта | [GetOutgoingStatuses](https://green-api.com/docs/api/statuses/GetOutgoingStatuses/) |
183-
| `statuses.getStatusStatistic` | Метод возвращает массив получателей со статусами, отмеченных как отправлено/доставлено/прочитано, для данного статуса | [GetStatusStatistic](https://green-api.com/docs/api/statuses/GetStatusStatistic/) |
178+
| `statuses.sendTextStatus` | Метод предназначен для отправки текстового статуса | [SendTextStatus](https://green-api.com/docs/api/statuses/SendTextStatus/) |
179+
| `statuses.sendVoiceStatus` | Метод предназначен для отправки голосового статуса | [SendVoiceStatus](https://green-api.com/docs/api/statuses/SendVoiceStatus/) |
180+
| `statuses.sendMediaStatus` | Метод предназначен для отправки медиа-файлов | [SendMediaStatus](https://green-api.com/docs/api/statuses/SendMediaStatus/) |
181+
| `statuses.getIncomingStatuses` | Метод возвращает крайние входящие статусы аккаунта | [GetIncomingStatuses](https://green-api.com/docs/api/statuses/GetIncomingStatuses/) |
182+
| `statuses.getOutgoingStatuses` | Метод возвращает крайние отправленные статусы аккаунта | [GetOutgoingStatuses](https://green-api.com/docs/api/statuses/GetOutgoingStatuses/) |
183+
| `statuses.getStatusStatistic` | Метод возвращает массив получателей со статусами, отмеченных как отправлено/доставлено/прочитано, для данного статуса | [GetStatusStatistic](https://green-api.com/docs/api/statuses/GetStatusStatistic/) |
184184

185185
## Документация по методам сервиса
186186

examples/receiveNotification.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
$greenApi->webhooks->startReceivingNotifications(function($typeWebhook, $body) {
1313
if ($typeWebhook == 'incomingMessageReceived') {
1414
onIncomingMessageReceived($body);
15-
} elseif ($typeWebhook == 'deviceInfo') {
16-
onDeviceInfo($body);
1715
} elseif ($typeWebhook == 'incomingCall') {
1816
onIncomingCall($body);
1917
} elseif ($typeWebhook == 'outgoingAPIMessageReceived') {
@@ -52,12 +50,6 @@ function onOutgoingAPIMessageReceived($body) {
5250
print($idMessage . ': At ' . $eventDate . ' Incoming from '. json_encode($senderData, JSON_UNESCAPED_UNICODE) . ' message = ' . json_encode($messageData, JSON_UNESCAPED_UNICODE)).PHP_EOL;
5351
}
5452

55-
function onDeviceInfo( $body ) {
56-
$eventDate = date('Y-m-d H:i:s', $body->timestamp);
57-
$deviceData = $body->deviceData;
58-
print('At ' . $eventDate . ': ' . json_encode($deviceData, JSON_UNESCAPED_UNICODE)).PHP_EOL;
59-
}
60-
6153
function onOutgoingMessageReceived($body) {
6254
$idMessage = $body->idMessage;
6355
$eventDate = date('Y-m-d H:i:s', $body->timestamp);

src/GreenApiClient.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
namespace GreenApi\RestApi;
1111

1212
use GreenApi\RestApi\tools\Account;
13-
use GreenApi\RestApi\tools\Device;
1413
use GreenApi\RestApi\tools\Groups;
1514
use GreenApi\RestApi\tools\Journals;
1615
use GreenApi\RestApi\tools\Marking;
@@ -32,10 +31,6 @@ class GreenApiClient {
3231
* @var Account
3332
*/
3433
public $account;
35-
/**
36-
* @var Device
37-
*/
38-
public $device;
3934
/**
4035
* @var Sending
4136
*/
@@ -81,7 +76,6 @@ public function __construct( $idInstance, $apiTokenInstance, $host = "https://ap
8176
$this->media = $media;
8277

8378
$this->account = new Account( $this );
84-
$this->device = new Device( $this );
8579
$this->groups = new Groups( $this );
8680
$this->journals = new Journals( $this );
8781
$this->marking = new Marking( $this );
@@ -150,7 +144,10 @@ public function request( string $method, string $url, array $payload = null, boo
150144
break;
151145
case 'POST_BINARY':
152146
$mime_type = mime_content_type( $path );
153-
$headers = array( 'Content-Type: ' . $mime_type );
147+
$headers = array(
148+
'Content-Type: ' . $mime_type ,
149+
'GA-Filename: ' . basename($path)
150+
);
154151
$filesize = filesize($path);
155152
$stream = fopen($path, 'r');
156153
curl_setopt( $curl, CURLOPT_PUT, true );

0 commit comments

Comments
 (0)