diff --git a/changelog.md b/changelog.md index 3906b6b..8b02005 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### Added - 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`. +- New method `send_thinking_indicator` in agent-api v3.6. ### Changed - Improved websocket response collection + extended logging in the websocket client. diff --git a/livechat/agent/rtm/api/v36.py b/livechat/agent/rtm/api/v36.py index 8fa82d7..5876f77 100644 --- a/livechat/agent/rtm/api/v36.py +++ b/livechat/agent/rtm/api/v36.py @@ -952,6 +952,33 @@ def send_typing_indicator(self, 'payload': payload }) + def send_thinking_indicator(self, + chat_id: str = None, + visibility: str = None, + title: str = None, + description: str = None, + payload: dict = None) -> RtmResponse: + ''' Sends a thinking indicator. + + Args: + chat_id (str): ID of the chat you want to send the thinking indicator to. + visibility (str): Possible values: `all`, `agents`. + title (str): Title of the thinking indicator. + description (str): Description of the thinking indicator. + 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) + ''' + if payload is None: + payload = prepare_payload(locals()) + return self.ws.send({ + 'action': 'send_thinking_indicator', + 'payload': payload + }) + def multicast(self, recipients: dict = None, content: Any = None, diff --git a/livechat/agent/web/api/v36.py b/livechat/agent/web/api/v36.py index 544cdad..6eb511b 100644 --- a/livechat/agent/web/api/v36.py +++ b/livechat/agent/web/api/v36.py @@ -987,6 +987,35 @@ def send_typing_indicator(self, json=payload, headers=headers) + def send_thinking_indicator(self, + chat_id: str = None, + title: str = None, + description: str = None, + visibility: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Sends thinking indicator. + + Args: + chat_id (str): ID of the chat that to send the thinking indicator to. + title (str): Title of the thinking indicator. + description (str): Description of the thinking indicator. + visibility (str): Possible values: `all`, `agents`. + payload (dict): Custom payload to be used as request's data. + It overrides all other parameters provided for the method. + headers (dict): Custom headers to be used with session headers. + They will be merged with session-level values that are set, + however, these method-level parameters will not be persisted across requests. + + Returns: + httpx.Response: The Response object from `httpx` library, + which contains a server’s response to an HTTP request. ''' + if payload is None: + payload = prepare_payload(locals()) + return self.session.post(f'{self.api_url}/send_thinking_indicator', + json=payload, + headers=headers) + def multicast(self, recipients: dict = None, content: typing.Any = None,