From a1beadb19f394398cbc035aa4d812834049d40bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20D=C4=99bski?= Date: Tue, 31 Mar 2026 14:27:33 +0200 Subject: [PATCH 1/2] add activate/deactivate customer page methods to Customer RTM v3.6 and v3.7 --- changelog.md | 2 ++ livechat/customer/rtm/api/v36.py | 34 ++++++++++++++++++++++++++++ livechat/customer/rtm/api/v37.py | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/changelog.md b/changelog.md index 80d37b4..fff9c8f 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. ### Added - Support for new version 3.7. +- New method `activate_customer_page` in customer-api v3.6 and v3.7 (rtm). +- New method `deactivate_customer_page` in customer-api v3.6 and v3.7 (rtm). - New method `request_welcome_message` in customer-api v3.6 and v3.7. - New method `delete_event` in customer-api v3.6. - New methods in configuration-api v3.6 for greetings: `create_greeting`, `delete_greeting`, `get_greeting`, `update_greeting`, `list_greetings`. diff --git a/livechat/customer/rtm/api/v36.py b/livechat/customer/rtm/api/v36.py index 79d5974..e975851 100644 --- a/livechat/customer/rtm/api/v36.py +++ b/livechat/customer/rtm/api/v36.py @@ -487,6 +487,40 @@ def update_customer_page(self, 'payload': payload }) + def activate_customer_page(self, + payload: dict = None) -> RtmResponse: + ''' Marks the current Customer's page tab as active (focused). + + Args: + payload (dict): Custom payload to be used as request's data. + It overrides all other parameters provided for the method. + + Returns: + RtmResponse: RTM response structure (`request_id`, `action`, + `type`, `success` and `payload` properties) + ''' + return self.ws.send({ + 'action': 'activate_customer_page', + 'payload': {} if payload is None else payload + }) + + def deactivate_customer_page(self, + payload: dict = None) -> RtmResponse: + ''' Marks the current Customer's page tab as inactive (unfocused). + + Args: + payload (dict): Custom payload to be used as request's data. + It overrides all other parameters provided for the method. + + Returns: + RtmResponse: RTM response structure (`request_id`, `action`, + `type`, `success` and `payload` properties) + ''' + return self.ws.send({ + 'action': 'deactivate_customer_page', + 'payload': {} if payload is None else payload + }) + def set_customer_session_fields(self, session_fields: list = None, payload: dict = None) -> RtmResponse: diff --git a/livechat/customer/rtm/api/v37.py b/livechat/customer/rtm/api/v37.py index 1f5a8d6..81f6833 100644 --- a/livechat/customer/rtm/api/v37.py +++ b/livechat/customer/rtm/api/v37.py @@ -487,6 +487,40 @@ def update_customer_page(self, 'payload': payload }) + def activate_customer_page(self, + payload: dict = None) -> RtmResponse: + ''' Marks the current Customer's page tab as active (focused). + + Args: + payload (dict): Custom payload to be used as request's data. + It overrides all other parameters provided for the method. + + Returns: + RtmResponse: RTM response structure (`request_id`, `action`, + `type`, `success` and `payload` properties) + ''' + return self.ws.send({ + 'action': 'activate_customer_page', + 'payload': {} if payload is None else payload + }) + + def deactivate_customer_page(self, + payload: dict = None) -> RtmResponse: + ''' Marks the current Customer's page tab as inactive (unfocused). + + Args: + payload (dict): Custom payload to be used as request's data. + It overrides all other parameters provided for the method. + + Returns: + RtmResponse: RTM response structure (`request_id`, `action`, + `type`, `success` and `payload` properties) + ''' + return self.ws.send({ + 'action': 'deactivate_customer_page', + 'payload': {} if payload is None else payload + }) + def set_customer_session_fields(self, session_fields: list = None, payload: dict = None) -> RtmResponse: @@ -528,11 +562,15 @@ def get_customer(self, payload: dict = None) -> RtmResponse: def login(self, token: Optional[Union[AccessToken, str]] = None, + customer_page: dict = None, + tab_id: str = None, payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: token (str) : OAuth token from the Customer's account. + customer_page (dict): Customer's current page with `url` and `title` keys. + tab_id (str): Identifier of the customer's browser tab. payload (dict): Custom payload to be used as request's data. It overrides all other parameters provided for the method. From 9c05ecc8b38c6d6cf710406828a17fc7b73e32bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20D=C4=99bski?= Date: Tue, 31 Mar 2026 14:30:30 +0200 Subject: [PATCH 2/2] fix: add activate/deactivate customer page methods to Customer RTM v3.6 and v3.7 --- livechat/customer/rtm/api/v37.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/livechat/customer/rtm/api/v37.py b/livechat/customer/rtm/api/v37.py index 81f6833..e767c8b 100644 --- a/livechat/customer/rtm/api/v37.py +++ b/livechat/customer/rtm/api/v37.py @@ -562,15 +562,11 @@ def get_customer(self, payload: dict = None) -> RtmResponse: def login(self, token: Optional[Union[AccessToken, str]] = None, - customer_page: dict = None, - tab_id: str = None, payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: token (str) : OAuth token from the Customer's account. - customer_page (dict): Customer's current page with `url` and `title` keys. - tab_id (str): Identifier of the customer's browser tab. payload (dict): Custom payload to be used as request's data. It overrides all other parameters provided for the method.