Skip to content

Commit 470cc86

Browse files
authored
Merge pull request #169 from livechat/ME-884/add-chat-summary-method
ME-884: Add new method in agent-api v36 and v36 - request_thread_summary
2 parents f106d70 + 6c63f3c commit 470cc86

File tree

5 files changed

+97
-0
lines changed

5 files changed

+97
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
99
- New methods in configuration-api v3.6 for greetings: `create_greeting`, `delete_greeting`, `get_greeting`, `update_greeting`, `list_greetings`.
1010
- New methods in agent-api v3.6: `send_thinking_indicator`, `send_message_preview`.
1111
- New methods in configuration-api v3.7 for canned responses: `create_canned_response`, `update_canned_response`, `list_canned_responses`, `delete_canned_response`.
12+
- New method `request_thread_summary` in agent-api v3.6 and v3.7.
1213

1314
### Changed
1415
- Config now points to v3.6 as a stable and 3.7 as a dev-preview version.

livechat/agent/rtm/api/v36.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,29 @@ def send_rich_message_postback(self,
404404
'payload': payload
405405
})
406406

407+
def request_thread_summary(self,
408+
chat_id: str = None,
409+
thread_id: str = None,
410+
payload: dict = None) -> RtmResponse:
411+
''' Requests a thread summary.
412+
413+
Args:
414+
chat_id (str): ID of the chat to request thread summary for.
415+
thread_id (str): ID of the thread to request summary for.
416+
payload (dict): Custom payload to be used as request's data.
417+
It overrides all other parameters provided for the method.
418+
419+
Returns:
420+
RtmResponse: RTM response structure (`request_id`, `action`,
421+
`type`, `success` and `payload` properties)
422+
'''
423+
if payload is None:
424+
payload = prepare_payload(locals())
425+
return self.ws.send({
426+
'action': 'request_thread_summary',
427+
'payload': payload
428+
})
429+
407430
# Properties
408431

409432
def update_chat_properties(self,

livechat/agent/rtm/api/v37.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,29 @@ def send_rich_message_postback(self,
404404
'payload': payload
405405
})
406406

407+
def request_thread_summary(self,
408+
chat_id: str = None,
409+
thread_id: str = None,
410+
payload: dict = None) -> RtmResponse:
411+
''' Requests a thread summary.
412+
413+
Args:
414+
chat_id (str): ID of the chat to request thread summary for.
415+
thread_id (str): ID of the thread to request summary for.
416+
payload (dict): Custom payload to be used as request's data.
417+
It overrides all other parameters provided for the method.
418+
419+
Returns:
420+
RtmResponse: RTM response structure (`request_id`, `action`,
421+
`type`, `success` and `payload` properties)
422+
'''
423+
if payload is None:
424+
payload = prepare_payload(locals())
425+
return self.ws.send({
426+
'action': 'request_thread_summary',
427+
'payload': payload
428+
})
429+
407430
# Properties
408431

409432
def update_chat_properties(self,

livechat/agent/web/api/v36.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,31 @@ def send_rich_message_postback(self,
483483
json=payload,
484484
headers=headers)
485485

486+
def request_thread_summary(self,
487+
chat_id: str = None,
488+
thread_id: str = None,
489+
payload: dict = None,
490+
headers: dict = None) -> httpx.Response:
491+
''' Requests a thread summary.
492+
493+
Args:
494+
chat_id (str): ID of the chat to request thread summary for.
495+
thread_id (str): ID of the thread to request summary for.
496+
payload (dict): Custom payload to be used as request's data.
497+
It overrides all other parameters provided for the method.
498+
headers (dict): Custom headers to be used with session headers.
499+
They will be merged with session-level values that are set,
500+
however, these method-level parameters will not be persisted across requests.
501+
502+
Returns:
503+
httpx.Response: The Response object from `httpx` library,
504+
which contains a server's response to an HTTP request. '''
505+
if payload is None:
506+
payload = prepare_payload(locals())
507+
return self.session.post(f'{self.api_url}/request_thread_summary',
508+
json=payload,
509+
headers=headers)
510+
486511
# Properties
487512

488513
def update_chat_properties(self,

livechat/agent/web/api/v37.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,31 @@ def send_rich_message_postback(self,
483483
json=payload,
484484
headers=headers)
485485

486+
def request_thread_summary(self,
487+
chat_id: str = None,
488+
thread_id: str = None,
489+
payload: dict = None,
490+
headers: dict = None) -> httpx.Response:
491+
''' Requests a thread summary.
492+
493+
Args:
494+
chat_id (str): ID of the chat to request thread summary for.
495+
thread_id (str): ID of the thread to request summary for.
496+
payload (dict): Custom payload to be used as request's data.
497+
It overrides all other parameters provided for the method.
498+
headers (dict): Custom headers to be used with session headers.
499+
They will be merged with session-level values that are set,
500+
however, these method-level parameters will not be persisted across requests.
501+
502+
Returns:
503+
httpx.Response: The Response object from `httpx` library,
504+
which contains a server's response to an HTTP request. '''
505+
if payload is None:
506+
payload = prepare_payload(locals())
507+
return self.session.post(f'{self.api_url}/request_thread_summary',
508+
json=payload,
509+
headers=headers)
510+
486511
# Properties
487512

488513
def update_chat_properties(self,

0 commit comments

Comments
 (0)