From 42d3daf44b867da87ffb5ec9a3df2e580a7456e7 Mon Sep 17 00:00:00 2001 From: Vadim Savilov Date: Wed, 8 Jul 2026 16:47:36 +0500 Subject: [PATCH 1/2] feat: sync SDK with API docs - add 9 new methods, update 5 existing New methods (+ async variants): - account.getStateInstanceHistory(count) - account.updateApiToken() - serviceMethods.getChats(count) - groups.updateGroupSettings(groupId, allowParticipantsEditGroupSettings, allowParticipantsSendMessages) - journals.lastIncomingCalls(minutes) - journals.lastOutgoingCalls(minutes) - queues.getMessagesCount() - queues.getWebhooksCount() - queues.clearWebhooksQueue() Updated signatures (backward compatible): - sending.sendMessage: add typePreview, customPreview - sending.forwardMessages: add typingTime - serviceMethods.checkWhatsapp: add chatId (preferred), force; phoneNumber -> Optional - serviceMethods.getContacts: add group, count - receiving.receiveNotification: add receiveTimeout Examples: add 8 new files, update 6 existing README/docs: add new methods and examples to both tables --- README.md | 23 ++++- docs/README.md | 21 ++++ examples/async/accountMethodsAsync.py | 7 +- examples/async/groupsMethodsAsync.py | 6 +- examples/async/lastCallsAsync.py | 19 ++++ examples/async/lastMessagesAsync.py | 4 +- examples/async/queuesMethodsAsync.py | 23 +++++ .../sending/sendMessageWithPreviewAsync.py | 40 ++++++++ examples/async/serviceMethodsAsync.py | 12 +++ examples/sync/accountMethods.py | 23 +++++ examples/sync/groupsMethods.py | 33 +++++++ examples/sync/lastCalls.py | 21 ++++ examples/sync/lastMessages.py | 10 +- examples/sync/queuesMethods.py | 23 +++++ .../sync/sending/sendMessageWithPreview.py | 40 ++++++++ examples/sync/serviceMethods.py | 34 ++++++- whatsapp_api_client_python/tools/account.py | 44 ++++++++- whatsapp_api_client_python/tools/groups.py | 37 ++++++- whatsapp_api_client_python/tools/journals.py | 54 ++++++++++ whatsapp_api_client_python/tools/queues.py | 60 +++++++++++- whatsapp_api_client_python/tools/receiving.py | 26 ++--- whatsapp_api_client_python/tools/sending.py | 11 ++- .../tools/serviceMethods.py | 98 ++++++++++++++++--- 23 files changed, 631 insertions(+), 38 deletions(-) create mode 100644 examples/async/lastCallsAsync.py create mode 100644 examples/async/queuesMethodsAsync.py create mode 100644 examples/async/sending/sendMessageWithPreviewAsync.py create mode 100644 examples/sync/accountMethods.py create mode 100644 examples/sync/groupsMethods.py create mode 100644 examples/sync/lastCalls.py create mode 100644 examples/sync/queuesMethods.py create mode 100644 examples/sync/sending/sendMessageWithPreview.py diff --git a/README.md b/README.md index 6abe99a..07d1602 100644 --- a/README.md +++ b/README.md @@ -298,6 +298,18 @@ asyncio.run(main()) | Example of sending interactive buttons asynchronously with a reply | [SendInteractiveButtonsReplyAsync.py](../examples/async/sending/sendInteractiveButtonsReplyAsync.py) | | Example of sending a notification about typing or recording audio | [SendTyping.py](../examples/sync/sendTyping.py) | | Example of sending a notification about typing or recording audio asynchronously | [SendTypingAsync.py](../examples/async/sendTypingAsync.py) | +| Example of account methods (state history, token update) | [accountMethods.py](./examples/sync/accountMethods.py) | +| Example of account methods asynchronously | [accountMethodsAsync.py](./examples/async/accountMethodsAsync.py) | +| Example of getting last incoming and outgoing calls | [lastCalls.py](./examples/sync/lastCalls.py) | +| Example of getting last calls asynchronously | [lastCallsAsync.py](./examples/async/lastCallsAsync.py) | +| Example of sending a message with link preview options | [sendMessageWithPreview.py](./examples/sync/sending/sendMessageWithPreview.py) | +| Example of sending a message with link preview options asynchronously | [sendMessageWithPreviewAsync.py](./examples/async/sending/sendMessageWithPreviewAsync.py) | +| Example of queues methods (counts, clear webhooks queue) | [queuesMethods.py](./examples/sync/queuesMethods.py) | +| Example of queues methods asynchronously | [queuesMethodsAsync.py](./examples/async/queuesMethodsAsync.py) | +| Example of groups methods (update settings) | [groupsMethods.py](./examples/sync/groupsMethods.py) | +| Example of groups methods asynchronously | [groupsMethodsAsync.py](./examples/async/groupsMethodsAsync.py) | +| Example of service methods (getChats, checkWhatsapp, getContacts) | [serviceMethods.py](./examples/sync/serviceMethods.py) | +| Example of service methods asynchronously | [serviceMethodsAsync.py](./examples/async/serviceMethodsAsync.py) | ## The full list of the library methods @@ -313,6 +325,8 @@ asyncio.run(main()) | `account.qr` | The method is designed to get a QR code | [QR](https://green-api.com/en/docs/api/account/QR/) | | `account.setProfilePicture` | The method is designed to set the avatar of the account | [SetProfilePicture](https://green-api.com/en/docs/api/account/SetProfilePicture/) | | `account.getAuthorizationCode` | The method is designed to authorize an instance by phone number | [GetAuthorizationCode](https://green-api.com/en/docs/api/account/GetAuthorizationCode/) | +| `account.getStateInstanceHistory` | The method returns the history of the instance state changes | [GetStateInstanceHistory](https://green-api.com/en/docs/api/account/GetStateInstanceHistory/) | +| `account.updateApiToken` | The method generates a new API token for the instance (beta) | [UpdateApiToken](https://green-api.com/en/docs/api/account/UpdateApiToken/) | | `contacts.addContact` | The method is used to add a number to contacts | [addContact](https://green-api.com/en/docs/api/contacts/AddContact/) | | `contacts.editContact` | The method is used to edit a number in contacts | [editContact](https://green-api.com/en/docs/api/contacts/EditContact/) | | `contacts.deleteContact` | The method is used to remove a number from contacts | [deleteContact](https://green-api.com/en/docs/api/contacts/DeleteContact/) | @@ -326,6 +340,7 @@ asyncio.run(main()) | `groups.removeAdmin` | The method deprives the participant of group chat administration rights | [RemoveAdmin](https://green-api.com/en/docs/api/groups/RemoveAdmin/) | | `groups.setGroupPicture` | The method sets the avatar of the group | [SetGroupPicture](https://green-api.com/en/docs/api/groups/SetGroupPicture/) | | `groups.leaveGroup` | The method logs the user of the current account out of the group chat | [LeaveGroup](https://green-api.com/en/docs/api/groups/LeaveGroup/) | +| `groups.updateGroupSettings` | The method changes the group settings (beta) | [UpdateGroupSettings](https://green-api.com/en/docs/api/groups/UpdateGroupSettings/) | | `statuses.sendTextStatus` | The method is aimed for sending a text status | [SendTextStatus](https://green-api.com/en/docs/api/statuses/SendTextStatus/) | | `statuses.sendVoiceStatus` | The method is aimed for sending a voice status | [SendVoiceStatus](https://green-api.com/en/docs/api/statuses/SendVoiceStatus/) | | `statuses.sendMediaStatus` | The method is aimed for sending a pictures or video status | [SendMediaStatus](https://green-api.com/en/docs/api/statuses/SendMediaStatus/) | @@ -337,8 +352,13 @@ asyncio.run(main()) | `journals.getMessage` | The method returns a chat message | [GetMessage](https://green-api.com/en/docs/api/journals/GetMessage/) | | `journals.lastIncomingMessages` | The method returns the most recent incoming messages of the account | [LastIncomingMessages](https://green-api.com/en/docs/api/journals/LastIncomingMessages/) | | `journals.lastOutgoingMessages` | The method returns the last sent messages of the account | [LastOutgoingMessages](https://green-api.com/en/docs/api/journals/LastOutgoingMessages/) | +| `journals.lastIncomingCalls` | The method returns the last incoming calls of the account (beta) | [LastIncomingCalls](https://green-api.com/en/docs/api/journals/LastIncomingCalls/) | +| `journals.lastOutgoingCalls` | The method returns the last outgoing calls of the account (beta) | [LastOutgoingCalls](https://green-api.com/en/docs/api/journals/LastOutgoingCalls/) | | `queues.showMessagesQueue` | The method is designed to get the list of messages that are in the queue to be sent | [ShowMessagesQueue](https://green-api.com/en/docs/api/queues/ShowMessagesQueue/) | | `queues.clearMessagesQueue` | The method is designed to clear the queue of messages to be sent | [ClearMessagesQueue](https://green-api.com/en/docs/api/queues/ClearMessagesQueue/) | +| `queues.getMessagesCount` | The method returns the number of messages in the outgoing queue | [GetMessagesCount](https://green-api.com/en/docs/api/queues/GetMessagesCount/) | +| `queues.getWebhooksCount` | The method returns the number of notifications in the incoming webhooks queue | [GetWebhooksCount](https://green-api.com/en/docs/api/queues/GetWebhooksCount/) | +| `queues.clearWebhooksQueue` | The method clears the incoming webhooks queue | [ClearWebhooksQueue](https://green-api.com/en/docs/api/queues/ClearWebhooksQueue/) | | `marking.readChat` | The method is designed to mark chat messages as read | [ReadChat](https://green-api.com/en/docs/api/marks/ReadChat/) | | `receiving.receiveNotification` | The method is designed to receive a single incoming notification from the notification queue | [ReceiveNotification](https://green-api.com/en/docs/api/receiving/technology-http-api/ReceiveNotification/) | | `receiving.deleteNotification` | The method is designed to remove an incoming notification from the notification queue | [DeleteNotification](https://green-api.com/en/docs/api/receiving/technology-http-api/DeleteNotification/) | @@ -362,7 +382,8 @@ asyncio.run(main()) | `serviceMethods.archiveChat` | The method archives the chat | [ArchiveChat](https://green-api.com/en/docs/api/service/archiveChat/) | | `serviceMethods.unarchiveChat` | The method unarchives the chat | [UnarchiveChat](https://green-api.com/en/docs/api/service/unarchiveChat/) | | `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/) | -| `serviceMethods.sendTyping` | The method is intended to send a notification about typing or recording audio in the chat | [SendTyping](https://green-api.com/docs/api/service/SendTyping/) | +| `serviceMethods.sendTyping` | The method is intended to send a notification about typing or recording audio in the chat | [SendTyping](https://green-api.com/en/docs/api/service/SendTyping/) | +| `serviceMethods.getChats` | The method returns a list of chats sorted by message activity time | [GetChats](https://green-api.com/en/docs/api/service/GetChats/) | | `webhooks.startReceivingNotifications` | The method is designed to start receiving new notifications | | | `webhooks.stopReceivingNotifications` | The method is designed to stop receiving new notifications | | | `partner.GetInstances` | The method is for getting all the account instances created by the partner. | [GetInstances](https://green-api.com/en/docs/partners/getInstances/) | diff --git a/docs/README.md b/docs/README.md index 06f9330..2ea56a3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -299,6 +299,18 @@ asyncio.run(main()) | Пример асинхронной отправки интерактивных кнопок с ответом | [SendInteractiveButtonsReplyAsync.py](../examples/async/sending/sendInteractiveButtonsReplyAsync.py) | | Пример отправки уведомления о наборе текста или записи аудио | [SendTyping.py](../examples/sync/sendTyping.py) | | Пример асинхронной отправки уведомления о наборе текста или записи аудио | [SendTypingAsync.py](../examples/async/sendTypingAsync.py) | +| Пример методов аккаунта (история статусов, обновление токена) | [accountMethods.py](../examples/sync/accountMethods.py) | +| Пример асинхронных методов аккаунта | [accountMethodsAsync.py](../examples/async/accountMethodsAsync.py) | +| Пример получения журнала звонков | [lastCalls.py](../examples/sync/lastCalls.py) | +| Пример асинхронного получения журнала звонков | [lastCallsAsync.py](../examples/async/lastCallsAsync.py) | +| Пример отправки сообщения с настройками превью ссылки | [sendMessageWithPreview.py](../examples/sync/sending/sendMessageWithPreview.py) | +| Пример асинхронной отправки сообщения с превью ссылки | [sendMessageWithPreviewAsync.py](../examples/async/sending/sendMessageWithPreviewAsync.py) | +| Пример методов очереди (счётчики, очистка вебхуков) | [queuesMethods.py](../examples/sync/queuesMethods.py) | +| Пример асинхронных методов очереди | [queuesMethodsAsync.py](../examples/async/queuesMethodsAsync.py) | +| Пример методов группы (обновление настроек) | [groupsMethods.py](../examples/sync/groupsMethods.py) | +| Пример асинхронных методов группы | [groupsMethodsAsync.py](../examples/async/groupsMethodsAsync.py) | +| Пример сервисных методов (getChats, checkWhatsapp, getContacts) | [serviceMethods.py](../examples/sync/serviceMethods.py) | +| Пример асинхронных сервисных методов | [serviceMethodsAsync.py](../examples/async/serviceMethodsAsync.py) | ## Полный список методов библиотеки @@ -314,6 +326,8 @@ asyncio.run(main()) | `account.qr` | Метод предназначен для получения QR-кода | [QR](https://green-api.com/docs/api/account/QR/) | | `account.setProfilePicture` | Метод предназначен для установки аватара аккаунта | [SetProfilePicture](https://green-api.com/docs/api/account/SetProfilePicture/) | | `account.getAuthorizationCode` | Метод предназначен для авторизации инстанса по номеру телефона | [GetAuthorizationCode](https://green-api.com/docs/api/account/GetAuthorizationCode/) | +| `account.getStateInstanceHistory` | Метод возвращает историю изменений состояния инстанса | [GetStateInstanceHistory](https://green-api.com/docs/api/account/GetStateInstanceHistory/) | +| `account.updateApiToken` | Метод генерирует новый API-токен для инстанса (бета) | [UpdateApiToken](https://green-api.com/docs/api/account/UpdateApiToken/) | | `contacts.addContact` | Метод предназначен для добавления номера в контакты | [addContact](https://green-api.com/docs/api/contacts/AddContact/) | | `contacts.editContact` | Метод предназначен для редактирования номера в контактах | [editContact](https://green-api.com/docs/api/contacts/EditContact/) | | `contacts.deleteContact` | Метод предназначен для удаления номера из контактов | [deleteContact](https://green-api.com/docs/api/contacts/DeleteContact/) | @@ -327,12 +341,18 @@ asyncio.run(main()) | `groups.removeAdmin` | Метод лишает участника прав администрирования группового чата | [RemoveAdmin](https://green-api.com/docs/api/groups/RemoveAdmin/) | | `groups.setGroupPicture` | Метод устанавливает аватар группы | [SetGroupPicture](https://green-api.com/docs/api/groups/SetGroupPicture/) | | `groups.leaveGroup` | Метод производит выход пользователя текущего аккаунта из группового чата | [LeaveGroup](https://green-api.com/docs/api/groups/LeaveGroup/) | +| `groups.updateGroupSettings` | Метод изменяет настройки группового чата (бета) | [UpdateGroupSettings](https://green-api.com/docs/api/groups/UpdateGroupSettings/) | | `journals.getChatHistory` | Метод возвращает историю сообщений чата | [GetChatHistory](https://green-api.com/docs/api/journals/GetChatHistory/) | | `journals.getMessage` | Метод возвращает сообщение чата | [GetMessage](https://green-api.com/docs/api/journals/GetMessage/) | | `journals.lastIncomingMessages` | Метод возвращает крайние входящие сообщения аккаунта | [LastIncomingMessages](https://green-api.com/docs/api/journals/LastIncomingMessages/) | | `journals.lastOutgoingMessages` | Метод возвращает крайние отправленные сообщения аккаунта | [LastOutgoingMessages](https://green-api.com/docs/api/journals/LastOutgoingMessages/) | +| `journals.lastIncomingCalls` | Метод возвращает последние входящие звонки аккаунта (бета) | [LastIncomingCalls](https://green-api.com/docs/api/journals/LastIncomingCalls/) | +| `journals.lastOutgoingCalls` | Метод возвращает последние исходящие звонки аккаунта (бета) | [LastOutgoingCalls](https://green-api.com/docs/api/journals/LastOutgoingCalls/) | | `queues.showMessagesQueue` | Метод предназначен для получения списка сообщений, находящихся в очереди на отправку | [ShowMessagesQueue](https://green-api.com/docs/api/queues/ShowMessagesQueue/) | | `queues.clearMessagesQueue` | Метод предназначен для очистки очереди сообщений на отправку | [ClearMessagesQueue](https://green-api.com/docs/api/queues/ClearMessagesQueue/) | +| `queues.getMessagesCount` | Метод возвращает количество сообщений в очереди на отправку | [GetMessagesCount](https://green-api.com/docs/api/queues/GetMessagesCount/) | +| `queues.getWebhooksCount` | Метод возвращает количество уведомлений в очереди входящих вебхуков | [GetWebhooksCount](https://green-api.com/docs/api/queues/GetWebhooksCount/) | +| `queues.clearWebhooksQueue` | Метод очищает очередь входящих вебхуков | [ClearWebhooksQueue](https://green-api.com/docs/api/queues/ClearWebhooksQueue/) | | `marking.readChat` | Метод предназначен для отметки сообщений в чате прочитанными | [ReadChat](https://green-api.com/docs/api/marks/ReadChat/) | | `receiving.receiveNotification` | Метод предназначен для получения одного входящего уведомления из очереди уведомлений | [ReceiveNotification](https://green-api.com/docs/api/receiving/technology-http-api/ReceiveNotification/) | | `receiving.deleteNotification` | Метод предназначен для удаления входящего уведомления из очереди уведомлений | [DeleteNotification](https://green-api.com/docs/api/receiving/technology-http-api/DeleteNotification/) | @@ -357,6 +377,7 @@ asyncio.run(main()) | `serviceMethods.unarchiveChat` | Метод разархивирует чат | [UnarchiveChat](https://green-api.com/docs/api/service/unarchiveChat/) | | `serviceMethods.setDisappearingChat` | Метод предназначен для изменения настроек исчезающих сообщений в чатах | [SetDisappearingChat](https://green-api.com/docs/api/service/SetDisappearingChat/) | | `serviceMethods.sendTyping` | Метод предназначен для отправки уведомления о наборе текста или записи аудио в чат | [SendTyping](https://green-api.com/docs/api/service/SendTyping/) | +| `serviceMethods.getChats` | Метод возвращает список чатов, отсортированных по времени активности | [GetChats](https://green-api.com/docs/api/service/GetChats/) | | `webhooks.startReceivingNotifications` | Метод предназначен для старта получения новых уведомлений | | | `webhooks.stopReceivingNotifications` | Метод предназначен для остановки получения новых уведомлений | | | `partner.GetInstances` | Метод предназначен для получения всех инстансов аккаунтов созданных партнёром. | [GetInstances](https://green-api.com/docs/partners/getInstances/) | diff --git a/examples/async/accountMethodsAsync.py b/examples/async/accountMethodsAsync.py index 4f3c779..003589e 100644 --- a/examples/async/accountMethodsAsync.py +++ b/examples/async/accountMethodsAsync.py @@ -11,13 +11,18 @@ async def main(): greenAPI.account.getWaSettingsAsync(), greenAPI.account.setSettingsAsync({"outgoingWebhook": "yes", "incomingWebhook": "yes"}), greenAPI.account.getStateInstanceAsync(), + greenAPI.account.getStateInstanceHistoryAsync(count=50), greenAPI.account.rebootAsync(), greenAPI.account.qrAsync(), greenAPI.account.getAuthorizationCodeAsync(79876543210) ] - + responses = await asyncio.gather(*tasks, return_exceptions=True) [print(response.data) for response in responses if response.code == 200] + # Refresh API token (beta). The old token becomes invalid after this call. + response = await greenAPI.account.updateApiTokenAsync() + print(response.data) + if __name__ == '__main__': asyncio.run(main()) \ No newline at end of file diff --git a/examples/async/groupsMethodsAsync.py b/examples/async/groupsMethodsAsync.py index 7b03f77..b9d3ac0 100644 --- a/examples/async/groupsMethodsAsync.py +++ b/examples/async/groupsMethodsAsync.py @@ -9,7 +9,11 @@ async def main(): tasks = [ greenAPI.groups.createGroupAsync("SDK Python", ["79876543210@c.us", "11001234568@c.us"]), greenAPI.groups.addGroupParticipantAsync("1234567890@g.us", "79876543210@c.us"), - greenAPI.groups.getGroupDataAsync("1234567890@g.us") + greenAPI.groups.getGroupDataAsync("1234567890@g.us"), + greenAPI.groups.updateGroupSettingsAsync( + "1234567890@g.us", + allowParticipantsSendMessages=False + ), ] responses = await asyncio.gather(*tasks, return_exceptions=True) diff --git a/examples/async/lastCallsAsync.py b/examples/async/lastCallsAsync.py new file mode 100644 index 0000000..ff360df --- /dev/null +++ b/examples/async/lastCallsAsync.py @@ -0,0 +1,19 @@ +import asyncio +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + +async def main(): + tasks = [ + greenAPI.journals.lastIncomingCallsAsync(4320), + greenAPI.journals.lastOutgoingCallsAsync(4320) + ] + + responses = await asyncio.gather(*tasks, return_exceptions=True) + [print(response.data) for response in responses if response.code == 200] + + +if __name__ == '__main__': + asyncio.run(main()) diff --git a/examples/async/lastMessagesAsync.py b/examples/async/lastMessagesAsync.py index 88720e4..128f397 100644 --- a/examples/async/lastMessagesAsync.py +++ b/examples/async/lastMessagesAsync.py @@ -8,7 +8,9 @@ async def main(): tasks = [ greenAPI.journals.lastIncomingMessagesAsync(4320), - greenAPI.journals.lastOutgoingMessagesAsync(4320) + greenAPI.journals.lastOutgoingMessagesAsync(4320), + greenAPI.journals.lastIncomingCallsAsync(4320), + greenAPI.journals.lastOutgoingCallsAsync(4320), ] responses = await asyncio.gather(*tasks, return_exceptions=True) diff --git a/examples/async/queuesMethodsAsync.py b/examples/async/queuesMethodsAsync.py new file mode 100644 index 0000000..98b5669 --- /dev/null +++ b/examples/async/queuesMethodsAsync.py @@ -0,0 +1,23 @@ +import asyncio +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + +async def main(): + tasks = [ + greenAPI.queues.getMessagesCountAsync(), + greenAPI.queues.getWebhooksCountAsync(), + ] + + responses = await asyncio.gather(*tasks, return_exceptions=True) + [print(response.data) for response in responses if response.code == 200] + + # Clear webhooks queue (rate-limited to once per minute) + response = await greenAPI.queues.clearWebhooksQueueAsync() + print(response.data) + + +if __name__ == '__main__': + asyncio.run(main()) diff --git a/examples/async/sending/sendMessageWithPreviewAsync.py b/examples/async/sending/sendMessageWithPreviewAsync.py new file mode 100644 index 0000000..a2dc0e2 --- /dev/null +++ b/examples/async/sending/sendMessageWithPreviewAsync.py @@ -0,0 +1,40 @@ +import asyncio +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + +async def main(): + tasks = [ + # Large link preview + greenAPI.sending.sendMessageAsync( + "79876543210@c.us", + "Check out our website!", + typePreview="large" + ), + # Custom preview + greenAPI.sending.sendMessageAsync( + "79876543210@c.us", + "Check out our website!", + linkPreview=True, + customPreview={ + "title": "My Website", + "description": "The best website in the world", + "link": "example.com" + } + ), + # No preview + greenAPI.sending.sendMessageAsync( + "79876543210@c.us", + "https://example.com — visit us!", + linkPreview=False + ), + ] + + responses = await asyncio.gather(*tasks, return_exceptions=True) + [print(response.data) for response in responses if response.code == 200] + + +if __name__ == '__main__': + asyncio.run(main()) diff --git a/examples/async/serviceMethodsAsync.py b/examples/async/serviceMethodsAsync.py index 2733a52..238348b 100644 --- a/examples/async/serviceMethodsAsync.py +++ b/examples/async/serviceMethodsAsync.py @@ -7,8 +7,20 @@ async def main(): tasks = [ + # Preferred: use chatId + greenAPI.serviceMethods.checkWhatsappAsync(chatId="79876543210@c.us"), + # Bypass cache + greenAPI.serviceMethods.checkWhatsappAsync(chatId="79876543210@c.us", force=True), + # Old-style call still works (backward compatible) greenAPI.serviceMethods.checkWhatsappAsync(79876543210), + # All contacts greenAPI.serviceMethods.getContactsAsync(), + # Only groups + greenAPI.serviceMethods.getContactsAsync(group=True), + # Only personal chats, limit 20 + greenAPI.serviceMethods.getContactsAsync(group=False, count=20), + # Last 10 active chats + greenAPI.serviceMethods.getChatsAsync(count=10), greenAPI.serviceMethods.deleteMessageAsync("79876543210@c.us", "BAE52A7F04F452F9", True), greenAPI.serviceMethods.deleteMessageAsync("79876543210@c.us", "BAE52A7F04F452F9"), greenAPI.serviceMethods.editMessageAsync("79876543210@c.us", "BAE5F793F61411D0", "Edited message text") diff --git a/examples/sync/accountMethods.py b/examples/sync/accountMethods.py new file mode 100644 index 0000000..a022b22 --- /dev/null +++ b/examples/sync/accountMethods.py @@ -0,0 +1,23 @@ +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + + +def main(): + # Get last 50 state changes + response = greenAPI.account.getStateInstanceHistory(count=50) + print(response.data) + + # Get full history (default 100 records) + response = greenAPI.account.getStateInstanceHistory() + print(response.data) + + # Refresh API token (beta). The old token becomes invalid after this call. + response = greenAPI.account.updateApiToken() + print(response.data) + + +if __name__ == '__main__': + main() diff --git a/examples/sync/groupsMethods.py b/examples/sync/groupsMethods.py new file mode 100644 index 0000000..eabb4f7 --- /dev/null +++ b/examples/sync/groupsMethods.py @@ -0,0 +1,33 @@ +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + + +def main(): + # Allow only admins to send messages + response = greenAPI.groups.updateGroupSettings( + "1234567890@g.us", + allowParticipantsSendMessages=False + ) + print(response.data) + + # Allow participants to edit group settings + response = greenAPI.groups.updateGroupSettings( + "1234567890@g.us", + allowParticipantsEditGroupSettings=True + ) + print(response.data) + + # Change both settings at once + response = greenAPI.groups.updateGroupSettings( + "1234567890@g.us", + allowParticipantsEditGroupSettings=False, + allowParticipantsSendMessages=True + ) + print(response.data) + + +if __name__ == '__main__': + main() diff --git a/examples/sync/lastCalls.py b/examples/sync/lastCalls.py new file mode 100644 index 0000000..f5ab5e2 --- /dev/null +++ b/examples/sync/lastCalls.py @@ -0,0 +1,21 @@ +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + + +def main(): + # If no argument, calls for the last 24 hours are returned. + + print("Incoming calls in the last 72 hours:") + response = greenAPI.journals.lastIncomingCalls(4320) + print(response.data) + + print("Outgoing calls in the last 72 hours:") + response = greenAPI.journals.lastOutgoingCalls(4320) + print(response.data) + + +if __name__ == '__main__': + main() diff --git a/examples/sync/lastMessages.py b/examples/sync/lastMessages.py index 78f3f43..f53c37a 100644 --- a/examples/sync/lastMessages.py +++ b/examples/sync/lastMessages.py @@ -6,7 +6,7 @@ def main(): - # If no argument, the messages for 24 hours are returned. + # If no argument, the messages/calls for 24 hours are returned. print("Incoming messages in the last 72 hours:") response = greenAPI.journals.lastIncomingMessages(4320) @@ -16,6 +16,14 @@ def main(): response = greenAPI.journals.lastOutgoingMessages(4320) print(response.data) + print("Incoming calls in the last 72 hours:") + response = greenAPI.journals.lastIncomingCalls(4320) + print(response.data) + + print("Outgoing calls in the last 72 hours:") + response = greenAPI.journals.lastOutgoingCalls(4320) + print(response.data) + if __name__ == '__main__': main() \ No newline at end of file diff --git a/examples/sync/queuesMethods.py b/examples/sync/queuesMethods.py new file mode 100644 index 0000000..d8b82ec --- /dev/null +++ b/examples/sync/queuesMethods.py @@ -0,0 +1,23 @@ +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + + +def main(): + # Number of messages in the outgoing queue + response = greenAPI.queues.getMessagesCount() + print(response.data) + + # Number of notifications in the incoming webhooks queue + response = greenAPI.queues.getWebhooksCount() + print(response.data) + + # Clear the incoming webhooks queue (rate-limited to once per minute) + response = greenAPI.queues.clearWebhooksQueue() + print(response.data) + + +if __name__ == '__main__': + main() diff --git a/examples/sync/sending/sendMessageWithPreview.py b/examples/sync/sending/sendMessageWithPreview.py new file mode 100644 index 0000000..b2b44f1 --- /dev/null +++ b/examples/sync/sending/sendMessageWithPreview.py @@ -0,0 +1,40 @@ +from whatsapp_api_client_python import API + +greenAPI = API.GreenAPI( + "1101000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345" +) + + +def main(): + # Send message with large link preview + response = greenAPI.sending.sendMessage( + "79876543210@c.us", + "Check out our website!", + typePreview="large" + ) + print(response.data) + + # Send message with custom link preview + response = greenAPI.sending.sendMessage( + "79876543210@c.us", + "Check out our website!", + linkPreview=True, + customPreview={ + "title": "My Website", + "description": "The best website in the world", + "link": "example.com" + } + ) + print(response.data) + + # Disable link preview + response = greenAPI.sending.sendMessage( + "79876543210@c.us", + "https://example.com — visit us!", + linkPreview=False + ) + print(response.data) + + +if __name__ == '__main__': + main() diff --git a/examples/sync/serviceMethods.py b/examples/sync/serviceMethods.py index c5fdd89..8f99ff5 100644 --- a/examples/sync/serviceMethods.py +++ b/examples/sync/serviceMethods.py @@ -6,6 +6,38 @@ def main(): + # CheckWhatsapp — preferred: use chatId + response = greenAPI.serviceMethods.checkWhatsapp(chatId="79876543210@c.us") + print(response.data) + + # CheckWhatsapp — bypass cache and query WhatsApp directly + response = greenAPI.serviceMethods.checkWhatsapp(chatId="79876543210@c.us", force=True) + print(response.data) + + # CheckWhatsapp — old-style call still works (backward compatible) + response = greenAPI.serviceMethods.checkWhatsapp(79876543210) + print(response.data) + + # GetContacts — all contacts + response = greenAPI.serviceMethods.getContacts() + print(response.data) + + # GetContacts — only groups + response = greenAPI.serviceMethods.getContacts(group=True) + print(response.data) + + # GetContacts — only personal chats, limit to 20 + response = greenAPI.serviceMethods.getContacts(group=False, count=20) + print(response.data) + + # GetChats — all chats sorted by activity + response = greenAPI.serviceMethods.getChats() + print(response.data) + + # GetChats — last 10 active chats + response = greenAPI.serviceMethods.getChats(count=10) + print(response.data) + # DeleteMessage for sender response = greenAPI.serviceMethods.deleteMessage("79876543210@c.us", "BAE52A7F04F452F9", True) @@ -14,7 +46,7 @@ def main(): # EditMessage response = greenAPI.serviceMethods.editMessage("79876543210@c.us", "BAE5F793F61411D0", "New text") - print(response.data) # new idMessage + print(response.data) if __name__ == '__main__': main() diff --git a/whatsapp_api_client_python/tools/account.py b/whatsapp_api_client_python/tools/account.py index bd8948b..6c11ac1 100644 --- a/whatsapp_api_client_python/tools/account.py +++ b/whatsapp_api_client_python/tools/account.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import Dict, TYPE_CHECKING, Union +from typing import Dict, Optional, TYPE_CHECKING, Union import aiofiles @@ -214,4 +214,46 @@ async def getAuthorizationCodeAsync(self, phoneNumber: int) -> Response: "POST", "{{host}}/waInstance{{idInstance}}/getAuthorizationCode/{{apiTokenInstance}}", request_body + ) + + def getStateInstanceHistory(self, count: Optional[int] = None) -> Response: + """ + The method returns the history of the instance state changes. + + https://green-api.com/en/docs/api/account/GetStateInstanceHistory/ + """ + + url = ( + "{{host}}/waInstance{{idInstance}}/" + "GetStateInstanceHistory/{{apiTokenInstance}}" + ) + if count is not None: + url = f"{url}?count={count}" + + return self.api.request("GET", url) + + async def getStateInstanceHistoryAsync(self, count: Optional[int] = None) -> Response: + url = "{{host}}/waInstance{{idInstance}}/GetStateInstanceHistory/{{apiTokenInstance}}" + if count is not None: + url = f"{url}?count={count}" + + return await self.api.requestAsync("GET", url) + + def updateApiToken(self) -> Response: + """ + The method generates a new apiTokenInstance for the account instance. + + https://green-api.com/en/docs/api/account/UpdateApiToken/ + """ + + return self.api.request( + "GET", ( + "{{host}}/waInstance{{idInstance}}/" + "updateApiToken/{{apiTokenInstance}}" + ) + ) + + async def updateApiTokenAsync(self) -> Response: + return await self.api.requestAsync( + "GET", "{{host}}/waInstance{{idInstance}}/updateApiToken/{{apiTokenInstance}}" ) \ No newline at end of file diff --git a/whatsapp_api_client_python/tools/groups.py b/whatsapp_api_client_python/tools/groups.py index 981ef00..507dd45 100644 --- a/whatsapp_api_client_python/tools/groups.py +++ b/whatsapp_api_client_python/tools/groups.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import List, TYPE_CHECKING +from typing import List, Optional, TYPE_CHECKING import aiofiles @@ -261,6 +261,41 @@ async def leaveGroupAsync(self, groupId: str) -> Response: request_body ) + def updateGroupSettings( + self, + groupId: str, + allowParticipantsEditGroupSettings: Optional[bool] = None, + allowParticipantsSendMessages: Optional[bool] = None + ) -> Response: + """ + The method changes the group settings. + + https://green-api.com/en/docs/api/groups/UpdateGroupSettings/ + """ + + request_body = self.__handle_parameters(locals()) + + return self.api.request( + "POST", ( + "{{host}}/waInstance{{idInstance}}/" + "updateGroupSettings/{{apiTokenInstance}}" + ), request_body + ) + + async def updateGroupSettingsAsync( + self, + groupId: str, + allowParticipantsEditGroupSettings: Optional[bool] = None, + allowParticipantsSendMessages: Optional[bool] = None + ) -> Response: + request_body = self.__handle_parameters(locals()) + + return await self.api.requestAsync( + "POST", + "{{host}}/waInstance{{idInstance}}/updateGroupSettings/{{apiTokenInstance}}", + request_body + ) + @classmethod def __handle_parameters(cls, parameters: dict) -> dict: handled_parameters = parameters.copy() diff --git a/whatsapp_api_client_python/tools/journals.py b/whatsapp_api_client_python/tools/journals.py index 8168a03..72be6aa 100644 --- a/whatsapp_api_client_python/tools/journals.py +++ b/whatsapp_api_client_python/tools/journals.py @@ -123,4 +123,58 @@ async def lastOutgoingMessagesAsync(self, minutes: Optional[int] = None) -> Resp "GET", "{{host}}/waInstance{{idInstance}}/lastOutgoingMessages/{{apiTokenInstance}}", params + ) + + def lastIncomingCalls(self, minutes: Optional[int] = None) -> Response: + """ + The method returns the last incoming calls of the account. + + https://green-api.com/en/docs/api/journals/LastIncomingCalls/ + """ + + append_minutes = "" + if minutes is not None: + append_minutes = f"?minutes={minutes}" + + return self.api.request( + "GET", ( + "{{host}}/waInstance{{idInstance}}/" + "lastIncomingCalls/{{apiTokenInstance}}" + append_minutes + ) + ) + + async def lastIncomingCallsAsync(self, minutes: Optional[int] = None) -> Response: + params = {"minutes": minutes} if minutes else {} + + return await self.api.requestAsync( + "GET", + "{{host}}/waInstance{{idInstance}}/lastIncomingCalls/{{apiTokenInstance}}", + params + ) + + def lastOutgoingCalls(self, minutes: Optional[int] = None) -> Response: + """ + The method returns the last outgoing calls of the account. + + https://green-api.com/en/docs/api/journals/LastOutgoingCalls/ + """ + + append_minutes = "" + if minutes is not None: + append_minutes = f"?minutes={minutes}" + + return self.api.request( + "GET", ( + "{{host}}/waInstance{{idInstance}}/" + "lastOutgoingCalls/{{apiTokenInstance}}" + append_minutes + ) + ) + + async def lastOutgoingCallsAsync(self, minutes: Optional[int] = None) -> Response: + params = {"minutes": minutes} if minutes else {} + + return await self.api.requestAsync( + "GET", + "{{host}}/waInstance{{idInstance}}/lastOutgoingCalls/{{apiTokenInstance}}", + params ) \ No newline at end of file diff --git a/whatsapp_api_client_python/tools/queues.py b/whatsapp_api_client_python/tools/queues.py index 197bc01..4508f09 100644 --- a/whatsapp_api_client_python/tools/queues.py +++ b/whatsapp_api_client_python/tools/queues.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Optional from ..response import Response @@ -48,4 +48,62 @@ def clearMessagesQueue(self) -> Response: async def clearMessagesQueueAsync(self) -> Response: return await self.api.requestAsync( "GET", "{{host}}/waInstance{{idInstance}}/clearMessagesQueue/{{apiTokenInstance}}" + ) + + def getMessagesCount(self) -> Response: + """ + The method returns the number of messages in the outgoing queue. + + https://green-api.com/en/docs/api/queues/GetMessagesCount/ + """ + + return self.api.request( + "GET", ( + "{{host}}/waInstance{{idInstance}}/" + "getMessagesCount/{{apiTokenInstance}}" + ) + ) + + async def getMessagesCountAsync(self) -> Response: + return await self.api.requestAsync( + "GET", "{{host}}/waInstance{{idInstance}}/getMessagesCount/{{apiTokenInstance}}" + ) + + def getWebhooksCount(self) -> Response: + """ + The method returns the number of notifications in the incoming + webhooks queue. + + https://green-api.com/en/docs/api/queues/GetWebhooksCount/ + """ + + return self.api.request( + "GET", ( + "{{host}}/waInstance{{idInstance}}/" + "getWebhooksCount/{{apiTokenInstance}}" + ) + ) + + async def getWebhooksCountAsync(self) -> Response: + return await self.api.requestAsync( + "GET", "{{host}}/waInstance{{idInstance}}/getWebhooksCount/{{apiTokenInstance}}" + ) + + def clearWebhooksQueue(self) -> Response: + """ + The method clears the incoming webhooks queue. + + https://green-api.com/en/docs/api/queues/ClearWebhooksQueue/ + """ + + return self.api.request( + "DELETE", ( + "{{host}}/waInstance{{idInstance}}/" + "clearWebhooksQueue/{{apiTokenInstance}}" + ) + ) + + async def clearWebhooksQueueAsync(self) -> Response: + return await self.api.requestAsync( + "DELETE", "{{host}}/waInstance{{idInstance}}/clearWebhooksQueue/{{apiTokenInstance}}" ) \ No newline at end of file diff --git a/whatsapp_api_client_python/tools/receiving.py b/whatsapp_api_client_python/tools/receiving.py index 84e04e9..dd03cd4 100644 --- a/whatsapp_api_client_python/tools/receiving.py +++ b/whatsapp_api_client_python/tools/receiving.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING +from typing import Optional, TYPE_CHECKING from ..response import Response @@ -10,7 +10,7 @@ class Receiving: def __init__(self, api: "GreenApi"): self.api = api - def receiveNotification(self) -> Response: + def receiveNotification(self, receiveTimeout: Optional[int] = None) -> Response: """ The method is aimed for receiving one incoming notification from the notifications queue. @@ -18,17 +18,21 @@ def receiveNotification(self) -> Response: https://green-api.com/en/docs/api/receiving/technology-http-api/ReceiveNotification/ """ - return self.api.request( - "GET", ( - "{{host}}/waInstance{{idInstance}}/" - "receiveNotification/{{apiTokenInstance}}" - ) + url = ( + "{{host}}/waInstance{{idInstance}}/" + "receiveNotification/{{apiTokenInstance}}" ) + if receiveTimeout is not None: + url = f"{url}?receiveTimeout={receiveTimeout}" - async def receiveNotificationAsync(self) -> Response: - return await self.api.requestAsync( - "GET", "{{host}}/waInstance{{idInstance}}/receiveNotification/{{apiTokenInstance}}" - ) + return self.api.request("GET", url) + + async def receiveNotificationAsync(self, receiveTimeout: Optional[int] = None) -> Response: + url = "{{host}}/waInstance{{idInstance}}/receiveNotification/{{apiTokenInstance}}" + if receiveTimeout is not None: + url = f"{url}?receiveTimeout={receiveTimeout}" + + return await self.api.requestAsync("GET", url) def deleteNotification(self, receiptId: int) -> Response: """ diff --git a/whatsapp_api_client_python/tools/sending.py b/whatsapp_api_client_python/tools/sending.py index cdea029..426e21e 100644 --- a/whatsapp_api_client_python/tools/sending.py +++ b/whatsapp_api_client_python/tools/sending.py @@ -21,7 +21,9 @@ def sendMessage( quotedMessageId: Optional[str] = None, archiveChat: Optional[bool] = None, linkPreview: Optional[bool] = None, - typingTime: Optional[int] = None + typingTime: Optional[int] = None, + typePreview: Optional[str] = None, + customPreview: Optional[dict] = None ) -> Response: """ The method is aimed for sending a text message to a personal or @@ -46,7 +48,9 @@ async def sendMessageAsync( quotedMessageId: Optional[str] = None, archiveChat: Optional[bool] = None, linkPreview: Optional[bool] = None, - typingTime: Optional[int] = None + typingTime: Optional[int] = None, + typePreview: Optional[str] = None, + customPreview: Optional[dict] = None ) -> Response: request_body = self.__handle_parameters(locals()) @@ -392,7 +396,8 @@ def forwardMessages( self, chatId: str, chatIdFrom: str, - messages: List[str] + messages: List[str], + typingTime: Optional[int] = None ) -> Response: """ The method is intended for forwarding messages to a personal or diff --git a/whatsapp_api_client_python/tools/serviceMethods.py b/whatsapp_api_client_python/tools/serviceMethods.py index 7431e45..0ed9cbb 100644 --- a/whatsapp_api_client_python/tools/serviceMethods.py +++ b/whatsapp_api_client_python/tools/serviceMethods.py @@ -9,15 +9,27 @@ class ServiceMethods: def __init__(self, api: "GreenApi"): self.api = api - def checkWhatsapp(self, phoneNumber: int) -> Response: + def checkWhatsapp( + self, + phoneNumber: Optional[int] = None, + chatId: Optional[str] = None, + force: Optional[bool] = None + ) -> Response: """ - The method checks WhatsApp account availability on a phone - number. + The method checks WhatsApp account availability on a phone number. + Use chatId (e.g. "79001234567@c.us") as the preferred parameter. + phoneNumber is kept for backward compatibility. https://green-api.com/en/docs/api/service/CheckWhatsapp/ """ request_body = locals() + if phoneNumber is None: + request_body.pop("phoneNumber") + if chatId is None: + request_body.pop("chatId") + if force is None: + request_body.pop("force") request_body.pop("self") return self.api.request( @@ -27,8 +39,19 @@ def checkWhatsapp(self, phoneNumber: int) -> Response: ), request_body ) - async def checkWhatsappAsync(self, phoneNumber: int) -> Response: + async def checkWhatsappAsync( + self, + phoneNumber: Optional[int] = None, + chatId: Optional[str] = None, + force: Optional[bool] = None + ) -> Response: request_body = locals() + if phoneNumber is None: + request_body.pop("phoneNumber") + if chatId is None: + request_body.pop("chatId") + if force is None: + request_body.pop("force") request_body.pop("self") return await self.api.requestAsync( @@ -64,7 +87,11 @@ async def getAvatarAsync(self, chatId: str) -> Response: request_body ) - def getContacts(self) -> Response: + def getContacts( + self, + group: Optional[bool] = None, + count: Optional[int] = None + ) -> Response: """ The method is aimed for getting a list of the current account contacts. @@ -72,17 +99,35 @@ def getContacts(self) -> Response: https://green-api.com/en/docs/api/service/GetContacts/ """ - return self.api.request( - "GET", ( - "{{host}}/waInstance{{idInstance}}/" - "getContacts/{{apiTokenInstance}}" - ) + url = ( + "{{host}}/waInstance{{idInstance}}/" + "getContacts/{{apiTokenInstance}}" ) + query_parts = [] + if group is not None: + query_parts.append(f"group={'true' if group else 'false'}") + if count is not None: + query_parts.append(f"count={count}") + if query_parts: + url = f"{url}?{'&'.join(query_parts)}" + + return self.api.request("GET", url) + + async def getContactsAsync( + self, + group: Optional[bool] = None, + count: Optional[int] = None + ) -> Response: + url = "{{host}}/waInstance{{idInstance}}/getContacts/{{apiTokenInstance}}" + query_parts = [] + if group is not None: + query_parts.append(f"group={'true' if group else 'false'}") + if count is not None: + query_parts.append(f"count={count}") + if query_parts: + url = f"{url}?{'&'.join(query_parts)}" - async def getContactsAsync(self) -> Response: - return await self.api.requestAsync( - "GET", "{{host}}/waInstance{{idInstance}}/getContacts/{{apiTokenInstance}}" - ) + return await self.api.requestAsync("GET", url) def getContactInfo(self, chatId: str) -> Response: """ @@ -297,4 +342,27 @@ async def sendTypingAsync( "POST", "{{host}}/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}", request_body - ) \ No newline at end of file + ) + + def getChats(self, count: Optional[int] = None) -> Response: + """ + The method returns a list of chats sorted by message activity time. + + https://green-api.com/en/docs/api/service/GetChats/ + """ + + url = ( + "{{host}}/waInstance{{idInstance}}/" + "getChats/{{apiTokenInstance}}" + ) + if count is not None: + url = f"{url}?count={count}" + + return self.api.request("GET", url) + + async def getChatsAsync(self, count: Optional[int] = None) -> Response: + url = "{{host}}/waInstance{{idInstance}}/getChats/{{apiTokenInstance}}" + if count is not None: + url = f"{url}?count={count}" + + return await self.api.requestAsync("GET", url) \ No newline at end of file From 4185d4aad4644f8c9ad3869dcc3a37000faaf0e9 Mon Sep 17 00:00:00 2001 From: Vadim Savilov Date: Wed, 8 Jul 2026 16:52:10 +0500 Subject: [PATCH 2/2] feat: sync SDK with API docs - add 9 new methods, update 5 existing New methods (+ async variants): - account.getStateInstanceHistory(count) - account.updateApiToken() - serviceMethods.getChats(count) - groups.updateGroupSettings(groupId, allowParticipantsEditGroupSettings, allowParticipantsSendMessages) - journals.lastIncomingCalls(minutes) - journals.lastOutgoingCalls(minutes) - queues.getMessagesCount() - queues.getWebhooksCount() - queues.clearWebhooksQueue() Updated signatures (backward compatible): - sending.sendMessage: add typePreview, customPreview - sending.forwardMessages: add typingTime - serviceMethods.checkWhatsapp: add chatId (preferred), force; phoneNumber -> Optional - serviceMethods.getContacts: add group, count - receiving.receiveNotification: add receiveTimeout Examples: add 8 new files, update 6 existing README/docs: add new methods and examples to both tables --- whatsapp_api_client_python/tools/queues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whatsapp_api_client_python/tools/queues.py b/whatsapp_api_client_python/tools/queues.py index 4508f09..64445e3 100644 --- a/whatsapp_api_client_python/tools/queues.py +++ b/whatsapp_api_client_python/tools/queues.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING from ..response import Response