Skip to content

Me 566/message preview #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +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.
- New methods in agent-api v3.6: `send_thinking_indicator`, `send_message_preview`.

### Changed
- Improved websocket response collection + extended logging in the websocket client.
Expand Down
23 changes: 23 additions & 0 deletions livechat/agent/rtm/api/v36.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,29 @@ def send_thinking_indicator(self,
'payload': payload
})

def send_event_preview(self,
chat_id: str = None,
event: dict = None,
payload: dict = None) -> RtmResponse:
''' Sends an event preview.

Args:
chat_id (str): ID of the chat to send event preview to.
event (dict): Event object containing the event data.
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_event_preview',
'payload': payload
})

def multicast(self,
recipients: dict = None,
content: Any = None,
Expand Down
25 changes: 25 additions & 0 deletions livechat/agent/web/api/v36.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,31 @@ def send_thinking_indicator(self,
json=payload,
headers=headers)

def send_event_preview(self,
chat_id: str = None,
event: dict = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
''' Sends an event preview.

Args:
chat_id (str): ID of the chat to send event preview to.
event (dict): Event object containing the event data.
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_event_preview',
json=payload,
headers=headers)

def multicast(self,
recipients: dict = None,
content: typing.Any = None,
Expand Down