Skip to content

Commit 6514ddd

Browse files
authored
Merge pull request #161 from livechat/ME-526/thinking-indicator-methods
ME-526: new method send_thinking_indicator in agent-api v3.6
2 parents 399e90c + 0472c32 commit 6514ddd

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
66
### Added
77
- New method `delete_event` in customer-api v3.6.
88
- New methods in configuration-api v3.6 for greetings: `create_greeting`, `delete_greeting`, `get_greeting`, `update_greeting`, `list_greetings`.
9+
- New method `send_thinking_indicator` in agent-api v3.6.
910

1011
### Changed
1112
- Improved websocket response collection + extended logging in the websocket client.

livechat/agent/rtm/api/v36.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,33 @@ def send_typing_indicator(self,
952952
'payload': payload
953953
})
954954

955+
def send_thinking_indicator(self,
956+
chat_id: str = None,
957+
visibility: str = None,
958+
title: str = None,
959+
description: str = None,
960+
payload: dict = None) -> RtmResponse:
961+
''' Sends a thinking indicator.
962+
963+
Args:
964+
chat_id (str): ID of the chat you want to send the thinking indicator to.
965+
visibility (str): Possible values: `all`, `agents`.
966+
title (str): Title of the thinking indicator.
967+
description (str): Description of the thinking indicator.
968+
payload (dict): Custom payload to be used as request's data.
969+
It overrides all other parameters provided for the method.
970+
971+
Returns:
972+
RtmResponse: RTM response structure (`request_id`, `action`,
973+
`type`, `success` and `payload` properties)
974+
'''
975+
if payload is None:
976+
payload = prepare_payload(locals())
977+
return self.ws.send({
978+
'action': 'send_thinking_indicator',
979+
'payload': payload
980+
})
981+
955982
def multicast(self,
956983
recipients: dict = None,
957984
content: Any = None,

livechat/agent/web/api/v36.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,35 @@ def send_typing_indicator(self,
987987
json=payload,
988988
headers=headers)
989989

990+
def send_thinking_indicator(self,
991+
chat_id: str = None,
992+
title: str = None,
993+
description: str = None,
994+
visibility: str = None,
995+
payload: dict = None,
996+
headers: dict = None) -> httpx.Response:
997+
''' Sends thinking indicator.
998+
999+
Args:
1000+
chat_id (str): ID of the chat that to send the thinking indicator to.
1001+
title (str): Title of the thinking indicator.
1002+
description (str): Description of the thinking indicator.
1003+
visibility (str): Possible values: `all`, `agents`.
1004+
payload (dict): Custom payload to be used as request's data.
1005+
It overrides all other parameters provided for the method.
1006+
headers (dict): Custom headers to be used with session headers.
1007+
They will be merged with session-level values that are set,
1008+
however, these method-level parameters will not be persisted across requests.
1009+
1010+
Returns:
1011+
httpx.Response: The Response object from `httpx` library,
1012+
which contains a server’s response to an HTTP request. '''
1013+
if payload is None:
1014+
payload = prepare_payload(locals())
1015+
return self.session.post(f'{self.api_url}/send_thinking_indicator',
1016+
json=payload,
1017+
headers=headers)
1018+
9901019
def multicast(self,
9911020
recipients: dict = None,
9921021
content: typing.Any = None,

0 commit comments

Comments
 (0)