Module containing Agent RTM API client implementation for v3.4.
-
-
-Expand source code
-
-
''' Module containing Agent RTM API client implementation for v3.4. '''
-
-from typing import Any, Callable, Optional, Union
-
-from livechat.utils.helpers import prepare_payload
-from livechat.utils.structures import AccessToken, RtmResponse
-from livechat.utils.ws_client import WebsocketClient
-
-# pylint: disable=unused-argument, too-many-arguments, invalid-name, redefined-builtin
-
-
-class AgentRtmV34:
- ''' Agent RTM API Class containing methods in version 3.4. '''
- def __init__(
- self,
- url: str,
- header: Union[list, dict, Callable, None],
- ):
- self.ws = WebsocketClient(url=f'wss://{url}/v3.4/agent/rtm/ws',
- header=header)
-
- def open_connection(self,
- origin: dict = None,
- ping_timeout: Union[float, int] = 3,
- ping_interval: Union[float, int] = 5,
- ws_conn_timeout: Union[float, int] = 10,
- keep_alive: bool = True,
- response_timeout: Union[float, int] = 3) -> None:
- ''' Opens WebSocket connection.
-
- Args:
- origin (dict): Specifies origin while creating websocket connection.
- ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
- by default sets to 3 seconds.
- ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
- If set to 0, no ping is sent periodically, by default sets to 5 seconds.
- ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
- by default sets to 10 seconds.
- keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
- response_timeout (int or float): timeout (in seconds) to wait for the response,
- by default sets to 3 seconds.
- '''
- self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
- keep_alive, response_timeout)
-
- def close_connection(self) -> None:
- ''' Closes WebSocket connection. '''
- self.ws.close()
-
- # Chats
-
- def list_chats(self,
- filters: dict = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
-
- Args:
- filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
- Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
- creation date of its last thread.
- limit (int): Chats limit per page. Default: 10, maximum: 100.
- page_id (str): Page ID.
- 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': 'list_chats', 'payload': payload})
-
- def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- min_events_count: int = None,
- filters: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns threads that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): Chat ID to get threads from.
- sort_order (str): Possible values: asc - oldest threads first and desc -
- newest threads first (default).
- limit (int): Default: 3, maximum: 100.
- page_id (str): Page ID.
- min_events_count (int): Range: 1-100; Specifies the minimum number of
- events to be returned in the response.
- filters (dict): Filters object.
- 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': 'list_threads', 'payload': payload})
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a thread that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
- 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': 'get_chat', 'payload': payload})
-
- def list_archives(self,
- filters: dict = None,
- page_id: str = None,
- sort_order: str = None,
- limit: int = None,
- highlights: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a list of the chats an Agent has access to.
-
- Args:
- filters (dict): Filters object.
- page_id (str): Page ID.
- sort_order (str): Possible values: asc - oldest threads first and desc -
- newest threads first (default).
- limit (int): Default: 10, minimum: 1, maximum: 100.
- highlights (dict): Use it to highlight the match of filters.query.
- To enable highlights with default parameters, pass an empty object.
- 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': 'list_archives', 'payload': payload})
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Starts a chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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': 'start_chat', 'payload': payload})
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Sets a chat to the continuous mode. When unset, leaves the mode unchanged.
- 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': 'resume_chat', 'payload': payload})
-
- def deactivate_chat(self,
- id: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Deactivates a chat by closing the currently open thread.
-
- Args:
- id (str): Chat ID to deactivate.
- ignore_requester_presence (bool): If `True`, allows requester to deactivate chat
- without being present in the chat's users list.
- 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': 'deactivate_chat', 'payload': payload})
-
- def follow_chat(self, id: str = None, payload: dict = None) -> RtmResponse:
- ''' Marks a chat as followed.
-
- Args:
- id (str): Chat ID to follow.
- 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': 'follow_chat', 'payload': payload})
-
- def unfollow_chat(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the requester from the chat followers.
-
- Args:
- id (str): Chat ID to unfollow.
- 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': 'unfollow_chat', 'payload': payload})
-
-# Chat access
-
- def transfer_chat(self,
- id: str = None,
- target: dict = None,
- ignore_agents_availability: bool = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Transfers a chat to an agent or a group.
-
- Args:
- id (str): Chat ID.
- target (dict): Target object. If missing, the chat will be
- transferred within the current group.
- ignore_agents_availability (bool): If `True`, always transfers chats. Otherwise, fails
- when unable to assign any agent from the requested groups.
- ignore_requester_presence (bool): If `True`, allows requester to transfer chat
- without being present in the chat's users list.
- 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': 'transfer_chat', 'payload': payload})
-
-# Chat users
-
- def add_user_to_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- visibility: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Adds a user to the chat. You can't add more than
- one customer user type to the chat.
-
- Args:
- chat_id (str): Chat ID.
- user_id (str): ID of the user that will be added to the chat.
- user_type (str): Possible values: agent or customer.
- visibility (str): Determines the visibility of events sent by
- the agent. Possible values: `all` or `agents`.
- ignore_requester_presence (bool): If `True`, allows requester to add user to chat
- without being present in the chat's users list.
- 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': 'add_user_to_chat', 'payload': payload})
-
- def remove_user_from_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes a user from chat.
-
- Args:
- chat_id (str): Chat ID.
- user_id (str): ID of the user that will be added to the chat.
- user_type (str): Possible values: agent or customer.
- ignore_requester_presence (bool): If `True`, allows requester to remove user from chat
- without being present in the chat's users list.
- 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': 'remove_user_from_chat',
- 'payload': payload
- })
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- author_id: Optional[str] = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends an Event object.
-
- Args:
- chat_id (str): ID of the chat you want to send the message to.
- event (dict): Event object.
- attach_to_last_thread (bool): Flag which states if event object should be added to last thread.
- The flag is ignored for active chats.
- author_id (optional str): Provide if the event should be sent on behalf of a bot.
- 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)
- '''
- opts = {}
- if author_id:
- opts['author_id'] = author_id
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({
- 'action': 'send_event',
- 'payload': payload,
- **opts
- })
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- postback: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send a rich message to.
- thread_id (str): ID of the thread.
- event_id (str): ID of the event.
- postback (dict): Postback object.
- 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_rich_message_postback',
- 'payload': payload
- })
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- 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': 'update_chat_properties',
- 'payload': payload
- })
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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': 'delete_chat_properties',
- 'payload': payload
- })
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_thread_properties',
- 'payload': payload
- })
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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': 'delete_thread_properties',
- 'payload': payload
- })
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_event_properties',
- 'payload': payload
- })
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- event_id (str): ID of the event you want to delete the properties of.
- properties (dict): Event properties to delete.
- 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': 'delete_event_properties',
- 'payload': payload
- })
-
-# Thread tags
-
- def tag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Tags thread.
-
- Args:
- chat_id (str): ID of the chat you want to add a tag to.
- thread_id (str): ID of the thread you want to add a tag to.
- tag (str): Tag name.
- 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': 'tag_thread', 'payload': payload})
-
- def untag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Untags thread.
-
- Args:
- chat_id (str): ID of the chat you want to remove a tag from.
- thread_id (str): ID of the thread you want to remove a tag from.
- tag (str): Tag name.
- 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': 'untag_thread', 'payload': payload})
-
-# Customers
-
- def get_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the info about the Customer with a given ID.
-
- Args:
- id (str): ID of the Customer.
- 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': 'get_customer', 'payload': payload})
-
- def list_customers(self,
- page_id: str = None,
- limit: int = None,
- sort_order: str = None,
- sort_by: str = None,
- filters: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the list of Customers.
-
- Args:
- page_id (str): Page ID.
- limit (int): Customers limit. Default: 10, maximum: 100.
- sort_order (str): Possible values: asc, desc (default). Customers are sorted
- by the creation date.
- sort_by (str): Possible values: created_at (default), threads_count, visits_count,
- agent_last_event or customer_last_event.
- filters (dict): Filters object.
- 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': 'list_customers', 'payload': payload})
-
- def create_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Creates a new Customer user type.
-
- Args:
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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': 'create_customer', 'payload': payload})
-
- def update_customer(self,
- id: str = None,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates Customer's properties.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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': 'update_customer', 'payload': payload})
-
- def ban_customer(self,
- id: str = None,
- ban: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Bans the customer for a specific period of time.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- ban (dict): Ban object containing the number of days that
- the Customer will be banned.
- 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': 'ban_customer', 'payload': payload})
-
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
-# Status
-
- def login(self,
- token: Union[AccessToken, str] = None,
- timezone: str = None,
- reconnect: bool = None,
- push_notifications: dict = None,
- application: dict = None,
- away: bool = None,
- customer_monitoring_level: str = None,
- pushes: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Logs in agent.
-
- Args:
- token (str): OAuth token from the Agent's account.
- timezone (str): Agent's timezone.
- reconnect (bool): Reconnecting sets the status to the
- last known state instead of the default one.
- push_notifications (dict): Push notifications for the requested token.
- application (dict): Object containing information related to
- the application's name and version.
- away (bool): When True, the connection is set to the away state.
- Defaults to False.
- customer_monitoring_level (str): Possible values are: `my`, `chatting`, `invited`, `online` and `highest_available`.
- Defaults to my if login creates the first session;
- otherwise it preserves the current customer_monitoring_level.
- pushes (dict): Use case: when you want to receive only specific pushes.
- By default, it's set to all for the version of your currently established RTM connection.
- 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 token:
- token = str(token)
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({'action': 'login', 'payload': payload})
-
- def change_push_notifications(self,
- firebase_token: str = None,
- platform: str = None,
- enabled: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Changes the firebase push notifications properties.
-
- Args:
- firebase_token (str): Firebase device token.
- platform (str): OS platform. Possible values: ios, android.
- enabled (bool): Enable or disable push notifications for the requested token.
- 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': 'change_push_notifications',
- 'payload': payload
- })
-
- def set_routing_status(self,
- status: str = None,
- agent_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Changes the status of an Agent or a Bot Agent.
-
- Args:
- status (str): For Agents: accepting_chats or not_accepting_chats.
- For Bot Agents: accepting_chats, not_accepting_chats, or offline.
- agent_id (str): If not specified, the requester's status will be updated.
- 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': 'set_routing_status',
- 'payload': payload
- })
-
- def set_away_status(self,
- away: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sets an Agent's connection to the away state.
-
- Args:
- away (bool): A flag.
- 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': 'set_away_status', 'payload': payload})
-
- def logout(self, payload: dict = None) -> RtmResponse:
- ''' Logs out agent.
-
- 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': 'logout',
- 'payload': {} if payload is None else payload
- })
-
- def list_routing_statuses(self,
- filters: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the current routing status of each agent selected by the provided filters.
-
- Args:
- filters (dict): Filters object.
- 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': 'list_routing_statuses',
- 'payload': payload
- })
-
-
-# Other
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks events as seen by agent.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format.
- 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': 'mark_events_as_seen',
- 'payload': payload
- })
-
- def send_typing_indicator(self,
- chat_id: str = None,
- visibility: str = None,
- is_typing: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a typing indicator.
-
- Args:
- chat_id (str): ID of the chat you want to send the typing indicator to.
- visibility (str): Possible values: `all`, `agents`.
- is_typing (bool): A flag that indicates if you are typing.
- 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_typing_indicator',
- 'payload': payload
- })
-
- def multicast(self,
- recipients: dict = None,
- content: Any = None,
- type: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a multicast (chat-unrelated communication).
-
- Args:
- recipients (object): Object containing filters related to multicast recipients.
- content (typing.Any): A JSON message to be sent.
- type (str): Multicast message type.
- 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': 'multicast', 'payload': payload})
-
- def list_agents_for_transfer(self,
- chat_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the list of Agents you can transfer a chat to.
-
- Args:
- chat_id (str): ID of the chat you want to transfer.
- 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': 'list_agents_for_transfer',
- 'payload': payload
- })
Agent RTM API Class containing methods in version 3.4.
-
-
-Expand source code
-
-
class AgentRtmV34:
- ''' Agent RTM API Class containing methods in version 3.4. '''
- def __init__(
- self,
- url: str,
- header: Union[list, dict, Callable, None],
- ):
- self.ws = WebsocketClient(url=f'wss://{url}/v3.4/agent/rtm/ws',
- header=header)
-
- def open_connection(self,
- origin: dict = None,
- ping_timeout: Union[float, int] = 3,
- ping_interval: Union[float, int] = 5,
- ws_conn_timeout: Union[float, int] = 10,
- keep_alive: bool = True,
- response_timeout: Union[float, int] = 3) -> None:
- ''' Opens WebSocket connection.
-
- Args:
- origin (dict): Specifies origin while creating websocket connection.
- ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
- by default sets to 3 seconds.
- ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
- If set to 0, no ping is sent periodically, by default sets to 5 seconds.
- ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
- by default sets to 10 seconds.
- keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
- response_timeout (int or float): timeout (in seconds) to wait for the response,
- by default sets to 3 seconds.
- '''
- self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
- keep_alive, response_timeout)
-
- def close_connection(self) -> None:
- ''' Closes WebSocket connection. '''
- self.ws.close()
-
- # Chats
-
- def list_chats(self,
- filters: dict = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
-
- Args:
- filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
- Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
- creation date of its last thread.
- limit (int): Chats limit per page. Default: 10, maximum: 100.
- page_id (str): Page ID.
- 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': 'list_chats', 'payload': payload})
-
- def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- min_events_count: int = None,
- filters: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns threads that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): Chat ID to get threads from.
- sort_order (str): Possible values: asc - oldest threads first and desc -
- newest threads first (default).
- limit (int): Default: 3, maximum: 100.
- page_id (str): Page ID.
- min_events_count (int): Range: 1-100; Specifies the minimum number of
- events to be returned in the response.
- filters (dict): Filters object.
- 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': 'list_threads', 'payload': payload})
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a thread that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
- 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': 'get_chat', 'payload': payload})
-
- def list_archives(self,
- filters: dict = None,
- page_id: str = None,
- sort_order: str = None,
- limit: int = None,
- highlights: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a list of the chats an Agent has access to.
-
- Args:
- filters (dict): Filters object.
- page_id (str): Page ID.
- sort_order (str): Possible values: asc - oldest threads first and desc -
- newest threads first (default).
- limit (int): Default: 10, minimum: 1, maximum: 100.
- highlights (dict): Use it to highlight the match of filters.query.
- To enable highlights with default parameters, pass an empty object.
- 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': 'list_archives', 'payload': payload})
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Starts a chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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': 'start_chat', 'payload': payload})
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Sets a chat to the continuous mode. When unset, leaves the mode unchanged.
- 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': 'resume_chat', 'payload': payload})
-
- def deactivate_chat(self,
- id: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Deactivates a chat by closing the currently open thread.
-
- Args:
- id (str): Chat ID to deactivate.
- ignore_requester_presence (bool): If `True`, allows requester to deactivate chat
- without being present in the chat's users list.
- 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': 'deactivate_chat', 'payload': payload})
-
- def follow_chat(self, id: str = None, payload: dict = None) -> RtmResponse:
- ''' Marks a chat as followed.
-
- Args:
- id (str): Chat ID to follow.
- 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': 'follow_chat', 'payload': payload})
-
- def unfollow_chat(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the requester from the chat followers.
-
- Args:
- id (str): Chat ID to unfollow.
- 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': 'unfollow_chat', 'payload': payload})
-
-# Chat access
-
- def transfer_chat(self,
- id: str = None,
- target: dict = None,
- ignore_agents_availability: bool = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Transfers a chat to an agent or a group.
-
- Args:
- id (str): Chat ID.
- target (dict): Target object. If missing, the chat will be
- transferred within the current group.
- ignore_agents_availability (bool): If `True`, always transfers chats. Otherwise, fails
- when unable to assign any agent from the requested groups.
- ignore_requester_presence (bool): If `True`, allows requester to transfer chat
- without being present in the chat's users list.
- 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': 'transfer_chat', 'payload': payload})
-
-# Chat users
-
- def add_user_to_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- visibility: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Adds a user to the chat. You can't add more than
- one customer user type to the chat.
-
- Args:
- chat_id (str): Chat ID.
- user_id (str): ID of the user that will be added to the chat.
- user_type (str): Possible values: agent or customer.
- visibility (str): Determines the visibility of events sent by
- the agent. Possible values: `all` or `agents`.
- ignore_requester_presence (bool): If `True`, allows requester to add user to chat
- without being present in the chat's users list.
- 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': 'add_user_to_chat', 'payload': payload})
-
- def remove_user_from_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes a user from chat.
-
- Args:
- chat_id (str): Chat ID.
- user_id (str): ID of the user that will be added to the chat.
- user_type (str): Possible values: agent or customer.
- ignore_requester_presence (bool): If `True`, allows requester to remove user from chat
- without being present in the chat's users list.
- 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': 'remove_user_from_chat',
- 'payload': payload
- })
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- author_id: Optional[str] = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends an Event object.
-
- Args:
- chat_id (str): ID of the chat you want to send the message to.
- event (dict): Event object.
- attach_to_last_thread (bool): Flag which states if event object should be added to last thread.
- The flag is ignored for active chats.
- author_id (optional str): Provide if the event should be sent on behalf of a bot.
- 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)
- '''
- opts = {}
- if author_id:
- opts['author_id'] = author_id
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({
- 'action': 'send_event',
- 'payload': payload,
- **opts
- })
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- postback: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send a rich message to.
- thread_id (str): ID of the thread.
- event_id (str): ID of the event.
- postback (dict): Postback object.
- 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_rich_message_postback',
- 'payload': payload
- })
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- 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': 'update_chat_properties',
- 'payload': payload
- })
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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': 'delete_chat_properties',
- 'payload': payload
- })
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_thread_properties',
- 'payload': payload
- })
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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': 'delete_thread_properties',
- 'payload': payload
- })
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_event_properties',
- 'payload': payload
- })
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- event_id (str): ID of the event you want to delete the properties of.
- properties (dict): Event properties to delete.
- 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': 'delete_event_properties',
- 'payload': payload
- })
-
-# Thread tags
-
- def tag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Tags thread.
-
- Args:
- chat_id (str): ID of the chat you want to add a tag to.
- thread_id (str): ID of the thread you want to add a tag to.
- tag (str): Tag name.
- 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': 'tag_thread', 'payload': payload})
-
- def untag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Untags thread.
-
- Args:
- chat_id (str): ID of the chat you want to remove a tag from.
- thread_id (str): ID of the thread you want to remove a tag from.
- tag (str): Tag name.
- 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': 'untag_thread', 'payload': payload})
-
-# Customers
-
- def get_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the info about the Customer with a given ID.
-
- Args:
- id (str): ID of the Customer.
- 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': 'get_customer', 'payload': payload})
-
- def list_customers(self,
- page_id: str = None,
- limit: int = None,
- sort_order: str = None,
- sort_by: str = None,
- filters: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the list of Customers.
-
- Args:
- page_id (str): Page ID.
- limit (int): Customers limit. Default: 10, maximum: 100.
- sort_order (str): Possible values: asc, desc (default). Customers are sorted
- by the creation date.
- sort_by (str): Possible values: created_at (default), threads_count, visits_count,
- agent_last_event or customer_last_event.
- filters (dict): Filters object.
- 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': 'list_customers', 'payload': payload})
-
- def create_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Creates a new Customer user type.
-
- Args:
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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': 'create_customer', 'payload': payload})
-
- def update_customer(self,
- id: str = None,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates Customer's properties.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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': 'update_customer', 'payload': payload})
-
- def ban_customer(self,
- id: str = None,
- ban: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Bans the customer for a specific period of time.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- ban (dict): Ban object containing the number of days that
- the Customer will be banned.
- 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': 'ban_customer', 'payload': payload})
-
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
-# Status
-
- def login(self,
- token: Union[AccessToken, str] = None,
- timezone: str = None,
- reconnect: bool = None,
- push_notifications: dict = None,
- application: dict = None,
- away: bool = None,
- customer_monitoring_level: str = None,
- pushes: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Logs in agent.
-
- Args:
- token (str): OAuth token from the Agent's account.
- timezone (str): Agent's timezone.
- reconnect (bool): Reconnecting sets the status to the
- last known state instead of the default one.
- push_notifications (dict): Push notifications for the requested token.
- application (dict): Object containing information related to
- the application's name and version.
- away (bool): When True, the connection is set to the away state.
- Defaults to False.
- customer_monitoring_level (str): Possible values are: `my`, `chatting`, `invited`, `online` and `highest_available`.
- Defaults to my if login creates the first session;
- otherwise it preserves the current customer_monitoring_level.
- pushes (dict): Use case: when you want to receive only specific pushes.
- By default, it's set to all for the version of your currently established RTM connection.
- 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 token:
- token = str(token)
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({'action': 'login', 'payload': payload})
-
- def change_push_notifications(self,
- firebase_token: str = None,
- platform: str = None,
- enabled: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Changes the firebase push notifications properties.
-
- Args:
- firebase_token (str): Firebase device token.
- platform (str): OS platform. Possible values: ios, android.
- enabled (bool): Enable or disable push notifications for the requested token.
- 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': 'change_push_notifications',
- 'payload': payload
- })
-
- def set_routing_status(self,
- status: str = None,
- agent_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Changes the status of an Agent or a Bot Agent.
-
- Args:
- status (str): For Agents: accepting_chats or not_accepting_chats.
- For Bot Agents: accepting_chats, not_accepting_chats, or offline.
- agent_id (str): If not specified, the requester's status will be updated.
- 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': 'set_routing_status',
- 'payload': payload
- })
-
- def set_away_status(self,
- away: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sets an Agent's connection to the away state.
-
- Args:
- away (bool): A flag.
- 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': 'set_away_status', 'payload': payload})
-
- def logout(self, payload: dict = None) -> RtmResponse:
- ''' Logs out agent.
-
- 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': 'logout',
- 'payload': {} if payload is None else payload
- })
-
- def list_routing_statuses(self,
- filters: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the current routing status of each agent selected by the provided filters.
-
- Args:
- filters (dict): Filters object.
- 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': 'list_routing_statuses',
- 'payload': payload
- })
-
-
-# Other
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks events as seen by agent.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format.
- 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': 'mark_events_as_seen',
- 'payload': payload
- })
-
- def send_typing_indicator(self,
- chat_id: str = None,
- visibility: str = None,
- is_typing: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a typing indicator.
-
- Args:
- chat_id (str): ID of the chat you want to send the typing indicator to.
- visibility (str): Possible values: `all`, `agents`.
- is_typing (bool): A flag that indicates if you are typing.
- 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_typing_indicator',
- 'payload': payload
- })
-
- def multicast(self,
- recipients: dict = None,
- content: Any = None,
- type: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a multicast (chat-unrelated communication).
-
- Args:
- recipients (object): Object containing filters related to multicast recipients.
- content (typing.Any): A JSON message to be sent.
- type (str): Multicast message type.
- 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': 'multicast', 'payload': payload})
-
- def list_agents_for_transfer(self,
- chat_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the list of Agents you can transfer a chat to.
-
- Args:
- chat_id (str): ID of the chat you want to transfer.
- 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': 'list_agents_for_transfer',
- 'payload': payload
- })
Adds a user to the chat. You can't add more than
-one customer user type to the chat.
-
Args
-
-
chat_id : str
-
Chat ID.
-
user_id : str
-
ID of the user that will be added to the chat.
-
user_type : str
-
Possible values: agent or customer.
-
visibility : str
-
Determines the visibility of events sent by
-the agent. Possible values: all or agents.
-
ignore_requester_presence : bool
-
If True, allows requester to add user to chat
-without being present in the chat's users list.
-
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)
-
-
-
-Expand source code
-
-
def add_user_to_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- visibility: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Adds a user to the chat. You can't add more than
- one customer user type to the chat.
-
- Args:
- chat_id (str): Chat ID.
- user_id (str): ID of the user that will be added to the chat.
- user_type (str): Possible values: agent or customer.
- visibility (str): Determines the visibility of events sent by
- the agent. Possible values: `all` or `agents`.
- ignore_requester_presence (bool): If `True`, allows requester to add user to chat
- without being present in the chat's users list.
- 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': 'add_user_to_chat', 'payload': payload})
Ban object containing the number of days that
-the Customer will be banned.
-
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)
-
-
-
-Expand source code
-
-
def ban_customer(self,
- id: str = None,
- ban: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Bans the customer for a specific period of time.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- ban (dict): Ban object containing the number of days that
- the Customer will be banned.
- 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': 'ban_customer', 'payload': payload})
Deactivates a chat by closing the currently open thread.
-
Args
-
-
id : str
-
Chat ID to deactivate.
-
ignore_requester_presence : bool
-
If True, allows requester to deactivate chat
-without being present in the chat's users list.
-
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)
-
-
-
-Expand source code
-
-
def deactivate_chat(self,
- id: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Deactivates a chat by closing the currently open thread.
-
- Args:
- id (str): Chat ID to deactivate.
- ignore_requester_presence (bool): If `True`, allows requester to deactivate chat
- without being present in the chat's users list.
- 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': 'deactivate_chat', 'payload': payload})
ID of the chat you want to delete the properties of.
-
thread_id : str
-
ID of the thread you want to delete the properties of.
-
event_id : str
-
ID of the event you want to delete the properties of.
-
properties : dict
-
Event properties to delete.
-
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)
-
-
-
-Expand source code
-
-
def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- event_id (str): ID of the event you want to delete the properties of.
- properties (dict): Event properties to delete.
- 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': 'delete_event_properties',
- 'payload': payload
- })
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)
-
-
-
-Expand source code
-
-
def follow_chat(self, id: str = None, payload: dict = None) -> RtmResponse:
- ''' Marks a chat as followed.
-
- Args:
- id (str): Chat ID to follow.
- 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': 'follow_chat', 'payload': payload})
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)
-
-
-
-Expand source code
-
-
def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
Returns a thread that the current Agent has access to in a given chat.
-
Args
-
-
chat_id : str
-
ID of a chat to get.
-
thread_id : str
-
Thread ID to get. Default: the latest thread (if exists).
-
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)
-
-
-
-Expand source code
-
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a thread that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
- 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': 'get_chat', 'payload': payload})
Returns the info about the Customer with a given ID.
-
Args
-
-
id : str
-
ID of the Customer.
-
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)
-
-
-
-Expand source code
-
-
def get_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the info about the Customer with a given ID.
-
- Args:
- id (str): ID of the Customer.
- 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': 'get_customer', 'payload': payload})
Returns the list of Agents you can transfer a chat to.
-
Args
-
-
chat_id : str
-
ID of the chat you want to transfer.
-
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)
-
-
-
-Expand source code
-
-
def list_agents_for_transfer(self,
- chat_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the list of Agents you can transfer a chat to.
-
- Args:
- chat_id (str): ID of the chat you want to transfer.
- 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': 'list_agents_for_transfer',
- 'payload': payload
- })
Returns a list of the chats an Agent has access to.
-
Args
-
-
filters : dict
-
Filters object.
-
page_id : str
-
Page ID.
-
sort_order : str
-
Possible values: asc - oldest threads first and desc -
-newest threads first (default).
-
limit : int
-
Default: 10, minimum: 1, maximum: 100.
-
highlights : dict
-
Use it to highlight the match of filters.query.
-To enable highlights with default parameters, pass an empty object.
-
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)
-
-
-
-Expand source code
-
-
def list_archives(self,
- filters: dict = None,
- page_id: str = None,
- sort_order: str = None,
- limit: int = None,
- highlights: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a list of the chats an Agent has access to.
-
- Args:
- filters (dict): Filters object.
- page_id (str): Page ID.
- sort_order (str): Possible values: asc - oldest threads first and desc -
- newest threads first (default).
- limit (int): Default: 10, minimum: 1, maximum: 100.
- highlights (dict): Use it to highlight the match of filters.query.
- To enable highlights with default parameters, pass an empty object.
- 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': 'list_archives', 'payload': payload})
Returns summaries of the chats an Agent has access to.
-
Args
-
-
filters : dict
-
Possible request filters. Mustn't change between requests for subsequent pages.
-Otherwise, the behavior is undefined.
-
sort_order : str
-
Possible values: asc, desc (default). Chat summaries are sorted by the
-creation date of its last thread.
-
limit : int
-
Chats limit per page. Default: 10, maximum: 100.
-
page_id : str
-
Page ID.
-
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)
-
-
-
-Expand source code
-
-
def list_chats(self,
- filters: dict = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
-
- Args:
- filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
- Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
- creation date of its last thread.
- limit (int): Chats limit per page. Default: 10, maximum: 100.
- page_id (str): Page ID.
- 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': 'list_chats', 'payload': payload})
Returns threads that the current Agent has access to in a given chat.
-
Args
-
-
chat_id : str
-
Chat ID to get threads from.
-
sort_order : str
-
Possible values: asc - oldest threads first and desc -
-newest threads first (default).
-
limit : int
-
Default: 3, maximum: 100.
-
page_id : str
-
Page ID.
-
min_events_count : int
-
Range: 1-100; Specifies the minimum number of
-events to be returned in the response.
-
filters : dict
-
Filters object.
-
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)
-
-
-
-Expand source code
-
-
def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- min_events_count: int = None,
- filters: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns threads that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): Chat ID to get threads from.
- sort_order (str): Possible values: asc - oldest threads first and desc -
- newest threads first (default).
- limit (int): Default: 3, maximum: 100.
- page_id (str): Page ID.
- min_events_count (int): Range: 1-100; Specifies the minimum number of
- events to be returned in the response.
- filters (dict): Filters object.
- 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': 'list_threads', 'payload': payload})
Reconnecting sets the status to the
-last known state instead of the default one.
-
push_notifications : dict
-
Push notifications for the requested token.
-
application : dict
-
Object containing information related to
-the application's name and version.
-
away : bool
-
When True, the connection is set to the away state.
-Defaults to False.
-
customer_monitoring_level : str
-
Possible values are: my, chatting, invited, online and highest_available.
-Defaults to my if login creates the first session;
-otherwise it preserves the current customer_monitoring_level.
-
pushes : dict
-
Use case: when you want to receive only specific pushes.
-
By default, it's set to all for the version of your currently established RTM connection.
-
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)
-
-
-
-Expand source code
-
-
def login(self,
- token: Union[AccessToken, str] = None,
- timezone: str = None,
- reconnect: bool = None,
- push_notifications: dict = None,
- application: dict = None,
- away: bool = None,
- customer_monitoring_level: str = None,
- pushes: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Logs in agent.
-
- Args:
- token (str): OAuth token from the Agent's account.
- timezone (str): Agent's timezone.
- reconnect (bool): Reconnecting sets the status to the
- last known state instead of the default one.
- push_notifications (dict): Push notifications for the requested token.
- application (dict): Object containing information related to
- the application's name and version.
- away (bool): When True, the connection is set to the away state.
- Defaults to False.
- customer_monitoring_level (str): Possible values are: `my`, `chatting`, `invited`, `online` and `highest_available`.
- Defaults to my if login creates the first session;
- otherwise it preserves the current customer_monitoring_level.
- pushes (dict): Use case: when you want to receive only specific pushes.
- By default, it's set to all for the version of your currently established RTM connection.
- 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 token:
- token = str(token)
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({'action': 'login', 'payload': payload})
Date up to which mark events - RFC 3339 date-time format.
-
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)
-
-
-
-Expand source code
-
-
def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks events as seen by agent.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format.
- 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': 'mark_events_as_seen',
- 'payload': payload
- })
Specifies origin while creating websocket connection.
-
ping_timeout : int or float
-
timeout (in seconds) if the pong message is not received,
-by default sets to 3 seconds.
-
ping_interval : int or float
-
automatically sends "ping" command every specified period (in seconds).
-If set to 0, no ping is sent periodically, by default sets to 5 seconds.
-
ws_conn_timeout : int or float
-
timeout (in seconds) to wait for WebSocket connection,
-by default sets to 10 seconds.
-
keep_alive(bool): Bool which states if connection should be kept, by default sets to True.
-
response_timeout : int or float
-
timeout (in seconds) to wait for the response,
-by default sets to 3 seconds.
-
-
-
-Expand source code
-
-
def open_connection(self,
- origin: dict = None,
- ping_timeout: Union[float, int] = 3,
- ping_interval: Union[float, int] = 5,
- ws_conn_timeout: Union[float, int] = 10,
- keep_alive: bool = True,
- response_timeout: Union[float, int] = 3) -> None:
- ''' Opens WebSocket connection.
-
- Args:
- origin (dict): Specifies origin while creating websocket connection.
- ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
- by default sets to 3 seconds.
- ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
- If set to 0, no ping is sent periodically, by default sets to 5 seconds.
- ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
- by default sets to 10 seconds.
- keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
- response_timeout (int or float): timeout (in seconds) to wait for the response,
- by default sets to 3 seconds.
- '''
- self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
- keep_alive, response_timeout)
If True, allows requester to remove user from chat
-without being present in the chat's users list.
-
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)
-
-
-
-Expand source code
-
-
def remove_user_from_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes a user from chat.
-
- Args:
- chat_id (str): Chat ID.
- user_id (str): ID of the user that will be added to the chat.
- user_type (str): Possible values: agent or customer.
- ignore_requester_presence (bool): If `True`, allows requester to remove user from chat
- without being present in the chat's users list.
- 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': 'remove_user_from_chat',
- 'payload': payload
- })
Flag which states if event object should be added to last thread.
-The flag is ignored for active chats.
-
author_id : optional str
-
Provide if the event should be sent on behalf of a bot.
-
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)
-
-
-
-Expand source code
-
-
def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- author_id: Optional[str] = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends an Event object.
-
- Args:
- chat_id (str): ID of the chat you want to send the message to.
- event (dict): Event object.
- attach_to_last_thread (bool): Flag which states if event object should be added to last thread.
- The flag is ignored for active chats.
- author_id (optional str): Provide if the event should be sent on behalf of a bot.
- 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)
- '''
- opts = {}
- if author_id:
- opts['author_id'] = author_id
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({
- 'action': 'send_event',
- 'payload': payload,
- **opts
- })
ID of the chat you want to send the typing indicator to.
-
visibility : str
-
Possible values: all, agents.
-
is_typing : bool
-
A flag that indicates if you are typing.
-
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)
-
-
-
-Expand source code
-
-
def send_typing_indicator(self,
- chat_id: str = None,
- visibility: str = None,
- is_typing: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a typing indicator.
-
- Args:
- chat_id (str): ID of the chat you want to send the typing indicator to.
- visibility (str): Possible values: `all`, `agents`.
- is_typing (bool): A flag that indicates if you are typing.
- 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_typing_indicator',
- 'payload': payload
- })
For Agents: accepting_chats or not_accepting_chats.
-For Bot Agents: accepting_chats, not_accepting_chats, or offline.
-
agent_id : str
-
If not specified, the requester's status will be updated.
-
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)
-
-
-
-Expand source code
-
-
def set_routing_status(self,
- status: str = None,
- agent_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Changes the status of an Agent or a Bot Agent.
-
- Args:
- status (str): For Agents: accepting_chats or not_accepting_chats.
- For Bot Agents: accepting_chats, not_accepting_chats, or offline.
- agent_id (str): If not specified, the requester's status will be updated.
- 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': 'set_routing_status',
- 'payload': payload
- })
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)
-
-
-
-Expand source code
-
-
def tag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Tags thread.
-
- Args:
- chat_id (str): ID of the chat you want to add a tag to.
- thread_id (str): ID of the thread you want to add a tag to.
- tag (str): Tag name.
- 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': 'tag_thread', 'payload': payload})
Target object. If missing, the chat will be
-transferred within the current group.
-
ignore_agents_availability : bool
-
If True, always transfers chats. Otherwise, fails
-when unable to assign any agent from the requested groups.
-
ignore_requester_presence : bool
-
If True, allows requester to transfer chat
-without being present in the chat's users list.
-
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)
-
-
-
-Expand source code
-
-
def transfer_chat(self,
- id: str = None,
- target: dict = None,
- ignore_agents_availability: bool = None,
- ignore_requester_presence: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Transfers a chat to an agent or a group.
-
- Args:
- id (str): Chat ID.
- target (dict): Target object. If missing, the chat will be
- transferred within the current group.
- ignore_agents_availability (bool): If `True`, always transfers chats. Otherwise, fails
- when unable to assign any agent from the requested groups.
- ignore_requester_presence (bool): If `True`, allows requester to transfer chat
- without being present in the chat's users list.
- 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': 'transfer_chat', 'payload': payload})
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)
-
-
-
-Expand source code
-
-
def unfollow_chat(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the requester from the chat followers.
-
- Args:
- id (str): Chat ID to unfollow.
- 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': 'unfollow_chat', 'payload': payload})
Removes the agent from the list of customer's followers.
-
Args
-
-
id : str
-
ID of the Customer. UUID v4 format is required.
-
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)
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
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)
-
-
-
-Expand source code
-
-
def untag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Untags thread.
-
- Args:
- chat_id (str): ID of the chat you want to remove a tag from.
- thread_id (str): ID of the thread you want to remove a tag from.
- tag (str): Tag name.
- 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': 'untag_thread', 'payload': payload})
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)
-
-
-
-Expand source code
-
-
def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_event_properties',
- 'payload': payload
- })
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)
-
-
-
-Expand source code
-
-
def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_thread_properties',
- 'payload': payload
- })
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/agent/rtm/api/v35.html b/docs/agent/rtm/api/v35.html
index f6ce342..71d64a8 100644
--- a/docs/agent/rtm/api/v35.html
+++ b/docs/agent/rtm/api/v35.html
@@ -750,45 +750,6 @@
Module livechat.agent.rtm.api.v35
payload = prepare_payload(locals())
return self.ws.send({'action': 'ban_customer', 'payload': payload})
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
# Status
def login(self,
@@ -1041,7 +1002,7 @@
Agent RTM API Class containing methods in version 3.5.
@@ -1761,45 +1722,6 @@
Classes
payload = prepare_payload(locals())
return self.ws.send({'action': 'ban_customer', 'payload': payload})
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
# Status
def login(self,
@@ -2526,48 +2448,6 @@
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)
-
-
-
-Expand source code
-
-
def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
Removes the agent from the list of customer's followers.
-
Args
-
-
id : str
-
ID of the Customer. UUID v4 format is required.
-
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)
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
limit: int = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit (int): Chats limit per page. Default: 10, maximum: 100.
page_id (str): Page ID.
@@ -456,6 +456,29 @@
Module livechat.agent.rtm.api.v36
'payload': payload
})
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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': 'get_thread_transcript',
+ 'payload': payload
+ })
+
# Properties
def update_chat_properties(self,
@@ -722,45 +745,6 @@
Module livechat.agent.rtm.api.v36
payload = prepare_payload(locals())
return self.ws.send({'action': 'ban_customer', 'payload': payload})
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
# Status
def login(self,
@@ -1086,7 +1070,7 @@
Agent RTM API Class containing methods in version 3.6.
@@ -1142,12 +1126,12 @@
Classes
limit: int = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit (int): Chats limit per page. Default: 10, maximum: 100.
page_id (str): Page ID.
@@ -1512,6 +1496,29 @@
Classes
'payload': payload
})
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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': 'get_thread_transcript',
+ 'payload': payload
+ })
+
# Properties
def update_chat_properties(self,
@@ -1778,45 +1785,6 @@
Classes
payload = prepare_payload(locals())
return self.ws.send({'action': 'ban_customer', 'payload': payload})
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
# Status
def login(self,
@@ -2560,15 +2528,17 @@
Returns a thread that the current Agent has access to in a given chat.
Args
-
id : str
-
ID of the Customer. UUID v4 format is required.
+
chat_id : str
+
ID of a chat to get.
+
thread_id : str
+
Thread ID to get. Default: the latest thread (if exists).
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2583,13 +2553,15 @@
Returns
Expand source code
-
def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
+
def get_chat(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a thread that the current Agent has access to in a given chat.
Args:
- id (str): ID of the Customer. UUID v4 format is required.
+ chat_id (str): ID of a chat to get.
+ thread_id (str): Thread ID to get. Default: the latest thread (if exists).
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2599,20 +2571,18 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.ws.send({'action': 'follow_customer', 'payload': payload})
Returns a thread that the current Agent has access to in a given chat.
+
Returns the info about the Customer with a given ID.
Args
-
chat_id : str
-
ID of a chat to get.
-
thread_id : str
-
Thread ID to get. Default: the latest thread (if exists).
+
id : str
+
ID of the Customer.
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2627,15 +2597,13 @@
Returns
Expand source code
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a thread that the current Agent has access to in a given chat.
+
def get_customer(self,
+ id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns the info about the Customer with a given ID.
Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
+ id (str): ID of the Customer.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2645,18 +2613,20 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.ws.send({'action': 'get_chat', 'payload': payload})
Returns the info about the Customer with a given ID.
+
Returns a plain-text transcript of a given thread.
Args
-
id : str
-
ID of the Customer.
+
chat_id : str
+
ID of the chat the thread belongs to.
+
thread_id : str
+
ID of the thread to return the transcript for.
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2671,13 +2641,15 @@
Returns
Expand source code
-
def get_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the info about the Customer with a given ID.
+
def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a plain-text transcript of a given thread.
Args:
- id (str): ID of the Customer.
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2687,7 +2659,10 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.ws.send({'action': 'get_customer', 'payload': payload})
Returns summaries of the chats an Agent has access to.
+
Returns chat info for the chats an Agent has access to.
Args
filters : dict
Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
sort_order : str
-
Possible values: asc, desc (default). Chat summaries are sorted by the
+
Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit : int
Chats limit per page. Default: 10, maximum: 100.
@@ -2834,12 +2809,12 @@
Returns
limit: int = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit (int): Chats limit per page. Default: 10, maximum: 100.
page_id (str): Page ID.
@@ -3979,51 +3954,6 @@
Removes the agent from the list of customer's followers.
-
Args
-
-
id : str
-
ID of the Customer. UUID v4 format is required.
-
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)
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
limit: int = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit (int): Chats limit per page. Default: 10, maximum: 100.
page_id (str): Page ID.
@@ -456,6 +456,29 @@
Module livechat.agent.rtm.api.v37
'payload': payload
})
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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': 'get_thread_transcript',
+ 'payload': payload
+ })
+
# Properties
def update_chat_properties(self,
@@ -722,45 +745,6 @@
Module livechat.agent.rtm.api.v37
payload = prepare_payload(locals())
return self.ws.send({'action': 'ban_customer', 'payload': payload})
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
# Status
def login(self,
@@ -1086,7 +1070,7 @@
Agent RTM API Class containing methods in version 3.7.
@@ -1142,12 +1126,12 @@
Classes
limit: int = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit (int): Chats limit per page. Default: 10, maximum: 100.
page_id (str): Page ID.
@@ -1512,6 +1496,29 @@
Classes
'payload': payload
})
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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': 'get_thread_transcript',
+ 'payload': payload
+ })
+
# Properties
def update_chat_properties(self,
@@ -1778,45 +1785,6 @@
Classes
payload = prepare_payload(locals())
return self.ws.send({'action': 'ban_customer', 'payload': payload})
- def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'follow_customer', 'payload': payload})
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
-
# Status
def login(self,
@@ -2560,15 +2528,17 @@
Returns a thread that the current Agent has access to in a given chat.
Args
-
id : str
-
ID of the Customer. UUID v4 format is required.
+
chat_id : str
+
ID of a chat to get.
+
thread_id : str
+
Thread ID to get. Default: the latest thread (if exists).
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2583,13 +2553,15 @@
Returns
Expand source code
-
def follow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks a customer as followed.
+
def get_chat(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a thread that the current Agent has access to in a given chat.
Args:
- id (str): ID of the Customer. UUID v4 format is required.
+ chat_id (str): ID of a chat to get.
+ thread_id (str): Thread ID to get. Default: the latest thread (if exists).
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2599,20 +2571,18 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.ws.send({'action': 'follow_customer', 'payload': payload})
Returns a thread that the current Agent has access to in a given chat.
+
Returns the info about the Customer with a given ID.
Args
-
chat_id : str
-
ID of a chat to get.
-
thread_id : str
-
Thread ID to get. Default: the latest thread (if exists).
+
id : str
+
ID of the Customer.
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2627,15 +2597,13 @@
Returns
Expand source code
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns a thread that the current Agent has access to in a given chat.
+
def get_customer(self,
+ id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns the info about the Customer with a given ID.
Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
+ id (str): ID of the Customer.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2645,18 +2613,20 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.ws.send({'action': 'get_chat', 'payload': payload})
Returns the info about the Customer with a given ID.
+
Returns a plain-text transcript of a given thread.
Args
-
id : str
-
ID of the Customer.
+
chat_id : str
+
ID of the chat the thread belongs to.
+
thread_id : str
+
ID of the thread to return the transcript for.
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2671,13 +2641,15 @@
Returns
Expand source code
-
def get_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns the info about the Customer with a given ID.
+
def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None) -> RtmResponse:
+ ''' Returns a plain-text transcript of a given thread.
Args:
- id (str): ID of the Customer.
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2687,7 +2659,10 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.ws.send({'action': 'get_customer', 'payload': payload})
Returns summaries of the chats an Agent has access to.
+
Returns chat info for the chats an Agent has access to.
Args
filters : dict
Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
sort_order : str
-
Possible values: asc, desc (default). Chat summaries are sorted by the
+
Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit : int
Chats limit per page. Default: 10, maximum: 100.
@@ -2834,12 +2809,12 @@
Returns
limit: int = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between requests for subsequent pages.
Otherwise, the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
limit (int): Chats limit per page. Default: 10, maximum: 100.
page_id (str): Page ID.
@@ -3979,51 +3954,6 @@
Removes the agent from the list of customer's followers.
-
Args
-
-
id : str
-
ID of the Customer. UUID v4 format is required.
-
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)
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Removes the agent from the list of customer's followers.
-
- Args:
- id (str): ID of the Customer. UUID v4 format is required.
- 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': 'unfollow_customer',
- 'payload': payload
- })
from typing import Callable, Union
-from livechat.agent.rtm.api.v34 import AgentRtmV34
from livechat.agent.rtm.api.v35 import AgentRtmV35
from livechat.agent.rtm.api.v36 import AgentRtmV36
from livechat.agent.rtm.api.v37 import AgentRtmV37
@@ -51,7 +50,7 @@
ValueError: If the specified version does not exist.
'''
client = {
- '3.4': AgentRtmV34,
'3.5': AgentRtmV35,
'3.6': AgentRtmV36,
'3.7': AgentRtmV37,
@@ -102,7 +100,7 @@
ValueError: If the specified version does not exist.
'''
client = {
- '3.4': AgentRtmV34,
'3.5': AgentRtmV35,
'3.6': AgentRtmV36,
'3.7': AgentRtmV37,
@@ -130,7 +127,7 @@
''' Agent Web client implementation for v3.4. '''
-
-# pylint: disable=W0613,R0913,W0622,C0103,W0221
-from __future__ import annotations
-
-import typing
-
-import httpx
-
-from livechat.utils.helpers import prepare_payload
-from livechat.utils.http_client import HttpClient
-from livechat.utils.structures import AccessToken
-
-# pylint: disable=R0903
-
-
-class AgentWebV34(HttpClient):
- ''' Agent Web API Class containing methods in version 3.4. '''
- def __init__(self,
- access_token: typing.Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- super().__init__(access_token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- self.api_url = f'https://{base_url}/v3.4/agent/action'
-
- # Chats
-
- def list_chats(self,
- filters: dict = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
-
- Args:
- filters (dict): Possible request filters. Mustn't change between
- requests for subsequent pages. Otherwise,
- the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
- date of its last thread.
- limit (int): Limit of results per page. Default: 10, maximum: 100.
- page_id (str): ID of the page with paginated results.
- 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}/list_chats',
- json=payload,
- headers=headers)
-
- def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: str = None,
- page_id: str = None,
- min_events_count: int = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns threads that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which threads are to be listed.
- sort_order (str): Possible values: asc, desc (default).
- limit (str): Limit of results per page. Default: 3, maximum: 100.
- page_id (str): ID of the page with paginated results.
- min_events_count (int): Range: 1-100;
- Specifies the minimum number of events
- to be returned in the response.
- filters (dict): Possible request filters.
- 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}/list_threads',
- json=payload,
- headers=headers)
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Agent has access to in a given chat
-
- Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
- 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}/get_chat',
- json=payload,
- headers=headers)
-
- def list_archives(self,
- filters: dict = None,
- page_id: str = None,
- sort_order: str = None,
- limit: str = None,
- highlights: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a list of the chats an Agent has access to.
- Together with a chat, the events of one thread from this chat are returned.
-
- Args:
- filters (dict): Possible request filters.
- page_id (str): ID of the page with paginated results.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
- of its last thread.
- limit (str): Limit of results per page. Default: 10, maximum: 100.
- highlights (dict): Use it to highlight the match of filters.query.
- To enable highlights with default parameters,
- pass an empty object.
- 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}/list_archives',
- json=payload,
- headers=headers)
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Starts a chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/start_chat',
- json=payload,
- headers=headers)
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/resume_chat',
- json=payload,
- headers=headers)
-
- def deactivate_chat(self,
- id: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deactivates a chat by closing the currently open thread.
- Sending messages to this thread will no longer be possible.
-
- Args:
- id (str): Chat ID to deactivate.
- ignore_requester_presence (bool): If `True`, allows requester to deactivate chat
- without being present in the chat's users list.
- 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}/deactivate_chat',
- json=payload,
- headers=headers)
-
- def follow_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a chat as followed. All changes to the chat will be sent to the requester
- until the chat is reactivated or unfollowed. Chat members don't need to follow
- their chats. They receive all chat pushes regardless of their follower status.
-
- Args:
- id (str): ID of chat to be followed.
- 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}/follow_chat',
- json=payload,
- headers=headers)
-
- def unfollow_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the requester from the chat followers. After that, only key changes
- to the chat (like transfer_chat or close_active_thread) will be sent
- to the requester. Chat members cannot unfollow the chat.
-
- Args:
- id (str): ID of chat to be unfollowed.
- 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}/unfollow_chat',
- json=payload,
- headers=headers)
-
-# Chat access
-
- def transfer_chat(self,
- id: str = None,
- target: dict = None,
- ignore_agents_availability: bool = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Transfers a chat to an agent or a group.
-
- Args:
- id (str): chat ID
- target (dict): If missing, chat will be transferred within the current group.
- ignore_agents_availability (bool): If `True`, always transfers chats. Otherwise, fails
- when unable to assign any agent from the requested groups.
- ignore_requester_presence (bool): If `True`, allows requester to transfer chat
- without being present in the chat's users list.
- 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}/transfer_chat',
- json=payload,
- headers=headers)
-
-# Chat users
-
- def add_user_to_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- visibility: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Adds a user to the chat. You can't add more than one customer user
- type to the chat.
-
- Args:
- chat_id (str): chat ID.
- user_id (str): user ID.
- user_type (str): Possible values: agent or customer.
- visibility (str): Determines the visibility of events sent by
- the agent. Possible values: `all` or `agents`.
- ignore_requester_presence (bool): If `True`, allows requester to add user to chat
- without being present in the chat's users list.
- 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}/add_user_to_chat',
- json=payload,
- headers=headers)
-
- def remove_user_from_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes a user from chat.
-
- Args:
- chat_id (str): chat ID.
- user_id (str): user ID.
- user_type (str): Possible values: agent or customer.
- ignore_requester_presence (bool): If `True`, allows requester to remove user from chat
- without being present in the chat's users list.
- 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}/remove_user_from_chat',
- json=payload,
- headers=headers)
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
- The method updates the requester's `events_seen_up_to` as if they've seen all chat events.
-
- Args:
- chat_id (int): ID of the chat that you to send a message to.
- event (dict): Event object.
- attach_to_last_thread (bool): The flag is ignored for active chats.
- For inactive chats:
- True – the event will be added to the last thread;
- False – the request will fail. Default: False.
- 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',
- json=payload,
- headers=headers)
-
- def upload_file(self,
- file: typing.BinaryIO = None,
- headers: dict = None) -> httpx.Response:
- ''' Uploads a file to the server as a temporary file. It returns a URL that expires
- after 24 hours unless the URL is used in `send_event`.
-
- Args:
- file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
- 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. '''
- return self.session.post(f'{self.api_url}/upload_file',
- files=file,
- headers=headers)
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- postback: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send rich message postback to.
- thread_id (str): ID of the thread to send rich message postback to.
- event_id (str): ID of the event related to the rich message postback.
- postback (dict): Object containing postback data (id, toggled).
- 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_rich_message_postback',
- json=payload,
- headers=headers)
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- 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}/update_chat_properties',
- json=payload,
- headers=headers)
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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}/delete_chat_properties',
- json=payload,
- headers=headers)
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_thread_properties',
- json=payload,
- headers=headers)
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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}/delete_thread_properties',
- json=payload,
- headers=headers)
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_event_properties',
- json=payload,
- headers=headers)
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you to delete the properties for.
- thread_id (str): ID of the thread you want to delete the properties for.
- event_id (str): ID of the event you want to delete the properties for.
- properties (dict): Event properties to delete.
- 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}/delete_event_properties',
- json=payload,
- headers=headers)
-
-# Thread tags
-
- def tag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Tags thread.
-
- Args:
- chat_id (str): ID of the chat you want to add a tag to.
- thread_id (str): ID of the thread you want to add a tag to.
- tag (str): Tag name.
- 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}/tag_thread',
- json=payload,
- headers=headers)
-
- def untag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Untags thread.
-
- Args:
- chat_id (str): ID of the chat you want to remove a tag from.
- thread_id (str): ID of the thread you want to remove a tag from.
- tag (str): Tag name.
- 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}/untag_thread',
- json=payload,
- headers=headers)
-
-# Customers
-
- def get_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer with a given id.
-
- Args:
- id (str): customer id
- 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}/get_customer',
- json=payload,
- headers=headers)
-
- def list_customers(self,
- page_id: str = None,
- limit: str = None,
- sort_order: str = None,
- sort_by: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Customers.
-
- Args:
- page_id (str): ID of the page with paginated results.
- limit (str): Limit of results per page. Default: 10, maximum: 100.
- sort_order (str): Possible values: asc, desc (default).
- sort_by (str): When sorting by fields other than created_at, the entries
- with identical values will be additionally sorted by their
- creation time. Possible values: created_at (default),
- threads_count, visits_count, agent_last_event, customer_last_event.
- filters (dict): Possible request filters.
- 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}/list_customers',
- json=payload,
- headers=headers)
-
- def create_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Customer user type.
-
- Args:
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/create_customer',
- json=payload,
- headers=headers)
-
- def update_customer(self,
- id: str = None,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's properties.
-
- Args:
- id (str): ID of the Customer.
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/update_customer',
- json=payload,
- headers=headers)
-
- def ban_customer(self,
- id: str = None,
- ban: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Bans the customer for a specific period of time. It immediately
- disconnects all active sessions of this customer and does not accept
- new ones during the ban lifespan.
-
- Args:
- id (str): ID of the Customer.
- ban (dict): Ban object containing the number of days that
- the Customer will be banned.
- 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}/ban_customer',
- json=payload,
- headers=headers)
-
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
-# Status
-
- def set_routing_status(self,
- status: str = None,
- agent_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Changes the status of an Agent or a Bot Agent.
-
- Args:
- status (str): For Agents: accepting_chats or not_accepting_chats;
- for Bot Agents: accepting_chats, not_accepting_chats, or offline
- agent_id (str): If not specified, the requester's status will be updated.
- 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}/set_routing_status',
- json=payload,
- headers=headers)
-
- def list_routing_statuses(self,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the current routing status of each agent selected by the provided filters.
-
- Args:
- filters (dict): Possible request filters.
- 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}/list_routing_statuses',
- json=payload,
- headers=headers)
-
-
-# Other
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates `seen_up_to` value for a given chat.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format
- 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}/mark_events_as_seen',
- json=payload,
- headers=headers)
-
- def send_typing_indicator(self,
- chat_id: str = None,
- visibility: str = None,
- is_typing: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends typing indicator.
-
- Args:
- chat_id (str): ID of the chat that to send the typing indicator to.
- visibility (str): Possible values: `all`, `agents`.
- is_typing (bool): A flag that indicates if you are typing.
- 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_typing_indicator',
- json=payload,
- headers=headers)
-
- def multicast(self,
- recipients: dict = None,
- content: typing.Any = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a multicast (chat-unrelated communication).
-
- Args:
- recipients (dict): Object containing filters related to multicast recipients.
- content (typing.Any): A JSON message to be sent.
- type (str): Multicast message type.
- 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}/multicast',
- json=payload,
- headers=headers)
-
- def list_agents_for_transfer(self,
- chat_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Agents you can transfer a chat to.
-
- Args:
- chat_id (str): ID of the chat you want to transfer.
- 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}/list_agents_for_transfer',
- json=payload,
- headers=headers)
Agent Web API Class containing methods in version 3.4.
-
-
-Expand source code
-
-
class AgentWebV34(HttpClient):
- ''' Agent Web API Class containing methods in version 3.4. '''
- def __init__(self,
- access_token: typing.Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- super().__init__(access_token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- self.api_url = f'https://{base_url}/v3.4/agent/action'
-
- # Chats
-
- def list_chats(self,
- filters: dict = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
-
- Args:
- filters (dict): Possible request filters. Mustn't change between
- requests for subsequent pages. Otherwise,
- the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
- date of its last thread.
- limit (int): Limit of results per page. Default: 10, maximum: 100.
- page_id (str): ID of the page with paginated results.
- 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}/list_chats',
- json=payload,
- headers=headers)
-
- def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: str = None,
- page_id: str = None,
- min_events_count: int = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns threads that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which threads are to be listed.
- sort_order (str): Possible values: asc, desc (default).
- limit (str): Limit of results per page. Default: 3, maximum: 100.
- page_id (str): ID of the page with paginated results.
- min_events_count (int): Range: 1-100;
- Specifies the minimum number of events
- to be returned in the response.
- filters (dict): Possible request filters.
- 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}/list_threads',
- json=payload,
- headers=headers)
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Agent has access to in a given chat
-
- Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
- 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}/get_chat',
- json=payload,
- headers=headers)
-
- def list_archives(self,
- filters: dict = None,
- page_id: str = None,
- sort_order: str = None,
- limit: str = None,
- highlights: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a list of the chats an Agent has access to.
- Together with a chat, the events of one thread from this chat are returned.
-
- Args:
- filters (dict): Possible request filters.
- page_id (str): ID of the page with paginated results.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
- of its last thread.
- limit (str): Limit of results per page. Default: 10, maximum: 100.
- highlights (dict): Use it to highlight the match of filters.query.
- To enable highlights with default parameters,
- pass an empty object.
- 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}/list_archives',
- json=payload,
- headers=headers)
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Starts a chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/start_chat',
- json=payload,
- headers=headers)
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/resume_chat',
- json=payload,
- headers=headers)
-
- def deactivate_chat(self,
- id: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deactivates a chat by closing the currently open thread.
- Sending messages to this thread will no longer be possible.
-
- Args:
- id (str): Chat ID to deactivate.
- ignore_requester_presence (bool): If `True`, allows requester to deactivate chat
- without being present in the chat's users list.
- 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}/deactivate_chat',
- json=payload,
- headers=headers)
-
- def follow_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a chat as followed. All changes to the chat will be sent to the requester
- until the chat is reactivated or unfollowed. Chat members don't need to follow
- their chats. They receive all chat pushes regardless of their follower status.
-
- Args:
- id (str): ID of chat to be followed.
- 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}/follow_chat',
- json=payload,
- headers=headers)
-
- def unfollow_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the requester from the chat followers. After that, only key changes
- to the chat (like transfer_chat or close_active_thread) will be sent
- to the requester. Chat members cannot unfollow the chat.
-
- Args:
- id (str): ID of chat to be unfollowed.
- 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}/unfollow_chat',
- json=payload,
- headers=headers)
-
-# Chat access
-
- def transfer_chat(self,
- id: str = None,
- target: dict = None,
- ignore_agents_availability: bool = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Transfers a chat to an agent or a group.
-
- Args:
- id (str): chat ID
- target (dict): If missing, chat will be transferred within the current group.
- ignore_agents_availability (bool): If `True`, always transfers chats. Otherwise, fails
- when unable to assign any agent from the requested groups.
- ignore_requester_presence (bool): If `True`, allows requester to transfer chat
- without being present in the chat's users list.
- 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}/transfer_chat',
- json=payload,
- headers=headers)
-
-# Chat users
-
- def add_user_to_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- visibility: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Adds a user to the chat. You can't add more than one customer user
- type to the chat.
-
- Args:
- chat_id (str): chat ID.
- user_id (str): user ID.
- user_type (str): Possible values: agent or customer.
- visibility (str): Determines the visibility of events sent by
- the agent. Possible values: `all` or `agents`.
- ignore_requester_presence (bool): If `True`, allows requester to add user to chat
- without being present in the chat's users list.
- 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}/add_user_to_chat',
- json=payload,
- headers=headers)
-
- def remove_user_from_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes a user from chat.
-
- Args:
- chat_id (str): chat ID.
- user_id (str): user ID.
- user_type (str): Possible values: agent or customer.
- ignore_requester_presence (bool): If `True`, allows requester to remove user from chat
- without being present in the chat's users list.
- 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}/remove_user_from_chat',
- json=payload,
- headers=headers)
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
- The method updates the requester's `events_seen_up_to` as if they've seen all chat events.
-
- Args:
- chat_id (int): ID of the chat that you to send a message to.
- event (dict): Event object.
- attach_to_last_thread (bool): The flag is ignored for active chats.
- For inactive chats:
- True – the event will be added to the last thread;
- False – the request will fail. Default: False.
- 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',
- json=payload,
- headers=headers)
-
- def upload_file(self,
- file: typing.BinaryIO = None,
- headers: dict = None) -> httpx.Response:
- ''' Uploads a file to the server as a temporary file. It returns a URL that expires
- after 24 hours unless the URL is used in `send_event`.
-
- Args:
- file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
- 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. '''
- return self.session.post(f'{self.api_url}/upload_file',
- files=file,
- headers=headers)
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- postback: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send rich message postback to.
- thread_id (str): ID of the thread to send rich message postback to.
- event_id (str): ID of the event related to the rich message postback.
- postback (dict): Object containing postback data (id, toggled).
- 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_rich_message_postback',
- json=payload,
- headers=headers)
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- 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}/update_chat_properties',
- json=payload,
- headers=headers)
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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}/delete_chat_properties',
- json=payload,
- headers=headers)
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_thread_properties',
- json=payload,
- headers=headers)
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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}/delete_thread_properties',
- json=payload,
- headers=headers)
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_event_properties',
- json=payload,
- headers=headers)
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you to delete the properties for.
- thread_id (str): ID of the thread you want to delete the properties for.
- event_id (str): ID of the event you want to delete the properties for.
- properties (dict): Event properties to delete.
- 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}/delete_event_properties',
- json=payload,
- headers=headers)
-
-# Thread tags
-
- def tag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Tags thread.
-
- Args:
- chat_id (str): ID of the chat you want to add a tag to.
- thread_id (str): ID of the thread you want to add a tag to.
- tag (str): Tag name.
- 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}/tag_thread',
- json=payload,
- headers=headers)
-
- def untag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Untags thread.
-
- Args:
- chat_id (str): ID of the chat you want to remove a tag from.
- thread_id (str): ID of the thread you want to remove a tag from.
- tag (str): Tag name.
- 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}/untag_thread',
- json=payload,
- headers=headers)
-
-# Customers
-
- def get_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer with a given id.
-
- Args:
- id (str): customer id
- 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}/get_customer',
- json=payload,
- headers=headers)
-
- def list_customers(self,
- page_id: str = None,
- limit: str = None,
- sort_order: str = None,
- sort_by: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Customers.
-
- Args:
- page_id (str): ID of the page with paginated results.
- limit (str): Limit of results per page. Default: 10, maximum: 100.
- sort_order (str): Possible values: asc, desc (default).
- sort_by (str): When sorting by fields other than created_at, the entries
- with identical values will be additionally sorted by their
- creation time. Possible values: created_at (default),
- threads_count, visits_count, agent_last_event, customer_last_event.
- filters (dict): Possible request filters.
- 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}/list_customers',
- json=payload,
- headers=headers)
-
- def create_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Customer user type.
-
- Args:
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/create_customer',
- json=payload,
- headers=headers)
-
- def update_customer(self,
- id: str = None,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's properties.
-
- Args:
- id (str): ID of the Customer.
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/update_customer',
- json=payload,
- headers=headers)
-
- def ban_customer(self,
- id: str = None,
- ban: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Bans the customer for a specific period of time. It immediately
- disconnects all active sessions of this customer and does not accept
- new ones during the ban lifespan.
-
- Args:
- id (str): ID of the Customer.
- ban (dict): Ban object containing the number of days that
- the Customer will be banned.
- 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}/ban_customer',
- json=payload,
- headers=headers)
-
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
-# Status
-
- def set_routing_status(self,
- status: str = None,
- agent_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Changes the status of an Agent or a Bot Agent.
-
- Args:
- status (str): For Agents: accepting_chats or not_accepting_chats;
- for Bot Agents: accepting_chats, not_accepting_chats, or offline
- agent_id (str): If not specified, the requester's status will be updated.
- 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}/set_routing_status',
- json=payload,
- headers=headers)
-
- def list_routing_statuses(self,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the current routing status of each agent selected by the provided filters.
-
- Args:
- filters (dict): Possible request filters.
- 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}/list_routing_statuses',
- json=payload,
- headers=headers)
-
-
-# Other
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates `seen_up_to` value for a given chat.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format
- 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}/mark_events_as_seen',
- json=payload,
- headers=headers)
-
- def send_typing_indicator(self,
- chat_id: str = None,
- visibility: str = None,
- is_typing: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends typing indicator.
-
- Args:
- chat_id (str): ID of the chat that to send the typing indicator to.
- visibility (str): Possible values: `all`, `agents`.
- is_typing (bool): A flag that indicates if you are typing.
- 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_typing_indicator',
- json=payload,
- headers=headers)
-
- def multicast(self,
- recipients: dict = None,
- content: typing.Any = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a multicast (chat-unrelated communication).
-
- Args:
- recipients (dict): Object containing filters related to multicast recipients.
- content (typing.Any): A JSON message to be sent.
- type (str): Multicast message type.
- 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}/multicast',
- json=payload,
- headers=headers)
-
- def list_agents_for_transfer(self,
- chat_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Agents you can transfer a chat to.
-
- Args:
- chat_id (str): ID of the chat you want to transfer.
- 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}/list_agents_for_transfer',
- json=payload,
- headers=headers)
Adds a user to the chat. You can't add more than one customer user
-type to the chat.
-
Args
-
-
chat_id : str
-
chat ID.
-
user_id : str
-
user ID.
-
user_type : str
-
Possible values: agent or customer.
-
visibility : str
-
Determines the visibility of events sent by
-the agent. Possible values: all or agents.
-
ignore_requester_presence : bool
-
If True, allows requester to add user to chat
-without being present in the chat's users list.
-
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.
-
-
-
-Expand source code
-
-
def add_user_to_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- visibility: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Adds a user to the chat. You can't add more than one customer user
- type to the chat.
-
- Args:
- chat_id (str): chat ID.
- user_id (str): user ID.
- user_type (str): Possible values: agent or customer.
- visibility (str): Determines the visibility of events sent by
- the agent. Possible values: `all` or `agents`.
- ignore_requester_presence (bool): If `True`, allows requester to add user to chat
- without being present in the chat's users list.
- 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}/add_user_to_chat',
- json=payload,
- headers=headers)
Bans the customer for a specific period of time. It immediately
-disconnects all active sessions of this customer and does not accept
-new ones during the ban lifespan.
-
Args
-
-
id : str
-
ID of the Customer.
-
ban : dict
-
Ban object containing the number of days that
-the Customer will be banned.
-
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.
-
-
-
-Expand source code
-
-
def ban_customer(self,
- id: str = None,
- ban: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Bans the customer for a specific period of time. It immediately
- disconnects all active sessions of this customer and does not accept
- new ones during the ban lifespan.
-
- Args:
- id (str): ID of the Customer.
- ban (dict): Ban object containing the number of days that
- the Customer will be banned.
- 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}/ban_customer',
- json=payload,
- headers=headers)
An array of custom object-enclosed key:value pairs.
-Respects the order of items.
-
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.
-
-
-
-Expand source code
-
-
def create_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Customer user type.
-
- Args:
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/create_customer',
- json=payload,
- headers=headers)
Deactivates a chat by closing the currently open thread.
-Sending messages to this thread will no longer be possible.
-
Args
-
-
id : str
-
Chat ID to deactivate.
-
ignore_requester_presence : bool
-
If True, allows requester to deactivate chat
-without being present in the chat's users list.
-
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.
-
-
-
-Expand source code
-
-
def deactivate_chat(self,
- id: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deactivates a chat by closing the currently open thread.
- Sending messages to this thread will no longer be possible.
-
- Args:
- id (str): Chat ID to deactivate.
- ignore_requester_presence (bool): If `True`, allows requester to deactivate chat
- without being present in the chat's users list.
- 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}/deactivate_chat',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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}/delete_chat_properties',
- json=payload,
- headers=headers)
ID of the thread you want to delete the properties for.
-
event_id : str
-
ID of the event you want to delete the properties for.
-
properties : dict
-
Event properties to delete.
-
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.
-
-
-
-Expand source code
-
-
def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you to delete the properties for.
- thread_id (str): ID of the thread you want to delete the properties for.
- event_id (str): ID of the event you want to delete the properties for.
- properties (dict): Event properties to delete.
- 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}/delete_event_properties',
- json=payload,
- headers=headers)
ID of the chat you want to delete the properties of.
-
thread_id : str
-
ID of the thread you want to delete the properties of.
-
properties : dict
-
Thread properties to delete.
-
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.
-
-
-
-Expand source code
-
-
def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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}/delete_thread_properties',
- json=payload,
- headers=headers)
Marks a chat as followed. All changes to the chat will be sent to the requester
-until the chat is reactivated or unfollowed. Chat members don't need to follow
-their chats. They receive all chat pushes regardless of their follower status.
-
Args
-
-
id : str
-
ID of chat to be followed.
-
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.
-
-
-
-Expand source code
-
-
def follow_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a chat as followed. All changes to the chat will be sent to the requester
- until the chat is reactivated or unfollowed. Chat members don't need to follow
- their chats. They receive all chat pushes regardless of their follower status.
-
- Args:
- id (str): ID of chat to be followed.
- 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}/follow_chat',
- json=payload,
- headers=headers)
Marks a customer as followed. As a result, the requester (an agent)
-will receive the info about all the changes related to that customer
-via pushes. Once the customer leaves the website or is unfollowed,
-the agent will no longer receive that information.
-
Args
-
-
id : str
-
ID of the Customer.
-
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.
-
-
-
-Expand source code
-
-
def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
Returns a thread that the current Agent has access to in a given chat
-
Args
-
-
chat_id : str
-
ID of the chat for which thread is to be returned.
-
thread_id : str
-
ID of the thread to show. Default: the latest thread (if exists)
-
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.
-
-
-
-Expand source code
-
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Agent has access to in a given chat
-
- Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
- 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}/get_chat',
- json=payload,
- headers=headers)
Returns the info about the Customer with a given id.
-
Args
-
-
id : str
-
customer id
-
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.
-
-
-
-Expand source code
-
-
def get_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer with a given id.
-
- Args:
- id (str): customer id
- 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}/get_customer',
- json=payload,
- headers=headers)
Returns the list of Agents you can transfer a chat to.
-
Args
-
-
chat_id : str
-
ID of the chat you want to transfer.
-
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.
-
-
-
-Expand source code
-
-
def list_agents_for_transfer(self,
- chat_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Agents you can transfer a chat to.
-
- Args:
- chat_id (str): ID of the chat you want to transfer.
- 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}/list_agents_for_transfer',
- json=payload,
- headers=headers)
Returns a list of the chats an Agent has access to.
-Together with a chat, the events of one thread from this chat are returned.
-
Args
-
-
filters : dict
-
Possible request filters.
-
page_id : str
-
ID of the page with paginated results.
-
sort_order : str
-
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date
-of its last thread.
-
limit : str
-
Limit of results per page. Default: 10, maximum: 100.
-
highlights : dict
-
Use it to highlight the match of filters.query.
-To enable highlights with default parameters,
-pass an empty object.
-
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.
-
-
-
-Expand source code
-
-
def list_archives(self,
- filters: dict = None,
- page_id: str = None,
- sort_order: str = None,
- limit: str = None,
- highlights: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a list of the chats an Agent has access to.
- Together with a chat, the events of one thread from this chat are returned.
-
- Args:
- filters (dict): Possible request filters.
- page_id (str): ID of the page with paginated results.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
- of its last thread.
- limit (str): Limit of results per page. Default: 10, maximum: 100.
- highlights (dict): Use it to highlight the match of filters.query.
- To enable highlights with default parameters,
- pass an empty object.
- 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}/list_archives',
- json=payload,
- headers=headers)
Returns summaries of the chats an Agent has access to.
-
Args
-
-
filters : dict
-
Possible request filters. Mustn't change between
-requests for subsequent pages. Otherwise,
-the behavior is undefined.
-
sort_order : str
-
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation
-date of its last thread.
-
limit : int
-
Limit of results per page. Default: 10, maximum: 100.
-
page_id : str
-
ID of the page with paginated results.
-
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.
-
-
-
-Expand source code
-
-
def list_chats(self,
- filters: dict = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
-
- Args:
- filters (dict): Possible request filters. Mustn't change between
- requests for subsequent pages. Otherwise,
- the behavior is undefined.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
- date of its last thread.
- limit (int): Limit of results per page. Default: 10, maximum: 100.
- page_id (str): ID of the page with paginated results.
- 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}/list_chats',
- json=payload,
- headers=headers)
Limit of results per page. Default: 10, maximum: 100.
-
sort_order : str
-
Possible values: asc, desc (default).
-
sort_by : str
-
When sorting by fields other than created_at, the entries
-with identical values will be additionally sorted by their
-creation time. Possible values: created_at (default),
-threads_count, visits_count, agent_last_event, customer_last_event.
-
filters : dict
-
Possible request filters.
-
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.
-
-
-
-Expand source code
-
-
def list_customers(self,
- page_id: str = None,
- limit: str = None,
- sort_order: str = None,
- sort_by: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Customers.
-
- Args:
- page_id (str): ID of the page with paginated results.
- limit (str): Limit of results per page. Default: 10, maximum: 100.
- sort_order (str): Possible values: asc, desc (default).
- sort_by (str): When sorting by fields other than created_at, the entries
- with identical values will be additionally sorted by their
- creation time. Possible values: created_at (default),
- threads_count, visits_count, agent_last_event, customer_last_event.
- filters (dict): Possible request filters.
- 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}/list_customers',
- json=payload,
- headers=headers)
Returns the current routing status of each agent selected by the provided filters.
-
Args
-
-
filters : dict
-
Possible request filters.
-
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.
-
-
-
-Expand source code
-
-
def list_routing_statuses(self,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the current routing status of each agent selected by the provided filters.
-
- Args:
- filters (dict): Possible request filters.
- 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}/list_routing_statuses',
- json=payload,
- headers=headers)
Returns threads that the current Agent has access to in a given chat.
-
Args
-
-
chat_id : str
-
ID of the chat for which threads are to be listed.
-
sort_order : str
-
Possible values: asc, desc (default).
-
limit : str
-
Limit of results per page. Default: 3, maximum: 100.
-
page_id : str
-
ID of the page with paginated results.
-
min_events_count : int
-
Range: 1-100;
-Specifies the minimum number of events
-to be returned in the response.
-
filters : dict
-
Possible request filters.
-
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.
-
-
-
-Expand source code
-
-
def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: str = None,
- page_id: str = None,
- min_events_count: int = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns threads that the current Agent has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which threads are to be listed.
- sort_order (str): Possible values: asc, desc (default).
- limit (str): Limit of results per page. Default: 3, maximum: 100.
- page_id (str): ID of the page with paginated results.
- min_events_count (int): Range: 1-100;
- Specifies the minimum number of events
- to be returned in the response.
- filters (dict): Possible request filters.
- 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}/list_threads',
- json=payload,
- headers=headers)
Date up to which mark events - RFC 3339 date-time format
-
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.
-
-
-
-Expand source code
-
-
def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates `seen_up_to` value for a given chat.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format
- 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}/mark_events_as_seen',
- json=payload,
- headers=headers)
Object containing filters related to multicast recipients.
-
content : typing.Any
-
A JSON message to be sent.
-
type : str
-
Multicast message type.
-
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.
-
-
-
-Expand source code
-
-
def multicast(self,
- recipients: dict = None,
- content: typing.Any = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a multicast (chat-unrelated communication).
-
- Args:
- recipients (dict): Object containing filters related to multicast recipients.
- content (typing.Any): A JSON message to be sent.
- type (str): Multicast message type.
- 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}/multicast',
- json=payload,
- headers=headers)
If True, allows requester to remove user from chat
-without being present in the chat's users list.
-
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.
-
-
-
-Expand source code
-
-
def remove_user_from_chat(self,
- chat_id: str = None,
- user_id: str = None,
- user_type: str = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes a user from chat.
-
- Args:
- chat_id (str): chat ID.
- user_id (str): user ID.
- user_type (str): Possible values: agent or customer.
- ignore_requester_presence (bool): If `True`, allows requester to remove user from chat
- without being present in the chat's users list.
- 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}/remove_user_from_chat',
- json=payload,
- headers=headers)
Dict containing chat properties, access and thread.
-
active : bool
-
When set to False, creates an inactive thread; default: True.
-
continuous : bool
-
Starts chat as continuous (online group is not required); default: False.
-
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.
-
-
-
-Expand source code
-
-
def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/resume_chat',
- json=payload,
- headers=headers)
Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
-The method updates the requester's events_seen_up_to as if they've seen all chat events.
-
Args
-
-
chat_id : int
-
ID of the chat that you to send a message to.
-
event : dict
-
Event object.
-
attach_to_last_thread : bool
-
The flag is ignored for active chats.
-For inactive chats:
-True – the event will be added to the last thread;
-False – the request will fail. Default: False.
-
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.
-
-
-
-Expand source code
-
-
def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
- The method updates the requester's `events_seen_up_to` as if they've seen all chat events.
-
- Args:
- chat_id (int): ID of the chat that you to send a message to.
- event (dict): Event object.
- attach_to_last_thread (bool): The flag is ignored for active chats.
- For inactive chats:
- True – the event will be added to the last thread;
- False – the request will fail. Default: False.
- 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',
- json=payload,
- headers=headers)
ID of the thread to send rich message postback to.
-
event_id : str
-
ID of the event related to the rich message postback.
-
postback : dict
-
Object containing postback data (id, toggled).
-
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.
-
-
-
-Expand source code
-
-
def send_rich_message_postback(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- postback: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send rich message postback to.
- thread_id (str): ID of the thread to send rich message postback to.
- event_id (str): ID of the event related to the rich message postback.
- postback (dict): Object containing postback data (id, toggled).
- 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_rich_message_postback',
- json=payload,
- headers=headers)
ID of the chat that to send the typing indicator to.
-
visibility : str
-
Possible values: all, agents.
-
is_typing : bool
-
A flag that indicates if you are typing.
-
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.
-
-
-
-Expand source code
-
-
def send_typing_indicator(self,
- chat_id: str = None,
- visibility: str = None,
- is_typing: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends typing indicator.
-
- Args:
- chat_id (str): ID of the chat that to send the typing indicator to.
- visibility (str): Possible values: `all`, `agents`.
- is_typing (bool): A flag that indicates if you are typing.
- 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_typing_indicator',
- json=payload,
- headers=headers)
For Agents: accepting_chats or not_accepting_chats;
-for Bot Agents: accepting_chats, not_accepting_chats, or offline
-
agent_id : str
-
If not specified, the requester's status will be updated.
-
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.
-
-
-
-Expand source code
-
-
def set_routing_status(self,
- status: str = None,
- agent_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Changes the status of an Agent or a Bot Agent.
-
- Args:
- status (str): For Agents: accepting_chats or not_accepting_chats;
- for Bot Agents: accepting_chats, not_accepting_chats, or offline
- agent_id (str): If not specified, the requester's status will be updated.
- 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}/set_routing_status',
- json=payload,
- headers=headers)
Dict containing chat properties, access and thread.
-
active : bool
-
When set to False, creates an inactive thread; default: True.
-
continuous : bool
-
Starts chat as continuous (online group is not required); default: False.
-
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.
-
-
-
-Expand source code
-
-
def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Starts a chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/start_chat',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def tag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Tags thread.
-
- Args:
- chat_id (str): ID of the chat you want to add a tag to.
- thread_id (str): ID of the thread you want to add a tag to.
- tag (str): Tag name.
- 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}/tag_thread',
- json=payload,
- headers=headers)
If missing, chat will be transferred within the current group.
-
ignore_agents_availability : bool
-
If True, always transfers chats. Otherwise, fails
-when unable to assign any agent from the requested groups.
-
ignore_requester_presence : bool
-
If True, allows requester to transfer chat
-without being present in the chat's users list.
-
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.
-
-
-
-Expand source code
-
-
def transfer_chat(self,
- id: str = None,
- target: dict = None,
- ignore_agents_availability: bool = None,
- ignore_requester_presence: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Transfers a chat to an agent or a group.
-
- Args:
- id (str): chat ID
- target (dict): If missing, chat will be transferred within the current group.
- ignore_agents_availability (bool): If `True`, always transfers chats. Otherwise, fails
- when unable to assign any agent from the requested groups.
- ignore_requester_presence (bool): If `True`, allows requester to transfer chat
- without being present in the chat's users list.
- 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}/transfer_chat',
- json=payload,
- headers=headers)
Removes the requester from the chat followers. After that, only key changes
-to the chat (like transfer_chat or close_active_thread) will be sent
-to the requester. Chat members cannot unfollow the chat.
-
Args
-
-
id : str
-
ID of chat to be unfollowed.
-
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.
-
-
-
-Expand source code
-
-
def unfollow_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the requester from the chat followers. After that, only key changes
- to the chat (like transfer_chat or close_active_thread) will be sent
- to the requester. Chat members cannot unfollow the chat.
-
- Args:
- id (str): ID of chat to be unfollowed.
- 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}/unfollow_chat',
- json=payload,
- headers=headers)
Removes the agent from the list of customer's followers. Calling this
-method on a customer the agent's chatting with will result in success,
-however, the agent will still receive pushes about the customer's data
-updates. The unfollowing will take effect once the chat ends.
-
Args
-
-
id : str
-
ID of the Customer.
-
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.
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def untag_thread(self,
- chat_id: str = None,
- thread_id: str = None,
- tag: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Untags thread.
-
- Args:
- chat_id (str): ID of the chat you want to remove a tag from.
- thread_id (str): ID of the thread you want to remove a tag from.
- tag (str): Tag name.
- 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}/untag_thread',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- 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}/update_chat_properties',
- json=payload,
- headers=headers)
An array of custom object-enclosed key:value pairs.
-Respects the order of items.
-
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.
-
-
-
-Expand source code
-
-
def update_customer(self,
- id: str = None,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's properties.
-
- Args:
- id (str): ID of the Customer.
- name (str): Customer's name.
- email (str): Customer's email.
- avatar (str): URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/update_customer',
- json=payload,
- headers=headers)
Thread properties to set.
-You should stick to the general properties format and include namespace, property name and value.
-
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.
-
-
-
-Expand source code
-
-
def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_event_properties',
- json=payload,
- headers=headers)
Thread properties to set.
-You should stick to the general properties format and include namespace, property name and value.
-
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.
-
-
-
-Expand source code
-
-
def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_thread_properties',
- json=payload,
- headers=headers)
Uploads a file to the server as a temporary file. It returns a URL that expires
-after 24 hours unless the URL is used in send_event.
-
Args
-
-
file : typing.BinaryIO
-
File-like object with file to upload (Maximum size: 10MB).
-
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.
-
-
-
-Expand source code
-
-
def upload_file(self,
- file: typing.BinaryIO = None,
- headers: dict = None) -> httpx.Response:
- ''' Uploads a file to the server as a temporary file. It returns a URL that expires
- after 24 hours unless the URL is used in `send_event`.
-
- Args:
- file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
- 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. '''
- return self.session.post(f'{self.api_url}/upload_file',
- files=file,
- headers=headers)
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/agent/web/api/v35.html b/docs/agent/web/api/v35.html
index c558572..d6b0b5d 100644
--- a/docs/agent/web/api/v35.html
+++ b/docs/agent/web/api/v35.html
@@ -889,60 +889,6 @@
Module livechat.agent.web.api.v35
json=payload,
headers=headers)
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
# Status
def set_routing_status(self,
@@ -1988,60 +1934,6 @@
Classes
json=payload,
headers=headers)
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
# Status
def set_routing_status(self,
@@ -2722,64 +2614,6 @@
Marks a customer as followed. As a result, the requester (an agent)
-will receive the info about all the changes related to that customer
-via pushes. Once the customer leaves the website or is unfollowed,
-the agent will no longer receive that information.
-
Args
-
-
id : str
-
ID of the Customer.
-
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.
-
-
-
-Expand source code
-
-
def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
Removes the agent from the list of customer's followers. Calling this
-method on a customer the agent's chatting with will result in success,
-however, the agent will still receive pushes about the customer's data
-updates. The unfollowing will take effect once the chat ends.
-
Args
-
-
id : str
-
ID of the Customer.
-
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.
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between
requests for subsequent pages. Otherwise,
the behavior is undefined.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
+ Chat info entries are sorted by the creation
date of its last thread.
limit (int): Limit of results per page. Default: 10, maximum: 100.
page_id (str): ID of the page with paginated results.
@@ -171,7 +171,7 @@
Module livechat.agent.web.api.v36
filters (dict): Possible request filters.
page_id (str): ID of the page with paginated results.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
+ Chat info entries are sorted by the creation date
of its last thread.
limit (str): Limit of results per page. Default: 10, maximum: 100.
highlights (dict): Use it to highlight the match of filters.query.
@@ -537,6 +537,31 @@
Module livechat.agent.web.api.v36
json=payload,
headers=headers)
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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}/get_thread_transcript',
+ json=payload,
+ headers=headers)
+
# Properties
def update_chat_properties(self,
@@ -848,60 +873,6 @@
Module livechat.agent.web.api.v36
json=payload,
headers=headers)
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
# Status
def set_routing_status(self,
@@ -1182,14 +1153,14 @@
Classes
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between
requests for subsequent pages. Otherwise,
the behavior is undefined.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
+ Chat info entries are sorted by the creation
date of its last thread.
limit (int): Limit of results per page. Default: 10, maximum: 100.
page_id (str): ID of the page with paginated results.
@@ -1287,7 +1258,7 @@
Classes
filters (dict): Possible request filters.
page_id (str): ID of the page with paginated results.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
+ Chat info entries are sorted by the creation date
of its last thread.
limit (str): Limit of results per page. Default: 10, maximum: 100.
highlights (dict): Use it to highlight the match of filters.query.
@@ -1653,6 +1624,31 @@
Classes
json=payload,
headers=headers)
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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}/get_thread_transcript',
+ json=payload,
+ headers=headers)
+
# Properties
def update_chat_properties(self,
@@ -1964,60 +1960,6 @@
Classes
json=payload,
headers=headers)
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
# Status
def set_routing_status(self,
@@ -2690,18 +2632,17 @@
Marks a customer as followed. As a result, the requester (an agent)
-will receive the info about all the changes related to that customer
-via pushes. Once the customer leaves the website or is unfollowed,
-the agent will no longer receive that information.
+
Returns a thread that the current Agent has access to in a given chat
Args
-
id : str
-
ID of the Customer.
+
chat_id : str
+
ID of the chat for which thread is to be returned.
+
thread_id : str
+
ID of the thread to show. Default: the latest thread (if exists)
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2720,17 +2661,16 @@
Returns
Expand source code
-
def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
+
def get_chat(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a thread that the current Agent has access to in a given chat
Args:
- id (str): ID of the Customer.
+ chat_id (str): ID of the chat for which thread is to be returned.
+ thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
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.
@@ -2743,22 +2683,20 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.session.post(f'{self.api_url}/follow_customer',
+ return self.session.post(f'{self.api_url}/get_chat',
json=payload,
headers=headers)
Returns a thread that the current Agent has access to in a given chat
+
Returns the info about the Customer with a given id.
Args
-
chat_id : str
-
ID of the chat for which thread is to be returned.
-
thread_id : str
-
ID of the thread to show. Default: the latest thread (if exists)
+
id : str
+
customer id
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2777,16 +2715,14 @@
Returns
Expand source code
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Agent has access to in a given chat
+
def get_customer(self,
+ id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns the info about the Customer with a given id.
Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
+ id (str): customer id
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.
@@ -2795,24 +2731,25 @@
Returns
Returns:
httpx.Response: The Response object from `httpx` library,
- which contains a server’s response to an HTTP request.
- '''
+ 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}/get_chat',
+ return self.session.post(f'{self.api_url}/get_customer',
json=payload,
headers=headers)
Returns the info about the Customer with a given id.
+
Returns a plain-text transcript of a given thread.
Args
-
id : str
-
customer id
+
chat_id : str
+
ID of the chat the thread belongs to.
+
thread_id : str
+
ID of the thread to return the transcript for.
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2825,20 +2762,22 @@
Returns
httpx.Response
The Response object from httpx library,
-which contains a server’s response to an HTTP request.
+which contains a server's response to an HTTP request.
Expand source code
-
def get_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer with a given id.
+
def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a plain-text transcript of a given thread.
Args:
- id (str): customer id
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
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.
@@ -2847,10 +2786,10 @@
Returns
Returns:
httpx.Response: The Response object from `httpx` library,
- which contains a server’s response to an HTTP request. '''
+ 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}/get_customer',
+ return self.session.post(f'{self.api_url}/get_thread_transcript',
json=payload,
headers=headers)
@@ -2920,7 +2859,7 @@
Args
ID of the page with paginated results.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date
+Chat info entries are sorted by the creation date
of its last thread.
limit : str
Limit of results per page. Default: 10, maximum: 100.
@@ -2961,7 +2900,7 @@
Returns
filters (dict): Possible request filters.
page_id (str): ID of the page with paginated results.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
+ Chat info entries are sorted by the creation date
of its last thread.
limit (str): Limit of results per page. Default: 10, maximum: 100.
highlights (dict): Use it to highlight the match of filters.query.
@@ -2988,7 +2927,7 @@
Returns summaries of the chats an Agent has access to.
+
Returns chat info for the chats an Agent has access to.
Args
filters : dict
@@ -2997,7 +2936,7 @@
Args
the behavior is undefined.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation
+Chat info entries are sorted by the creation
date of its last thread.
limit : int
Limit of results per page. Default: 10, maximum: 100.
@@ -3029,14 +2968,14 @@
Returns
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between
requests for subsequent pages. Otherwise,
the behavior is undefined.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
+ Chat info entries are sorted by the creation
date of its last thread.
limit (int): Limit of results per page. Default: 10, maximum: 100.
page_id (str): ID of the page with paginated results.
@@ -4145,64 +4084,6 @@
Removes the agent from the list of customer's followers. Calling this
-method on a customer the agent's chatting with will result in success,
-however, the agent will still receive pushes about the customer's data
-updates. The unfollowing will take effect once the chat ends.
-
Args
-
-
id : str
-
ID of the Customer.
-
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.
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between
requests for subsequent pages. Otherwise,
the behavior is undefined.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
+ Chat info entries are sorted by the creation
date of its last thread.
limit (int): Limit of results per page. Default: 10, maximum: 100.
page_id (str): ID of the page with paginated results.
@@ -171,7 +171,7 @@
Module livechat.agent.web.api.v37
filters (dict): Possible request filters.
page_id (str): ID of the page with paginated results.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
+ Chat info entries are sorted by the creation date
of its last thread.
limit (str): Limit of results per page. Default: 10, maximum: 100.
highlights (dict): Use it to highlight the match of filters.query.
@@ -537,6 +537,31 @@
Module livechat.agent.web.api.v37
json=payload,
headers=headers)
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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}/get_thread_transcript',
+ json=payload,
+ headers=headers)
+
# Properties
def update_chat_properties(self,
@@ -848,60 +873,6 @@
Module livechat.agent.web.api.v37
json=payload,
headers=headers)
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
# Status
def set_routing_status(self,
@@ -1182,14 +1153,14 @@
Classes
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between
requests for subsequent pages. Otherwise,
the behavior is undefined.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
+ Chat info entries are sorted by the creation
date of its last thread.
limit (int): Limit of results per page. Default: 10, maximum: 100.
page_id (str): ID of the page with paginated results.
@@ -1287,7 +1258,7 @@
Classes
filters (dict): Possible request filters.
page_id (str): ID of the page with paginated results.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
+ Chat info entries are sorted by the creation date
of its last thread.
limit (str): Limit of results per page. Default: 10, maximum: 100.
highlights (dict): Use it to highlight the match of filters.query.
@@ -1653,6 +1624,31 @@
Classes
json=payload,
headers=headers)
+ def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a plain-text transcript of a given thread.
+
+ Args:
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
+ 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}/get_thread_transcript',
+ json=payload,
+ headers=headers)
+
# Properties
def update_chat_properties(self,
@@ -1964,60 +1960,6 @@
Classes
json=payload,
headers=headers)
- def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
-
- Args:
- id (str): ID of the Customer.
- 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}/follow_customer',
- json=payload,
- headers=headers)
-
- def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
-
# Status
def set_routing_status(self,
@@ -2690,18 +2632,17 @@
Marks a customer as followed. As a result, the requester (an agent)
-will receive the info about all the changes related to that customer
-via pushes. Once the customer leaves the website or is unfollowed,
-the agent will no longer receive that information.
+
Returns a thread that the current Agent has access to in a given chat
Args
-
id : str
-
ID of the Customer.
+
chat_id : str
+
ID of the chat for which thread is to be returned.
+
thread_id : str
+
ID of the thread to show. Default: the latest thread (if exists)
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2720,17 +2661,16 @@
Returns
Expand source code
-
def follow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks a customer as followed. As a result, the requester (an agent)
- will receive the info about all the changes related to that customer
- via pushes. Once the customer leaves the website or is unfollowed,
- the agent will no longer receive that information.
+
def get_chat(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a thread that the current Agent has access to in a given chat
Args:
- id (str): ID of the Customer.
+ chat_id (str): ID of the chat for which thread is to be returned.
+ thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
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.
@@ -2743,22 +2683,20 @@
Returns
'''
if payload is None:
payload = prepare_payload(locals())
- return self.session.post(f'{self.api_url}/follow_customer',
+ return self.session.post(f'{self.api_url}/get_chat',
json=payload,
headers=headers)
Returns a thread that the current Agent has access to in a given chat
+
Returns the info about the Customer with a given id.
Args
-
chat_id : str
-
ID of the chat for which thread is to be returned.
-
thread_id : str
-
ID of the thread to show. Default: the latest thread (if exists)
+
id : str
+
customer id
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2777,16 +2715,14 @@
Returns
Expand source code
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Agent has access to in a given chat
+
def get_customer(self,
+ id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns the info about the Customer with a given id.
Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
+ id (str): customer id
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.
@@ -2795,24 +2731,25 @@
Returns
Returns:
httpx.Response: The Response object from `httpx` library,
- which contains a server’s response to an HTTP request.
- '''
+ 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}/get_chat',
+ return self.session.post(f'{self.api_url}/get_customer',
json=payload,
headers=headers)
Returns the info about the Customer with a given id.
+
Returns a plain-text transcript of a given thread.
Args
-
id : str
-
customer id
+
chat_id : str
+
ID of the chat the thread belongs to.
+
thread_id : str
+
ID of the thread to return the transcript for.
payload : dict
Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -2825,20 +2762,22 @@
Returns
httpx.Response
The Response object from httpx library,
-which contains a server’s response to an HTTP request.
+which contains a server's response to an HTTP request.
Expand source code
-
def get_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer with a given id.
+
def get_thread_transcript(self,
+ chat_id: str = None,
+ thread_id: str = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Returns a plain-text transcript of a given thread.
Args:
- id (str): customer id
+ chat_id (str): ID of the chat the thread belongs to.
+ thread_id (str): ID of the thread to return the transcript for.
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.
@@ -2847,10 +2786,10 @@
Returns
Returns:
httpx.Response: The Response object from `httpx` library,
- which contains a server’s response to an HTTP request. '''
+ 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}/get_customer',
+ return self.session.post(f'{self.api_url}/get_thread_transcript',
json=payload,
headers=headers)
@@ -2920,7 +2859,7 @@
Args
ID of the page with paginated results.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date
+Chat info entries are sorted by the creation date
of its last thread.
limit : str
Limit of results per page. Default: 10, maximum: 100.
@@ -2961,7 +2900,7 @@
Returns
filters (dict): Possible request filters.
page_id (str): ID of the page with paginated results.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date
+ Chat info entries are sorted by the creation date
of its last thread.
limit (str): Limit of results per page. Default: 10, maximum: 100.
highlights (dict): Use it to highlight the match of filters.query.
@@ -2988,7 +2927,7 @@
Returns summaries of the chats an Agent has access to.
+
Returns chat info for the chats an Agent has access to.
Args
filters : dict
@@ -2997,7 +2936,7 @@
Args
the behavior is undefined.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation
+Chat info entries are sorted by the creation
date of its last thread.
limit : int
Limit of results per page. Default: 10, maximum: 100.
@@ -3029,14 +2968,14 @@
Returns
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats an Agent has access to.
+ ''' Returns chat info for the chats an Agent has access to.
Args:
filters (dict): Possible request filters. Mustn't change between
requests for subsequent pages. Otherwise,
the behavior is undefined.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation
+ Chat info entries are sorted by the creation
date of its last thread.
limit (int): Limit of results per page. Default: 10, maximum: 100.
page_id (str): ID of the page with paginated results.
@@ -4145,64 +4084,6 @@
Removes the agent from the list of customer's followers. Calling this
-method on a customer the agent's chatting with will result in success,
-however, the agent will still receive pushes about the customer's data
-updates. The unfollowing will take effect once the chat ends.
-
Args
-
-
id : str
-
ID of the Customer.
-
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.
-
-
-
-Expand source code
-
-
def unfollow_customer(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Removes the agent from the list of customer's followers. Calling this
- method on a customer the agent's chatting with will result in success,
- however, the agent will still receive pushes about the customer's data
- updates. The unfollowing will take effect once the chat ends.
-
- Args:
- id (str): ID of the Customer.
- 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}/unfollow_customer',
- json=payload,
- headers=headers)
Configuration API module with client class in version 3.4.
-
-
-Expand source code
-
-
''' Configuration API module with client class in version 3.4. '''
-
-from typing import Union
-
-import httpx
-
-from livechat.utils.helpers import prepare_payload
-from livechat.utils.http_client import HttpClient
-from livechat.utils.structures import AccessToken
-
-
-class ConfigurationApiV34(HttpClient):
- ''' Configuration API client class in version 3.4. '''
- def __init__(self,
- token: Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- super().__init__(token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- self.api_url = f'https://{base_url}/v3.4/configuration/action'
-
-# Agents
-
- def create_agent(self,
- id: str = None,
- name: str = None,
- role: str = None,
- avatar_path: str = None,
- job_title: str = None,
- mobile: str = None,
- max_chats_count: int = None,
- awaiting_approval: bool = None,
- groups: list = None,
- notifications: list = None,
- email_subscriptions: list = None,
- work_scheduler: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Agent with specified parameters within a license.
-
- Args:
- id (str): Agent's ID.
- name (str): Agent's name.
- role (str): Agent role, should be one of the following:
- `viceowner`, `administrator`, `normal` (default).
- avatar_path (str): URL path of the Agent's avatar.
- job_title (str): Agent's job title.
- mobile (str): Agent's mobile number.
- max_chats_count (int): Agent's maximum number of concurrent chats.
- awaiting_approval (bool): Determines if the Agent will be awaiting
- approval after creation.
- groups (list): Groups an Agent belongs to.
- notifications (list): Represents which Agent notifications are turned on.
- email_subscriptions (list): Represents which subscriptions will be send to
- the Agent via email.
- work_scheduler (dict): Work scheduler options to set for the new Agent.
- 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}/create_agent',
- json=payload,
- headers=headers)
-
- def get_agent(self,
- id: str = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- fields (list): Additional fields to include.
- 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}/get_agent',
- json=payload,
- headers=headers)
-
- def list_agents(self,
- filters: dict = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns all Agents within a license.
-
- Args:
- filters (dict): Possible request filters.
- fields (list): Additional fields to include.
- 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}/list_agents',
- json=payload,
- headers=headers)
-
- def update_agent(self,
- id: str = None,
- name: str = None,
- role: str = None,
- avatar_path: str = None,
- job_title: str = None,
- mobile: str = None,
- max_chats_count: int = None,
- groups: list = None,
- notifications: list = None,
- email_subscriptions: list = None,
- work_scheduler: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates the properties of an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- name (str): Agent's name.
- role (str): Agent role, should be one of the following:
- `viceowner`, `administrator`, `normal` (default).
- avatar_path (str): URL path of the Agent's avatar.
- job_title (str): Agent's job title.
- mobile (str): Agent's mobile number.
- max_chats_count (int): Agent's maximum number of concurrent chats.
- groups (list): Groups an Agent belongs to.
- notifications (list): Represents which Agent notifications are turned on.
- email_subscriptions (list): Represents which subscriptions will be send to
- the Agent via email.
- work_scheduler (dict): Work scheduler options to set for the new Agent.
- 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}/update_agent',
- json=payload,
- headers=headers)
-
- def delete_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/delete_agent',
- json=payload,
- headers=headers)
-
- def suspend_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Suspends an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/suspend_agent',
- json=payload,
- headers=headers)
-
- def unsuspend_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unsuspends an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/unsuspend_agent',
- json=payload,
- headers=headers)
-
- def request_agent_unsuspension(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' A suspended Agent can send emails to license owners and vice owners
- with an unsuspension request.
-
- Args:
- 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}/request_agent_unsuspension',
- json=payload,
- headers=headers)
-
- def approve_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Approves an Agent thus allowing the Agent to use the application.
-
- Args:
- id (str): Agent's ID.
- 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}/approve_agent',
- json=payload,
- headers=headers)
-
-# Auto access
-
- def add_auto_access(self,
- access: dict = None,
- conditions: dict = None,
- description: str = None,
- next_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates an auto access data structure, which is a set of conditions
- for the tracking URL and geolocation of a customer.
-
- Args:
- access (dict): Destination access.
- conditions (dict): Conditions to check.
- description (str): Description of the auto access.
- next_id (str): ID of an existing auto access.
- 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}/add_auto_access',
- json=payload,
- headers=headers)
-
- def list_auto_accesses(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns all existing auto access data structures.
-
- Args:
- 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}/list_auto_accesses',
- json=payload,
- headers=headers)
-
- def delete_auto_access(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an existing auto access data structure specified by its ID.
-
- Args:
- id (str): Auto access ID.
- 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}/delete_auto_access',
- json=payload,
- headers=headers)
-
- def update_auto_access(self,
- id: str = None,
- next_id: str = None,
- access: dict = None,
- conditions: dict = None,
- description: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Moves an existing auto access data structure, specified by id,
- before another one, specified by next_id.
-
- Args:
- id (str): ID of the auto access to move.
- next_id (str): ID of the auto access that should follow the moved auto access.
- access (dict): Destination access.
- conditions (dict): Conditions to check.
- description (str): Description of the auto access.
- 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}/update_auto_access',
- json=payload,
- headers=headers)
-
-# Bots
-
- def create_bot(self,
- name: str = None,
- avatar: str = None,
- max_chats_count: int = None,
- default_group_priority: str = None,
- job_title: str = None,
- groups: list = None,
- work_scheduler: dict = None,
- timezone: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Bot.
-
- Args:
- name (str): Display name.
- avatar (str): Avatar URL.
- max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6.
- default_group_priority (str): The default routing priority for a group without defined priority.
- job_title (str): Bot's job title.
- groups (list): Groups the Bot belongs to.
- work_scheduler (dict): Work scheduler options to set for the new Bot.
- timezone (str): The time zone in which the Bot's work scheduler should operate.
- owner_client_id (str): Required only when authorizing via PATs.
- The request will be rejected if you provide owner_client_id when authorizing with a Bearer Token.
- 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}/create_bot',
- json=payload,
- headers=headers)
-
- def delete_bot(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes a Bot.
-
- Args:
- id (str): Bot's ID.
- 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}/delete_bot',
- json=payload,
- headers=headers)
-
- def update_bot(self,
- id: str = None,
- name: str = None,
- avatar: str = None,
- max_chats_count: int = None,
- default_group_priority: str = None,
- groups: list = None,
- webhooks: dict = None,
- work_scheduler: dict = None,
- timezone: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates an existing Bot.
-
- Args:
- id (str): Bot's ID.
- name (str): Display name.
- avatar (str): Avatar URL.
- max_chats_count (int): Max. number of incoming chats that can be routed to the Bot.
- default_group_priority (str): The default routing priority for a group without defined priority.
- groups (list): Groups the Bot belongs to.
- webhooks (dict): Webhooks sent to the Bot.
- work_scheduler (dict): Work scheduler options to set for the new Bot.
- timezone (str): The time zone in which the Bot's work scheduler should operate.
- 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}/update_bot',
- json=payload,
- headers=headers)
-
- def list_bots(self,
- all: bool = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Bots created within a license.
-
- Args:
- all (bool): `True` gets all Bots within a license. `False` (default) returns only the requester's Bots.
- fields (list): Additional Bot fields to include.
- 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}/list_bots',
- json=payload,
- headers=headers)
-
- def get_bot(self,
- id: str = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets a Bot specified by `id`.
-
- Args:
- id (str): Bot's ID.
- fields (list): Additional Bot fields to include.
- 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}/get_bot',
- json=payload,
- headers=headers)
-
-# Groups
-
- def create_group(self,
- name: str = None,
- language_code: str = None,
- agent_priorities: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new group.
-
- Args:
- name (str): Group name (up to 180 chars).
- language_code (str): The code of the group languange.
- agent_priorities (dict): Agents' priorities in a group as a map in the "<id>": "<priority>" format.
- 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}/create_group',
- json=payload,
- headers=headers)
-
- def update_group(self,
- id: int = None,
- name: str = None,
- language_code: str = None,
- agent_priorities: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates an existing group.
-
- Args:
- id (int): Groups' ID.
- name (str): Group name (up to 180 chars).
- language_code (str): The code of the group languange.
- agent_priorities (dict): Agents' priorities in a group as a map in the "<id>": "<priority>" format.
- 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}/update_group',
- json=payload,
- headers=headers)
-
- def delete_group(self,
- id: int = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an existing group.
-
- Args:
- id (int): Groups' ID.
- 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}/delete_group',
- json=payload,
- headers=headers)
-
- def list_groups(self,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all the exisiting groups.
-
- Args:
- fields (list): Additional fields to include.
- 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}/list_groups',
- json=payload,
- headers=headers)
-
- def get_group(self,
- id: int = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns details about a group specified by its id.
-
- Args:
- id (int): Groups' ID.
- fields (list): Additional fields to include.
- 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}/get_group',
- json=payload,
- headers=headers)
-
-# Properties
-
- def register_property(self,
- name: str = None,
- owner_client_id: str = None,
- type: str = None,
- access: dict = None,
- description: str = None,
- domain: list = None,
- range: dict = None,
- default_value: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Registers a new private property for a given Client ID.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- type (str): Possible values: `int`, `string`, `bool`, and `tokenized_string`.
- access (dict): Destination access.
- description (str): Property description.
- domain (list): Array of values that properties can be set to.
- range (dict): Range of values that properties can be set to.
- default_value (str): Default value of property; validated by domain or range, if one exists.
- 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}/register_property',
- json=payload,
- headers=headers)
-
- def unregister_property(self,
- name: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unregisters a private property.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- 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}/unregister_property',
- json=payload,
- headers=headers)
-
- def publish_property(self,
- name: str = None,
- owner_client_id: str = None,
- access_type: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Publishes a private property.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- access_type (list): Possible values: `read`, `write`.
- 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}/publish_property',
- json=payload,
- headers=headers)
-
- def list_properties(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists private and public properties owned by a given Client ID.
-
- Args:
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- 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}/list_properties',
- json=payload,
- headers=headers)
-
- def update_license_properties(self,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates a property value within a license. This operation doesn't
- overwrite the existing values.
-
- Args:
- properties (dict): An object with namespaces as keys and properties (grouped in objects) as values.
- 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}/update_license_properties',
- json=payload,
- headers=headers)
-
- def list_license_properties(self,
- namespace: str = None,
- name_prefix: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties set within a license.
-
- Args:
- namespace (str): Properties namespace.
- name_prefix (str): Properties name prefix.
- 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}/list_license_properties',
- json=payload,
- headers=headers)
-
- def delete_license_properties(self,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes the properties set within a license.
-
- Args:
- properties (dict): An object with namespaces as keys and property_names (in an array) as values.
- 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}/delete_license_properties',
- json=payload,
- headers=headers)
-
- def update_group_properties(self,
- group_id: int = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates a property value within a group as the property location.
- This operation doesn't overwrite the existing values.
-
- Args:
- group_id (int): ID of the group you set the properties for.
- properties (dict): An object with namespaces as keys and properties (grouped in objects) as values.
- 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}/update_group_properties',
- json=payload,
- headers=headers)
-
- def list_group_properties(self,
- id: int = None,
- namespace: str = None,
- name_prefix: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties set within a group.
-
- Args:
- id (int): ID of the group you retrieve properties from.
- namespace (str): Properties namespace.
- name_prefix (str): Properties name prefix.
- 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}/list_group_properties',
- json=payload,
- headers=headers)
-
- def delete_group_properties(self,
- id: int = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes the properties set within a group.
-
- Args:
- id (int): ID of the group you delete properties from.
- properties (dict): An object with namespaces as keys and property_names (in an array) as values.
- 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}/delete_group_properties',
- json=payload,
- headers=headers)
-
-# Webhooks
-
- def register_webhook(self,
- action: str = None,
- secret_key: str = None,
- url: str = None,
- additional_data: list = None,
- description: str = None,
- filters: dict = None,
- owner_client_id: str = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Registers a webhook for the Client ID (application) provided in the request.
-
- Args:
- action (str): The action that triggers sending a webhook.
- secret_key (str): The secret key sent in webhooks to verify the source of a webhook.
- url (str): Destination URL for the webhook.
- additional_data (list): Additional data arriving with the webhook.
- description (str): Webhook description.
- filters (dict): Filters to check if a webhook should be triggered.
- owner_client_id (str): The Client ID for which the webhook will be registered.
- type (str): `bot` or `license`.
- 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}/register_webhook',
- json=payload,
- headers=headers)
-
- def list_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all webhooks registered for the given Client ID.
-
- Args:
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/list_webhooks',
- json=payload,
- headers=headers)
-
- def unregister_webhook(self,
- id: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unregisters a webhook previously registered for a Client ID (application).
-
- Args:
- id (str): Webhook's ID.
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/unregister_webhook',
- json=payload,
- headers=headers)
-
- def list_webhook_names(self,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all webhooks that are supported in a given API version. This method requires no authorization.
-
- Args:
- version (str): API's version. Defaults to the current stable API version.
- 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}/list_webhook_names',
- json=payload,
- headers=headers)
-
- def enable_license_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Enables the webhooks registered for a given Client ID (application)
- for the license associated with the access token used in the request.
-
- Args:
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/enable_license_webhooks',
- json=payload,
- headers=headers)
-
- def disable_license_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Disables the enabled webhooks.
-
- Args:
- owner_client_id (str): Required when authorizing via PATs; ignored otherwise.
- 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}/disable_license_webhooks',
- json=payload,
- headers=headers)
-
- def get_license_webhooks_state(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets the state of the webhooks registered for a given Client ID (application)
- on the license associated with the access token used in the request.
-
- Args:
- owner_client_id (str): Required when authorizing via PATs; ignored otherwise.
- 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}/get_license_webhooks_state',
- json=payload,
- headers=headers)
-
-
-# Other
-
- def get_license_id(self,
- organization_id: str = None,
- params: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns license ID by given organization ID.
-
- Args:
- organization_id (str): Organization ID to get license ID for.
- params (dict): Custom params to be used in request's query string.
- 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 params is None:
- params = prepare_payload(locals())
- return self.session.get(f'{self.api_url}/get_license_id',
- params=params,
- headers=headers)
-
- def get_organization_id(self,
- license_id: int = None,
- params: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns organization ID by given license ID.
-
- Args:
- license_id (int): License ID to get organization ID for.
- params (dict): Custom params to be used in request's query string.
- 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 params is None:
- params = prepare_payload(locals())
- return self.session.get(f'{self.api_url}/get_organization_id',
- params=params,
- headers=headers)
class ConfigurationApiV34(HttpClient):
- ''' Configuration API client class in version 3.4. '''
- def __init__(self,
- token: Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- super().__init__(token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- self.api_url = f'https://{base_url}/v3.4/configuration/action'
-
-# Agents
-
- def create_agent(self,
- id: str = None,
- name: str = None,
- role: str = None,
- avatar_path: str = None,
- job_title: str = None,
- mobile: str = None,
- max_chats_count: int = None,
- awaiting_approval: bool = None,
- groups: list = None,
- notifications: list = None,
- email_subscriptions: list = None,
- work_scheduler: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Agent with specified parameters within a license.
-
- Args:
- id (str): Agent's ID.
- name (str): Agent's name.
- role (str): Agent role, should be one of the following:
- `viceowner`, `administrator`, `normal` (default).
- avatar_path (str): URL path of the Agent's avatar.
- job_title (str): Agent's job title.
- mobile (str): Agent's mobile number.
- max_chats_count (int): Agent's maximum number of concurrent chats.
- awaiting_approval (bool): Determines if the Agent will be awaiting
- approval after creation.
- groups (list): Groups an Agent belongs to.
- notifications (list): Represents which Agent notifications are turned on.
- email_subscriptions (list): Represents which subscriptions will be send to
- the Agent via email.
- work_scheduler (dict): Work scheduler options to set for the new Agent.
- 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}/create_agent',
- json=payload,
- headers=headers)
-
- def get_agent(self,
- id: str = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- fields (list): Additional fields to include.
- 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}/get_agent',
- json=payload,
- headers=headers)
-
- def list_agents(self,
- filters: dict = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns all Agents within a license.
-
- Args:
- filters (dict): Possible request filters.
- fields (list): Additional fields to include.
- 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}/list_agents',
- json=payload,
- headers=headers)
-
- def update_agent(self,
- id: str = None,
- name: str = None,
- role: str = None,
- avatar_path: str = None,
- job_title: str = None,
- mobile: str = None,
- max_chats_count: int = None,
- groups: list = None,
- notifications: list = None,
- email_subscriptions: list = None,
- work_scheduler: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates the properties of an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- name (str): Agent's name.
- role (str): Agent role, should be one of the following:
- `viceowner`, `administrator`, `normal` (default).
- avatar_path (str): URL path of the Agent's avatar.
- job_title (str): Agent's job title.
- mobile (str): Agent's mobile number.
- max_chats_count (int): Agent's maximum number of concurrent chats.
- groups (list): Groups an Agent belongs to.
- notifications (list): Represents which Agent notifications are turned on.
- email_subscriptions (list): Represents which subscriptions will be send to
- the Agent via email.
- work_scheduler (dict): Work scheduler options to set for the new Agent.
- 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}/update_agent',
- json=payload,
- headers=headers)
-
- def delete_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/delete_agent',
- json=payload,
- headers=headers)
-
- def suspend_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Suspends an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/suspend_agent',
- json=payload,
- headers=headers)
-
- def unsuspend_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unsuspends an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/unsuspend_agent',
- json=payload,
- headers=headers)
-
- def request_agent_unsuspension(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' A suspended Agent can send emails to license owners and vice owners
- with an unsuspension request.
-
- Args:
- 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}/request_agent_unsuspension',
- json=payload,
- headers=headers)
-
- def approve_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Approves an Agent thus allowing the Agent to use the application.
-
- Args:
- id (str): Agent's ID.
- 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}/approve_agent',
- json=payload,
- headers=headers)
-
-# Auto access
-
- def add_auto_access(self,
- access: dict = None,
- conditions: dict = None,
- description: str = None,
- next_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates an auto access data structure, which is a set of conditions
- for the tracking URL and geolocation of a customer.
-
- Args:
- access (dict): Destination access.
- conditions (dict): Conditions to check.
- description (str): Description of the auto access.
- next_id (str): ID of an existing auto access.
- 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}/add_auto_access',
- json=payload,
- headers=headers)
-
- def list_auto_accesses(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns all existing auto access data structures.
-
- Args:
- 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}/list_auto_accesses',
- json=payload,
- headers=headers)
-
- def delete_auto_access(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an existing auto access data structure specified by its ID.
-
- Args:
- id (str): Auto access ID.
- 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}/delete_auto_access',
- json=payload,
- headers=headers)
-
- def update_auto_access(self,
- id: str = None,
- next_id: str = None,
- access: dict = None,
- conditions: dict = None,
- description: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Moves an existing auto access data structure, specified by id,
- before another one, specified by next_id.
-
- Args:
- id (str): ID of the auto access to move.
- next_id (str): ID of the auto access that should follow the moved auto access.
- access (dict): Destination access.
- conditions (dict): Conditions to check.
- description (str): Description of the auto access.
- 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}/update_auto_access',
- json=payload,
- headers=headers)
-
-# Bots
-
- def create_bot(self,
- name: str = None,
- avatar: str = None,
- max_chats_count: int = None,
- default_group_priority: str = None,
- job_title: str = None,
- groups: list = None,
- work_scheduler: dict = None,
- timezone: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Bot.
-
- Args:
- name (str): Display name.
- avatar (str): Avatar URL.
- max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6.
- default_group_priority (str): The default routing priority for a group without defined priority.
- job_title (str): Bot's job title.
- groups (list): Groups the Bot belongs to.
- work_scheduler (dict): Work scheduler options to set for the new Bot.
- timezone (str): The time zone in which the Bot's work scheduler should operate.
- owner_client_id (str): Required only when authorizing via PATs.
- The request will be rejected if you provide owner_client_id when authorizing with a Bearer Token.
- 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}/create_bot',
- json=payload,
- headers=headers)
-
- def delete_bot(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes a Bot.
-
- Args:
- id (str): Bot's ID.
- 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}/delete_bot',
- json=payload,
- headers=headers)
-
- def update_bot(self,
- id: str = None,
- name: str = None,
- avatar: str = None,
- max_chats_count: int = None,
- default_group_priority: str = None,
- groups: list = None,
- webhooks: dict = None,
- work_scheduler: dict = None,
- timezone: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates an existing Bot.
-
- Args:
- id (str): Bot's ID.
- name (str): Display name.
- avatar (str): Avatar URL.
- max_chats_count (int): Max. number of incoming chats that can be routed to the Bot.
- default_group_priority (str): The default routing priority for a group without defined priority.
- groups (list): Groups the Bot belongs to.
- webhooks (dict): Webhooks sent to the Bot.
- work_scheduler (dict): Work scheduler options to set for the new Bot.
- timezone (str): The time zone in which the Bot's work scheduler should operate.
- 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}/update_bot',
- json=payload,
- headers=headers)
-
- def list_bots(self,
- all: bool = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Bots created within a license.
-
- Args:
- all (bool): `True` gets all Bots within a license. `False` (default) returns only the requester's Bots.
- fields (list): Additional Bot fields to include.
- 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}/list_bots',
- json=payload,
- headers=headers)
-
- def get_bot(self,
- id: str = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets a Bot specified by `id`.
-
- Args:
- id (str): Bot's ID.
- fields (list): Additional Bot fields to include.
- 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}/get_bot',
- json=payload,
- headers=headers)
-
-# Groups
-
- def create_group(self,
- name: str = None,
- language_code: str = None,
- agent_priorities: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new group.
-
- Args:
- name (str): Group name (up to 180 chars).
- language_code (str): The code of the group languange.
- agent_priorities (dict): Agents' priorities in a group as a map in the "<id>": "<priority>" format.
- 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}/create_group',
- json=payload,
- headers=headers)
-
- def update_group(self,
- id: int = None,
- name: str = None,
- language_code: str = None,
- agent_priorities: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates an existing group.
-
- Args:
- id (int): Groups' ID.
- name (str): Group name (up to 180 chars).
- language_code (str): The code of the group languange.
- agent_priorities (dict): Agents' priorities in a group as a map in the "<id>": "<priority>" format.
- 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}/update_group',
- json=payload,
- headers=headers)
-
- def delete_group(self,
- id: int = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an existing group.
-
- Args:
- id (int): Groups' ID.
- 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}/delete_group',
- json=payload,
- headers=headers)
-
- def list_groups(self,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all the exisiting groups.
-
- Args:
- fields (list): Additional fields to include.
- 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}/list_groups',
- json=payload,
- headers=headers)
-
- def get_group(self,
- id: int = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns details about a group specified by its id.
-
- Args:
- id (int): Groups' ID.
- fields (list): Additional fields to include.
- 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}/get_group',
- json=payload,
- headers=headers)
-
-# Properties
-
- def register_property(self,
- name: str = None,
- owner_client_id: str = None,
- type: str = None,
- access: dict = None,
- description: str = None,
- domain: list = None,
- range: dict = None,
- default_value: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Registers a new private property for a given Client ID.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- type (str): Possible values: `int`, `string`, `bool`, and `tokenized_string`.
- access (dict): Destination access.
- description (str): Property description.
- domain (list): Array of values that properties can be set to.
- range (dict): Range of values that properties can be set to.
- default_value (str): Default value of property; validated by domain or range, if one exists.
- 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}/register_property',
- json=payload,
- headers=headers)
-
- def unregister_property(self,
- name: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unregisters a private property.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- 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}/unregister_property',
- json=payload,
- headers=headers)
-
- def publish_property(self,
- name: str = None,
- owner_client_id: str = None,
- access_type: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Publishes a private property.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- access_type (list): Possible values: `read`, `write`.
- 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}/publish_property',
- json=payload,
- headers=headers)
-
- def list_properties(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists private and public properties owned by a given Client ID.
-
- Args:
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- 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}/list_properties',
- json=payload,
- headers=headers)
-
- def update_license_properties(self,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates a property value within a license. This operation doesn't
- overwrite the existing values.
-
- Args:
- properties (dict): An object with namespaces as keys and properties (grouped in objects) as values.
- 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}/update_license_properties',
- json=payload,
- headers=headers)
-
- def list_license_properties(self,
- namespace: str = None,
- name_prefix: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties set within a license.
-
- Args:
- namespace (str): Properties namespace.
- name_prefix (str): Properties name prefix.
- 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}/list_license_properties',
- json=payload,
- headers=headers)
-
- def delete_license_properties(self,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes the properties set within a license.
-
- Args:
- properties (dict): An object with namespaces as keys and property_names (in an array) as values.
- 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}/delete_license_properties',
- json=payload,
- headers=headers)
-
- def update_group_properties(self,
- group_id: int = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates a property value within a group as the property location.
- This operation doesn't overwrite the existing values.
-
- Args:
- group_id (int): ID of the group you set the properties for.
- properties (dict): An object with namespaces as keys and properties (grouped in objects) as values.
- 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}/update_group_properties',
- json=payload,
- headers=headers)
-
- def list_group_properties(self,
- id: int = None,
- namespace: str = None,
- name_prefix: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties set within a group.
-
- Args:
- id (int): ID of the group you retrieve properties from.
- namespace (str): Properties namespace.
- name_prefix (str): Properties name prefix.
- 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}/list_group_properties',
- json=payload,
- headers=headers)
-
- def delete_group_properties(self,
- id: int = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes the properties set within a group.
-
- Args:
- id (int): ID of the group you delete properties from.
- properties (dict): An object with namespaces as keys and property_names (in an array) as values.
- 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}/delete_group_properties',
- json=payload,
- headers=headers)
-
-# Webhooks
-
- def register_webhook(self,
- action: str = None,
- secret_key: str = None,
- url: str = None,
- additional_data: list = None,
- description: str = None,
- filters: dict = None,
- owner_client_id: str = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Registers a webhook for the Client ID (application) provided in the request.
-
- Args:
- action (str): The action that triggers sending a webhook.
- secret_key (str): The secret key sent in webhooks to verify the source of a webhook.
- url (str): Destination URL for the webhook.
- additional_data (list): Additional data arriving with the webhook.
- description (str): Webhook description.
- filters (dict): Filters to check if a webhook should be triggered.
- owner_client_id (str): The Client ID for which the webhook will be registered.
- type (str): `bot` or `license`.
- 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}/register_webhook',
- json=payload,
- headers=headers)
-
- def list_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all webhooks registered for the given Client ID.
-
- Args:
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/list_webhooks',
- json=payload,
- headers=headers)
-
- def unregister_webhook(self,
- id: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unregisters a webhook previously registered for a Client ID (application).
-
- Args:
- id (str): Webhook's ID.
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/unregister_webhook',
- json=payload,
- headers=headers)
-
- def list_webhook_names(self,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all webhooks that are supported in a given API version. This method requires no authorization.
-
- Args:
- version (str): API's version. Defaults to the current stable API version.
- 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}/list_webhook_names',
- json=payload,
- headers=headers)
-
- def enable_license_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Enables the webhooks registered for a given Client ID (application)
- for the license associated with the access token used in the request.
-
- Args:
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/enable_license_webhooks',
- json=payload,
- headers=headers)
-
- def disable_license_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Disables the enabled webhooks.
-
- Args:
- owner_client_id (str): Required when authorizing via PATs; ignored otherwise.
- 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}/disable_license_webhooks',
- json=payload,
- headers=headers)
-
- def get_license_webhooks_state(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets the state of the webhooks registered for a given Client ID (application)
- on the license associated with the access token used in the request.
-
- Args:
- owner_client_id (str): Required when authorizing via PATs; ignored otherwise.
- 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}/get_license_webhooks_state',
- json=payload,
- headers=headers)
-
-
-# Other
-
- def get_license_id(self,
- organization_id: str = None,
- params: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns license ID by given organization ID.
-
- Args:
- organization_id (str): Organization ID to get license ID for.
- params (dict): Custom params to be used in request's query string.
- 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 params is None:
- params = prepare_payload(locals())
- return self.session.get(f'{self.api_url}/get_license_id',
- params=params,
- headers=headers)
-
- def get_organization_id(self,
- license_id: int = None,
- params: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns organization ID by given license ID.
-
- Args:
- license_id (int): License ID to get organization ID for.
- params (dict): Custom params to be used in request's query string.
- 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 params is None:
- params = prepare_payload(locals())
- return self.session.get(f'{self.api_url}/get_organization_id',
- params=params,
- headers=headers)
Creates an auto access data structure, which is a set of conditions
-for the tracking URL and geolocation of a customer.
-
Args
-
-
access : dict
-
Destination access.
-
conditions : dict
-
Conditions to check.
-
description : str
-
Description of the auto access.
-
next_id : str
-
ID of an existing auto access.
-
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.
-
-
-
-Expand source code
-
-
def add_auto_access(self,
- access: dict = None,
- conditions: dict = None,
- description: str = None,
- next_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates an auto access data structure, which is a set of conditions
- for the tracking URL and geolocation of a customer.
-
- Args:
- access (dict): Destination access.
- conditions (dict): Conditions to check.
- description (str): Description of the auto access.
- next_id (str): ID of an existing auto access.
- 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}/add_auto_access',
- json=payload,
- headers=headers)
Approves an Agent thus allowing the Agent to use the application.
-
Args
-
-
id : str
-
Agent's ID.
-
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.
-
-
-
-Expand source code
-
-
def approve_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Approves an Agent thus allowing the Agent to use the application.
-
- Args:
- id (str): Agent's ID.
- 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}/approve_agent',
- json=payload,
- headers=headers)
Creates a new Agent with specified parameters within a license.
-
Args
-
-
id : str
-
Agent's ID.
-
name : str
-
Agent's name.
-
role : str
-
Agent role, should be one of the following:
-viceowner, administrator, normal (default).
-
avatar_path : str
-
URL path of the Agent's avatar.
-
job_title : str
-
Agent's job title.
-
mobile : str
-
Agent's mobile number.
-
max_chats_count : int
-
Agent's maximum number of concurrent chats.
-
awaiting_approval : bool
-
Determines if the Agent will be awaiting
-approval after creation.
-
groups : list
-
Groups an Agent belongs to.
-
notifications : list
-
Represents which Agent notifications are turned on.
-
email_subscriptions : list
-
Represents which subscriptions will be send to
-the Agent via email.
-
work_scheduler : dict
-
Work scheduler options to set for the new Agent.
-
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.
-
-
-
-Expand source code
-
-
def create_agent(self,
- id: str = None,
- name: str = None,
- role: str = None,
- avatar_path: str = None,
- job_title: str = None,
- mobile: str = None,
- max_chats_count: int = None,
- awaiting_approval: bool = None,
- groups: list = None,
- notifications: list = None,
- email_subscriptions: list = None,
- work_scheduler: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Agent with specified parameters within a license.
-
- Args:
- id (str): Agent's ID.
- name (str): Agent's name.
- role (str): Agent role, should be one of the following:
- `viceowner`, `administrator`, `normal` (default).
- avatar_path (str): URL path of the Agent's avatar.
- job_title (str): Agent's job title.
- mobile (str): Agent's mobile number.
- max_chats_count (int): Agent's maximum number of concurrent chats.
- awaiting_approval (bool): Determines if the Agent will be awaiting
- approval after creation.
- groups (list): Groups an Agent belongs to.
- notifications (list): Represents which Agent notifications are turned on.
- email_subscriptions (list): Represents which subscriptions will be send to
- the Agent via email.
- work_scheduler (dict): Work scheduler options to set for the new Agent.
- 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}/create_agent',
- json=payload,
- headers=headers)
Max. number of incoming chats that can be routed to the Bot; default: 6.
-
default_group_priority : str
-
The default routing priority for a group without defined priority.
-
job_title : str
-
Bot's job title.
-
groups : list
-
Groups the Bot belongs to.
-
work_scheduler : dict
-
Work scheduler options to set for the new Bot.
-
timezone : str
-
The time zone in which the Bot's work scheduler should operate.
-
owner_client_id : str
-
Required only when authorizing via PATs.
-The request will be rejected if you provide owner_client_id when authorizing with a Bearer Token.
-
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.
-
-
-
-Expand source code
-
-
def create_bot(self,
- name: str = None,
- avatar: str = None,
- max_chats_count: int = None,
- default_group_priority: str = None,
- job_title: str = None,
- groups: list = None,
- work_scheduler: dict = None,
- timezone: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new Bot.
-
- Args:
- name (str): Display name.
- avatar (str): Avatar URL.
- max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6.
- default_group_priority (str): The default routing priority for a group without defined priority.
- job_title (str): Bot's job title.
- groups (list): Groups the Bot belongs to.
- work_scheduler (dict): Work scheduler options to set for the new Bot.
- timezone (str): The time zone in which the Bot's work scheduler should operate.
- owner_client_id (str): Required only when authorizing via PATs.
- The request will be rejected if you provide owner_client_id when authorizing with a Bearer Token.
- 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}/create_bot',
- json=payload,
- headers=headers)
Agents' priorities in a group as a map in the "": "" format.
-
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.
-
-
-
-Expand source code
-
-
def create_group(self,
- name: str = None,
- language_code: str = None,
- agent_priorities: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Creates a new group.
-
- Args:
- name (str): Group name (up to 180 chars).
- language_code (str): The code of the group languange.
- agent_priorities (dict): Agents' priorities in a group as a map in the "<id>": "<priority>" format.
- 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}/create_group',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def delete_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/delete_agent',
- json=payload,
- headers=headers)
Deletes an existing auto access data structure specified by its ID.
-
Args
-
-
id : str
-
Auto access ID.
-
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.
-
-
-
-Expand source code
-
-
def delete_auto_access(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an existing auto access data structure specified by its ID.
-
- Args:
- id (str): Auto access ID.
- 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}/delete_auto_access',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def delete_bot(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes a Bot.
-
- Args:
- id (str): Bot's ID.
- 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}/delete_bot',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def delete_group(self,
- id: int = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes an existing group.
-
- Args:
- id (int): Groups' ID.
- 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}/delete_group',
- json=payload,
- headers=headers)
An object with namespaces as keys and property_names (in an array) as values.
-
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.
-
-
-
-Expand source code
-
-
def delete_group_properties(self,
- id: int = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes the properties set within a group.
-
- Args:
- id (int): ID of the group you delete properties from.
- properties (dict): An object with namespaces as keys and property_names (in an array) as values.
- 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}/delete_group_properties',
- json=payload,
- headers=headers)
An object with namespaces as keys and property_names (in an array) as values.
-
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.
-
-
-
-Expand source code
-
-
def delete_license_properties(self,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes the properties set within a license.
-
- Args:
- properties (dict): An object with namespaces as keys and property_names (in an array) as values.
- 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}/delete_license_properties',
- json=payload,
- headers=headers)
Required when authorizing via PATs; ignored otherwise.
-
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.
-
-
-
-Expand source code
-
-
def disable_license_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Disables the enabled webhooks.
-
- Args:
- owner_client_id (str): Required when authorizing via PATs; ignored otherwise.
- 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}/disable_license_webhooks',
- json=payload,
- headers=headers)
Enables the webhooks registered for a given Client ID (application)
-for the license associated with the access token used in the request.
-
Args
-
-
owner_client_id : str
-
The webhook owner (the Client ID for which the webhook is registered).
-
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.
-
-
-
-Expand source code
-
-
def enable_license_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Enables the webhooks registered for a given Client ID (application)
- for the license associated with the access token used in the request.
-
- Args:
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/enable_license_webhooks',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def get_agent(self,
- id: str = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- fields (list): Additional fields to include.
- 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}/get_agent',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def get_bot(self,
- id: str = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets a Bot specified by `id`.
-
- Args:
- id (str): Bot's ID.
- fields (list): Additional Bot fields to include.
- 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}/get_bot',
- json=payload,
- headers=headers)
Returns details about a group specified by its id.
-
Args
-
-
id : int
-
Groups' ID.
-
fields : list
-
Additional fields to include.
-
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.
-
-
-
-Expand source code
-
-
def get_group(self,
- id: int = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns details about a group specified by its id.
-
- Args:
- id (int): Groups' ID.
- fields (list): Additional fields to include.
- 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}/get_group',
- json=payload,
- headers=headers)
Custom params to be used in request's query string.
-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.
-
-
-
-Expand source code
-
-
def get_license_id(self,
- organization_id: str = None,
- params: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns license ID by given organization ID.
-
- Args:
- organization_id (str): Organization ID to get license ID for.
- params (dict): Custom params to be used in request's query string.
- 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 params is None:
- params = prepare_payload(locals())
- return self.session.get(f'{self.api_url}/get_license_id',
- params=params,
- headers=headers)
Gets the state of the webhooks registered for a given Client ID (application)
-on the license associated with the access token used in the request.
-
Args
-
-
owner_client_id : str
-
Required when authorizing via PATs; ignored otherwise.
-
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.
-
-
-
-Expand source code
-
-
def get_license_webhooks_state(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets the state of the webhooks registered for a given Client ID (application)
- on the license associated with the access token used in the request.
-
- Args:
- owner_client_id (str): Required when authorizing via PATs; ignored otherwise.
- 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}/get_license_webhooks_state',
- json=payload,
- headers=headers)
Custom params to be used in request's query string.
-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.
-
-
-
-Expand source code
-
-
def get_organization_id(self,
- license_id: int = None,
- params: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns organization ID by given license ID.
-
- Args:
- license_id (int): License ID to get organization ID for.
- params (dict): Custom params to be used in request's query string.
- 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 params is None:
- params = prepare_payload(locals())
- return self.session.get(f'{self.api_url}/get_organization_id',
- params=params,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def list_agents(self,
- filters: dict = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns all Agents within a license.
-
- Args:
- filters (dict): Possible request filters.
- fields (list): Additional fields to include.
- 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}/list_agents',
- json=payload,
- headers=headers)
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.
-
-
-Expand source code
-
-
def list_auto_accesses(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns all existing auto access data structures.
-
- Args:
- 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}/list_auto_accesses',
- json=payload,
- headers=headers)
Returns the list of Bots created within a license.
-
Args
-
-
all : bool
-
True gets all Bots within a license. False (default) returns only the requester's Bots.
-
fields : list
-
Additional Bot fields to include.
-
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.
-
-
-
-Expand source code
-
-
def list_bots(self,
- all: bool = None,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the list of Bots created within a license.
-
- Args:
- all (bool): `True` gets all Bots within a license. `False` (default) returns only the requester's Bots.
- fields (list): Additional Bot fields to include.
- 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}/list_bots',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def list_group_properties(self,
- id: int = None,
- namespace: str = None,
- name_prefix: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties set within a group.
-
- Args:
- id (int): ID of the group you retrieve properties from.
- namespace (str): Properties namespace.
- name_prefix (str): Properties name prefix.
- 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}/list_group_properties',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def list_groups(self,
- fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all the exisiting groups.
-
- Args:
- fields (list): Additional fields to include.
- 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}/list_groups',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def list_license_properties(self,
- namespace: str = None,
- name_prefix: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties set within a license.
-
- Args:
- namespace (str): Properties namespace.
- name_prefix (str): Properties name prefix.
- 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}/list_license_properties',
- json=payload,
- headers=headers)
Lists private and public properties owned by a given Client ID.
-
Args
-
-
owner_client_id : str
-
Client ID that will own the property; must be owned by your organization.
-
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.
-
-
-
-Expand source code
-
-
def list_properties(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists private and public properties owned by a given Client ID.
-
- Args:
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- 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}/list_properties',
- json=payload,
- headers=headers)
Lists all webhooks that are supported in a given API version. This method requires no authorization.
-
Args
-
-
version : str
-
API's version. Defaults to the current stable API version.
-
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.
-
-
-
-Expand source code
-
-
def list_webhook_names(self,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all webhooks that are supported in a given API version. This method requires no authorization.
-
- Args:
- version (str): API's version. Defaults to the current stable API version.
- 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}/list_webhook_names',
- json=payload,
- headers=headers)
Lists all webhooks registered for the given Client ID.
-
Args
-
-
owner_client_id : str
-
The webhook owner (the Client ID for which the webhook is registered).
-
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.
-
-
-
-Expand source code
-
-
def list_webhooks(self,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Lists all webhooks registered for the given Client ID.
-
- Args:
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/list_webhooks',
- json=payload,
- headers=headers)
Client ID that will own the property; must be owned by your organization.
-
access_type : list
-
Possible values: read, write.
-
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.
-
-
-
-Expand source code
-
-
def publish_property(self,
- name: str = None,
- owner_client_id: str = None,
- access_type: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Publishes a private property.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- access_type (list): Possible values: `read`, `write`.
- 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}/publish_property',
- json=payload,
- headers=headers)
Registers a new private property for a given Client ID.
-
Args
-
-
name : str
-
Property name.
-
owner_client_id : str
-
Client ID that will own the property; must be owned by your organization.
-
type : str
-
Possible values: int, string, bool, and tokenized_string.
-
access : dict
-
Destination access.
-
description : str
-
Property description.
-
domain : list
-
Array of values that properties can be set to.
-
range : dict
-
Range of values that properties can be set to.
-
default_value : str
-
Default value of property; validated by domain or range, if one exists.
-
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.
-
-
-
-Expand source code
-
-
def register_property(self,
- name: str = None,
- owner_client_id: str = None,
- type: str = None,
- access: dict = None,
- description: str = None,
- domain: list = None,
- range: dict = None,
- default_value: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Registers a new private property for a given Client ID.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- type (str): Possible values: `int`, `string`, `bool`, and `tokenized_string`.
- access (dict): Destination access.
- description (str): Property description.
- domain (list): Array of values that properties can be set to.
- range (dict): Range of values that properties can be set to.
- default_value (str): Default value of property; validated by domain or range, if one exists.
- 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}/register_property',
- json=payload,
- headers=headers)
Registers a webhook for the Client ID (application) provided in the request.
-
Args
-
-
action : str
-
The action that triggers sending a webhook.
-
secret_key : str
-
The secret key sent in webhooks to verify the source of a webhook.
-
url : str
-
Destination URL for the webhook.
-
additional_data : list
-
Additional data arriving with the webhook.
-
description : str
-
-
Webhook description.
-
-
filters : dict
-
Filters to check if a webhook should be triggered.
-
owner_client_id : str
-
The Client ID for which the webhook will be registered.
-
type : str
-
bot or license.
-
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.
-
-
-
-Expand source code
-
-
def register_webhook(self,
- action: str = None,
- secret_key: str = None,
- url: str = None,
- additional_data: list = None,
- description: str = None,
- filters: dict = None,
- owner_client_id: str = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Registers a webhook for the Client ID (application) provided in the request.
-
- Args:
- action (str): The action that triggers sending a webhook.
- secret_key (str): The secret key sent in webhooks to verify the source of a webhook.
- url (str): Destination URL for the webhook.
- additional_data (list): Additional data arriving with the webhook.
- description (str): Webhook description.
- filters (dict): Filters to check if a webhook should be triggered.
- owner_client_id (str): The Client ID for which the webhook will be registered.
- type (str): `bot` or `license`.
- 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}/register_webhook',
- json=payload,
- headers=headers)
A suspended Agent can send emails to license owners and vice owners
-with an unsuspension request.
-
Args
-
-
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.
-
-
-
-Expand source code
-
-
def request_agent_unsuspension(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' A suspended Agent can send emails to license owners and vice owners
- with an unsuspension request.
-
- Args:
- 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}/request_agent_unsuspension',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def suspend_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Suspends an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/suspend_agent',
- json=payload,
- headers=headers)
Client ID that will own the property; must be owned by your organization.
-
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.
-
-
-
-Expand source code
-
-
def unregister_property(self,
- name: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unregisters a private property.
-
- Args:
- name (str): Property name.
- owner_client_id (str): Client ID that will own the property; must be owned by your organization.
- 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}/unregister_property',
- json=payload,
- headers=headers)
Unregisters a webhook previously registered for a Client ID (application).
-
Args
-
-
id : str
-
Webhook's ID.
-
owner_client_id : str
-
The webhook owner (the Client ID for which the webhook is registered).
-
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.
-
-
-
-Expand source code
-
-
def unregister_webhook(self,
- id: str = None,
- owner_client_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unregisters a webhook previously registered for a Client ID (application).
-
- Args:
- id (str): Webhook's ID.
- owner_client_id (str): The webhook owner (the Client ID for which the webhook is registered).
- 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}/unregister_webhook',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def unsuspend_agent(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Unsuspends an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- 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}/unsuspend_agent',
- json=payload,
- headers=headers)
Updates the properties of an Agent specified by id.
-
Args
-
-
id : str
-
Agent's ID.
-
name : str
-
Agent's name.
-
role : str
-
Agent role, should be one of the following:
-viceowner, administrator, normal (default).
-
avatar_path : str
-
URL path of the Agent's avatar.
-
job_title : str
-
Agent's job title.
-
mobile : str
-
Agent's mobile number.
-
max_chats_count : int
-
Agent's maximum number of concurrent chats.
-
groups : list
-
Groups an Agent belongs to.
-
notifications : list
-
Represents which Agent notifications are turned on.
-
email_subscriptions : list
-
Represents which subscriptions will be send to
-the Agent via email.
-
work_scheduler : dict
-
Work scheduler options to set for the new Agent.
-
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.
-
-
-
-Expand source code
-
-
def update_agent(self,
- id: str = None,
- name: str = None,
- role: str = None,
- avatar_path: str = None,
- job_title: str = None,
- mobile: str = None,
- max_chats_count: int = None,
- groups: list = None,
- notifications: list = None,
- email_subscriptions: list = None,
- work_scheduler: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates the properties of an Agent specified by `id`.
-
- Args:
- id (str): Agent's ID.
- name (str): Agent's name.
- role (str): Agent role, should be one of the following:
- `viceowner`, `administrator`, `normal` (default).
- avatar_path (str): URL path of the Agent's avatar.
- job_title (str): Agent's job title.
- mobile (str): Agent's mobile number.
- max_chats_count (int): Agent's maximum number of concurrent chats.
- groups (list): Groups an Agent belongs to.
- notifications (list): Represents which Agent notifications are turned on.
- email_subscriptions (list): Represents which subscriptions will be send to
- the Agent via email.
- work_scheduler (dict): Work scheduler options to set for the new Agent.
- 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}/update_agent',
- json=payload,
- headers=headers)
Moves an existing auto access data structure, specified by id,
-before another one, specified by next_id.
-
Args
-
-
id : str
-
ID of the auto access to move.
-
next_id : str
-
ID of the auto access that should follow the moved auto access.
-
access : dict
-
Destination access.
-
conditions : dict
-
Conditions to check.
-
description : str
-
Description of the auto access.
-
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.
-
-
-
-Expand source code
-
-
def update_auto_access(self,
- id: str = None,
- next_id: str = None,
- access: dict = None,
- conditions: dict = None,
- description: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Moves an existing auto access data structure, specified by id,
- before another one, specified by next_id.
-
- Args:
- id (str): ID of the auto access to move.
- next_id (str): ID of the auto access that should follow the moved auto access.
- access (dict): Destination access.
- conditions (dict): Conditions to check.
- description (str): Description of the auto access.
- 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}/update_auto_access',
- json=payload,
- headers=headers)
Max. number of incoming chats that can be routed to the Bot.
-
default_group_priority : str
-
The default routing priority for a group without defined priority.
-
groups : list
-
Groups the Bot belongs to.
-
webhooks : dict
-
Webhooks sent to the Bot.
-
work_scheduler : dict
-
Work scheduler options to set for the new Bot.
-
timezone : str
-
The time zone in which the Bot's work scheduler should operate.
-
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.
-
-
-
-Expand source code
-
-
def update_bot(self,
- id: str = None,
- name: str = None,
- avatar: str = None,
- max_chats_count: int = None,
- default_group_priority: str = None,
- groups: list = None,
- webhooks: dict = None,
- work_scheduler: dict = None,
- timezone: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates an existing Bot.
-
- Args:
- id (str): Bot's ID.
- name (str): Display name.
- avatar (str): Avatar URL.
- max_chats_count (int): Max. number of incoming chats that can be routed to the Bot.
- default_group_priority (str): The default routing priority for a group without defined priority.
- groups (list): Groups the Bot belongs to.
- webhooks (dict): Webhooks sent to the Bot.
- work_scheduler (dict): Work scheduler options to set for the new Bot.
- timezone (str): The time zone in which the Bot's work scheduler should operate.
- 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}/update_bot',
- json=payload,
- headers=headers)
Agents' priorities in a group as a map in the "": "" format.
-
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.
-
-
-
-Expand source code
-
-
def update_group(self,
- id: int = None,
- name: str = None,
- language_code: str = None,
- agent_priorities: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates an existing group.
-
- Args:
- id (int): Groups' ID.
- name (str): Group name (up to 180 chars).
- language_code (str): The code of the group languange.
- agent_priorities (dict): Agents' priorities in a group as a map in the "<id>": "<priority>" format.
- 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}/update_group',
- json=payload,
- headers=headers)
Updates a property value within a group as the property location.
-This operation doesn't overwrite the existing values.
-
Args
-
-
group_id : int
-
ID of the group you set the properties for.
-
properties : dict
-
An object with namespaces as keys and properties (grouped in objects) as values.
-
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.
-
-
-
-Expand source code
-
-
def update_group_properties(self,
- group_id: int = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates a property value within a group as the property location.
- This operation doesn't overwrite the existing values.
-
- Args:
- group_id (int): ID of the group you set the properties for.
- properties (dict): An object with namespaces as keys and properties (grouped in objects) as values.
- 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}/update_group_properties',
- json=payload,
- headers=headers)
Updates a property value within a license. This operation doesn't
-overwrite the existing values.
-
Args
-
-
properties : dict
-
An object with namespaces as keys and properties (grouped in objects) as values.
-
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.
-
-
-
-Expand source code
-
-
def update_license_properties(self,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates a property value within a license. This operation doesn't
- overwrite the existing values.
-
- Args:
- properties (dict): An object with namespaces as keys and properties (grouped in objects) as values.
- 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}/update_license_properties',
- json=payload,
- headers=headers)
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/configuration/base.html b/docs/configuration/base.html
index 308eb9b..1f50a17 100644
--- a/docs/configuration/base.html
+++ b/docs/configuration/base.html
@@ -40,7 +40,6 @@
Module livechat.configuration.base
import httpx
from livechat.config import CONFIG
-from livechat.configuration.api.v34 import ConfigurationApiV34
from livechat.configuration.api.v35 import ConfigurationApiV35
from livechat.configuration.api.v36 import ConfigurationApiV36
from livechat.configuration.api.v37 import ConfigurationApiV37
@@ -63,7 +62,7 @@
Customer RTM API module with client class in version 3.4.
-
-
-Expand source code
-
-
''' Customer RTM API module with client class in version 3.4. '''
-
-# pylint: disable=C0103,R0903,R0913,W0107,W0231,W0613,W0622
-
-from typing import Callable, Optional, Union
-
-from livechat.utils.helpers import prepare_payload
-from livechat.utils.structures import AccessToken, RtmResponse
-from livechat.utils.ws_client import WebsocketClient
-
-
-class CustomerRtmV34:
- ''' Customer RTM API client class in version 3.4. '''
- def __init__(
- self,
- organization_id: str,
- base_url: str,
- header: Union[list, dict, Callable, None],
- ):
- if isinstance(organization_id, str):
- self.ws = WebsocketClient(
- url=
- f'wss://{base_url}/v3.4/customer/rtm/ws?organization_id={organization_id}',
- header=header)
- else:
- raise ValueError(
- f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.'
- )
-
- def open_connection(self,
- origin: dict = None,
- ping_timeout: Union[float, int] = 3,
- ping_interval: Union[float, int] = 5,
- ws_conn_timeout: Union[float, int] = 10,
- keep_alive: bool = True,
- response_timeout: Union[float, int] = 3) -> None:
- ''' Opens WebSocket connection.
-
- Args:
- origin (dict): Specifies origin while creating websocket connection.
- ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
- by default sets to 3 seconds.
- ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
- If set to 0, no ping is sent periodically, by default sets to 5 seconds.
- ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
- by default sets to 10 seconds.
- keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
- response_timeout (int or float): timeout (in seconds) to wait for the response,
- by default sets to 3 seconds.
- '''
- self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
- keep_alive, response_timeout)
-
- def close_connection(self) -> None:
- ''' Closes WebSocket connection. '''
- self.ws.close()
-
-# Chats
-
- def list_chats(self,
- limit: int = None,
- sort_order: str = None,
- page_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
-
- Args:
- limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
- creation date of its last thread.
- page_id (str): Page ID.
- 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': 'list_chats', 'payload': payload})
-
- def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- min_events_count: int = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns threads that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): Chat ID to get threads from.
- sort_order (str): Possible values: asc - oldest threads first and desc
- newest threads first (default).
- limit (int): Default: 3, maximum: 100.
- page_id (str): Page ID.
- min_events_count (int):Range: 1-100; Specifies the minimum number of
- events to be returned in the response.
- 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': 'list_threads', 'payload': payload})
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns a thread that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
- 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': 'get_chat', 'payload': payload})
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Starts a chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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': 'start_chat', 'payload': payload})
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to false, creates an inactive thread; default: true.
- continuous (bool): Sets a chat to the continuous mode. When unset, leaves the mode unchanged.
- 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': 'resume_chat', 'payload': payload})
-
- def deactivate_chat(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Deactivates a chat by closing the currently open thread.
-
- Args:
- id (str): Chat ID to deactivate.
- 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': 'deactivate_chat', 'payload': payload})
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends an Event object.
-
- Args:
- chat_id (str): ID of the chat you want to send the message to.
- event (dict): Event object.
- attach_to_last_thread (bool): Flag which states if event object should be added to last thread.
- 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', 'payload': payload})
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- postback: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send a rich message to.
- thread_id (str): ID of the thread.
- event_id (str): ID of the event.
- postback (dict): Postback object.
- 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_rich_message_postback',
- 'payload': payload
- })
-
- def send_sneak_peek(self,
- chat_id: str = None,
- sneak_peek_text: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a sneak peek to a chat.
-
- Args:
- chat_id (str): ID of the chat to send a sneak peek to.
- sneak_peek_text (str): Sneak peek text.
- 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_sneak_peek', 'payload': payload})
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- 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': 'update_chat_properties',
- 'payload': payload
- })
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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': 'delete_chat_properties',
- 'payload': payload
- })
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_thread_properties',
- 'payload': payload
- })
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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': 'delete_thread_properties',
- 'payload': payload
- })
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_event_properties',
- 'payload': payload
- })
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- event_id (str): ID of the event you want to delete the properties of.
- properties (dict): Event properties to delete.
- 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': 'delete_event_properties',
- 'payload': payload
- })
-
-# Customers
-
- def update_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates customer's properties.
-
- Args:
- name (str): Customer`s name.
- email (str): Customer`s email.
- avatar (str): Customer`s avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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': 'update_customer', 'payload': payload})
-
- def update_customer_page(self,
- url: str = None,
- title: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates customer's page.
-
- Args:
- url (str): Customer`s url.
- title (str): Customer`s page title.
- 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': 'update_customer_page',
- 'payload': payload
- })
-
- def set_customer_session_fields(self,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Sets customer's session fields.
-
- Args:
- session_fields (list): List of custom object-enclosed key:value pairs.
- 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': 'set_customer_session_fields',
- 'payload': payload
- })
-
- def get_customer(self, payload: dict = None) -> RtmResponse:
- ''' Returns the info about the customer requesting it.
-
- 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': 'get_customer',
- 'payload': {} if payload is None else payload
- })
-
-# Status
-
- def login(self,
- token: Optional[Union[AccessToken, str]] = None,
- payload: dict = None) -> RtmResponse:
- ''' Logs in customer.
-
- Args:
- token (str) : OAuth token from the Customer's account.
- 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 token:
- token = str(token)
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({'action': 'login', 'payload': payload})
-
- def list_group_statuses(self,
- all: bool = None,
- group_ids: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Lists statuses of groups.
-
- Args:
- all (bool): If set to True, you will get statuses of all the groups.
- group_ids (list): A table of a groups' IDs.
- 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': 'list_group_statuses',
- 'payload': payload
- })
-
-
-# Other
-
- def get_form(self,
- group_id: int = None,
- type: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns an empty ticket form of a prechat or postchat survey.
-
- Args:
- group_id (int): ID of the group from which you want the form.
- type (str): Form type. Possible values: prechat or postchat.
- 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': 'get_form', 'payload': payload})
-
- def get_predicted_agent(self, payload: dict = None) -> RtmResponse:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-
- 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': 'get_predicted_agent',
- 'payload': {} if payload is None else payload
- })
-
- def get_url_info(self,
- url: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns the info on a given URL.
-
- Args:
- url (str): URL to get info about.
- 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': 'get_url_info', 'payload': payload})
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks events as seen by agent.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format.
- 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': 'mark_events_as_seen',
- 'payload': payload
- })
-
- def accept_greeting(self,
- greeting_id: int = None,
- unique_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks an incoming greeting as seen.
-
- Args:
- greeting_id (int): Number representing type of a greeting.
- unique_id (str): Specific greeting event ID.
- 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': 'accept_greeting', 'payload': payload})
-
- def cancel_greeting(self,
- unique_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Cancels a greeting.
-
- Args:
- unique_id (str): Specific greeting event ID.
- 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': 'cancel_greeting', 'payload': payload})
class CustomerRtmV34:
- ''' Customer RTM API client class in version 3.4. '''
- def __init__(
- self,
- organization_id: str,
- base_url: str,
- header: Union[list, dict, Callable, None],
- ):
- if isinstance(organization_id, str):
- self.ws = WebsocketClient(
- url=
- f'wss://{base_url}/v3.4/customer/rtm/ws?organization_id={organization_id}',
- header=header)
- else:
- raise ValueError(
- f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.'
- )
-
- def open_connection(self,
- origin: dict = None,
- ping_timeout: Union[float, int] = 3,
- ping_interval: Union[float, int] = 5,
- ws_conn_timeout: Union[float, int] = 10,
- keep_alive: bool = True,
- response_timeout: Union[float, int] = 3) -> None:
- ''' Opens WebSocket connection.
-
- Args:
- origin (dict): Specifies origin while creating websocket connection.
- ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
- by default sets to 3 seconds.
- ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
- If set to 0, no ping is sent periodically, by default sets to 5 seconds.
- ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
- by default sets to 10 seconds.
- keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
- response_timeout (int or float): timeout (in seconds) to wait for the response,
- by default sets to 3 seconds.
- '''
- self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
- keep_alive, response_timeout)
-
- def close_connection(self) -> None:
- ''' Closes WebSocket connection. '''
- self.ws.close()
-
-# Chats
-
- def list_chats(self,
- limit: int = None,
- sort_order: str = None,
- page_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
-
- Args:
- limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
- creation date of its last thread.
- page_id (str): Page ID.
- 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': 'list_chats', 'payload': payload})
-
- def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- min_events_count: int = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns threads that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): Chat ID to get threads from.
- sort_order (str): Possible values: asc - oldest threads first and desc
- newest threads first (default).
- limit (int): Default: 3, maximum: 100.
- page_id (str): Page ID.
- min_events_count (int):Range: 1-100; Specifies the minimum number of
- events to be returned in the response.
- 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': 'list_threads', 'payload': payload})
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns a thread that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
- 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': 'get_chat', 'payload': payload})
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Starts a chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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': 'start_chat', 'payload': payload})
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Chat object.
- active (bool): When set to false, creates an inactive thread; default: true.
- continuous (bool): Sets a chat to the continuous mode. When unset, leaves the mode unchanged.
- 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': 'resume_chat', 'payload': payload})
-
- def deactivate_chat(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Deactivates a chat by closing the currently open thread.
-
- Args:
- id (str): Chat ID to deactivate.
- 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': 'deactivate_chat', 'payload': payload})
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends an Event object.
-
- Args:
- chat_id (str): ID of the chat you want to send the message to.
- event (dict): Event object.
- attach_to_last_thread (bool): Flag which states if event object should be added to last thread.
- 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', 'payload': payload})
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- postback: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send a rich message to.
- thread_id (str): ID of the thread.
- event_id (str): ID of the event.
- postback (dict): Postback object.
- 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_rich_message_postback',
- 'payload': payload
- })
-
- def send_sneak_peek(self,
- chat_id: str = None,
- sneak_peek_text: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a sneak peek to a chat.
-
- Args:
- chat_id (str): ID of the chat to send a sneak peek to.
- sneak_peek_text (str): Sneak peek text.
- 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_sneak_peek', 'payload': payload})
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- 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': 'update_chat_properties',
- 'payload': payload
- })
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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': 'delete_chat_properties',
- 'payload': payload
- })
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_thread_properties',
- 'payload': payload
- })
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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': 'delete_thread_properties',
- 'payload': payload
- })
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_event_properties',
- 'payload': payload
- })
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- event_id (str): ID of the event you want to delete the properties of.
- properties (dict): Event properties to delete.
- 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': 'delete_event_properties',
- 'payload': payload
- })
-
-# Customers
-
- def update_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates customer's properties.
-
- Args:
- name (str): Customer`s name.
- email (str): Customer`s email.
- avatar (str): Customer`s avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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': 'update_customer', 'payload': payload})
-
- def update_customer_page(self,
- url: str = None,
- title: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates customer's page.
-
- Args:
- url (str): Customer`s url.
- title (str): Customer`s page title.
- 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': 'update_customer_page',
- 'payload': payload
- })
-
- def set_customer_session_fields(self,
- session_fields: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Sets customer's session fields.
-
- Args:
- session_fields (list): List of custom object-enclosed key:value pairs.
- 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': 'set_customer_session_fields',
- 'payload': payload
- })
-
- def get_customer(self, payload: dict = None) -> RtmResponse:
- ''' Returns the info about the customer requesting it.
-
- 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': 'get_customer',
- 'payload': {} if payload is None else payload
- })
-
-# Status
-
- def login(self,
- token: Optional[Union[AccessToken, str]] = None,
- payload: dict = None) -> RtmResponse:
- ''' Logs in customer.
-
- Args:
- token (str) : OAuth token from the Customer's account.
- 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 token:
- token = str(token)
- if payload is None:
- payload = prepare_payload(locals())
- return self.ws.send({'action': 'login', 'payload': payload})
-
- def list_group_statuses(self,
- all: bool = None,
- group_ids: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Lists statuses of groups.
-
- Args:
- all (bool): If set to True, you will get statuses of all the groups.
- group_ids (list): A table of a groups' IDs.
- 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': 'list_group_statuses',
- 'payload': payload
- })
-
-
-# Other
-
- def get_form(self,
- group_id: int = None,
- type: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns an empty ticket form of a prechat or postchat survey.
-
- Args:
- group_id (int): ID of the group from which you want the form.
- type (str): Form type. Possible values: prechat or postchat.
- 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': 'get_form', 'payload': payload})
-
- def get_predicted_agent(self, payload: dict = None) -> RtmResponse:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-
- 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': 'get_predicted_agent',
- 'payload': {} if payload is None else payload
- })
-
- def get_url_info(self,
- url: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns the info on a given URL.
-
- Args:
- url (str): URL to get info about.
- 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': 'get_url_info', 'payload': payload})
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks events as seen by agent.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format.
- 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': 'mark_events_as_seen',
- 'payload': payload
- })
-
- def accept_greeting(self,
- greeting_id: int = None,
- unique_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks an incoming greeting as seen.
-
- Args:
- greeting_id (int): Number representing type of a greeting.
- unique_id (str): Specific greeting event ID.
- 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': 'accept_greeting', 'payload': payload})
-
- def cancel_greeting(self,
- unique_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Cancels a greeting.
-
- Args:
- unique_id (str): Specific greeting event ID.
- 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': 'cancel_greeting', 'payload': payload})
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)
-
-
-
-Expand source code
-
-
def accept_greeting(self,
- greeting_id: int = None,
- unique_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks an incoming greeting as seen.
-
- Args:
- greeting_id (int): Number representing type of a greeting.
- unique_id (str): Specific greeting event ID.
- 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': 'accept_greeting', 'payload': payload})
Deactivates a chat by closing the currently open thread.
-
Args
-
-
id : str
-
Chat ID to deactivate.
-
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)
-
-
-
-Expand source code
-
-
def deactivate_chat(self,
- id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Deactivates a chat by closing the currently open thread.
-
- Args:
- id (str): Chat ID to deactivate.
- 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': 'deactivate_chat', 'payload': payload})
ID of the chat you want to delete the properties of.
-
thread_id : str
-
ID of the thread you want to delete the properties of.
-
event_id : str
-
ID of the event you want to delete the properties of.
-
properties : dict
-
Event properties to delete.
-
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)
-
-
-
-Expand source code
-
-
def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- event_id (str): ID of the event you want to delete the properties of.
- properties (dict): Event properties to delete.
- 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': 'delete_event_properties',
- 'payload': payload
- })
It returns a thread that the current Customer has access to in a given chat.
-
Args
-
-
chat_id : str
-
ID of a chat to get.
-
thread_id : str
-
Thread ID to get. Default: the latest thread (if exists).
-
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)
-
-
-
-Expand source code
-
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns a thread that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of a chat to get.
- thread_id (str): Thread ID to get. Default: the latest thread (if exists).
- 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': 'get_chat', 'payload': payload})
Returns the info about the customer requesting it.
-
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)
-
-
-
-Expand source code
-
-
def get_customer(self, payload: dict = None) -> RtmResponse:
- ''' Returns the info about the customer requesting it.
-
- 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': 'get_customer',
- 'payload': {} if payload is None else payload
- })
Returns an empty ticket form of a prechat or postchat survey.
-
Args
-
-
group_id : int
-
ID of the group from which you want the form.
-
type : str
-
Form type. Possible values: prechat or postchat.
-
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)
-
-
-
-Expand source code
-
-
def get_form(self,
- group_id: int = None,
- type: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Returns an empty ticket form of a prechat or postchat survey.
-
- Args:
- group_id (int): ID of the group from which you want the form.
- type (str): Form type. Possible values: prechat or postchat.
- 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': 'get_form', 'payload': payload})
Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-
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)
-
-
-
-Expand source code
-
-
def get_predicted_agent(self, payload: dict = None) -> RtmResponse:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-
- 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': 'get_predicted_agent',
- 'payload': {} if payload is None else payload
- })
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)
-
-
-
-Expand source code
-
-
def get_url_info(self,
- url: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns the info on a given URL.
-
- Args:
- url (str): URL to get info about.
- 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': 'get_url_info', 'payload': payload})
It returns summaries of the chats a Customer participated in.
-
Args
-
-
limit : int
-
Chat limit. Default: 10, maximum: 25.
-
sort_order : str
-
Possible values: asc, desc (default). Chat summaries are sorted by the
-creation date of its last thread.
-
page_id : str
-
Page ID.
-
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)
-
-
-
-Expand source code
-
-
def list_chats(self,
- limit: int = None,
- sort_order: str = None,
- page_id: str = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
-
- Args:
- limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
- creation date of its last thread.
- page_id (str): Page ID.
- 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': 'list_chats', 'payload': payload})
If set to True, you will get statuses of all the groups.
-
group_ids : list
-
A table of a groups' IDs.
-
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)
-
-
-
-Expand source code
-
-
def list_group_statuses(self,
- all: bool = None,
- group_ids: list = None,
- payload: dict = None) -> RtmResponse:
- ''' Lists statuses of groups.
-
- Args:
- all (bool): If set to True, you will get statuses of all the groups.
- group_ids (list): A table of a groups' IDs.
- 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': 'list_group_statuses',
- 'payload': payload
- })
It returns threads that the current Customer has access to in a given chat.
-
Args
-
-
chat_id : str
-
Chat ID to get threads from.
-
sort_order : str
-
Possible values: asc - oldest threads first and desc
-newest threads first (default).
-
limit : int
-
Default: 3, maximum: 100.
-
page_id : str
-
Page ID.
-
min_events_count (int):Range: 1-100; Specifies the minimum number of
-
events to be returned in the response.
-
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)
-
-
-
-Expand source code
-
-
def list_threads(self,
- chat_id: str = None,
- sort_order: str = None,
- limit: int = None,
- page_id: str = None,
- min_events_count: int = None,
- payload: dict = None) -> RtmResponse:
- ''' It returns threads that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): Chat ID to get threads from.
- sort_order (str): Possible values: asc - oldest threads first and desc
- newest threads first (default).
- limit (int): Default: 3, maximum: 100.
- page_id (str): Page ID.
- min_events_count (int):Range: 1-100; Specifies the minimum number of
- events to be returned in the response.
- 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': 'list_threads', 'payload': payload})
Date up to which mark events - RFC 3339 date-time format.
-
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)
-
-
-
-Expand source code
-
-
def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Marks events as seen by agent.
-
- Args:
- chat_id (str): Chat to mark events.
- seen_up_to (str): Date up to which mark events - RFC 3339 date-time format.
- 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': 'mark_events_as_seen',
- 'payload': payload
- })
Specifies origin while creating websocket connection.
-
ping_timeout : int or float
-
timeout (in seconds) if the pong message is not received,
-by default sets to 3 seconds.
-
ping_interval : int or float
-
automatically sends "ping" command every specified period (in seconds).
-If set to 0, no ping is sent periodically, by default sets to 5 seconds.
-
ws_conn_timeout : int or float
-
timeout (in seconds) to wait for WebSocket connection,
-by default sets to 10 seconds.
-
keep_alive(bool): Bool which states if connection should be kept, by default sets to True.
-
response_timeout : int or float
-
timeout (in seconds) to wait for the response,
-by default sets to 3 seconds.
-
-
-
-Expand source code
-
-
def open_connection(self,
- origin: dict = None,
- ping_timeout: Union[float, int] = 3,
- ping_interval: Union[float, int] = 5,
- ws_conn_timeout: Union[float, int] = 10,
- keep_alive: bool = True,
- response_timeout: Union[float, int] = 3) -> None:
- ''' Opens WebSocket connection.
-
- Args:
- origin (dict): Specifies origin while creating websocket connection.
- ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
- by default sets to 3 seconds.
- ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
- If set to 0, no ping is sent periodically, by default sets to 5 seconds.
- ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
- by default sets to 10 seconds.
- keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
- response_timeout (int or float): timeout (in seconds) to wait for the response,
- by default sets to 3 seconds.
- '''
- self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
- keep_alive, response_timeout)
Flag which states if event object should be added to last thread.
-
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)
-
-
-
-Expand source code
-
-
def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends an Event object.
-
- Args:
- chat_id (str): ID of the chat you want to send the message to.
- event (dict): Event object.
- attach_to_last_thread (bool): Flag which states if event object should be added to last thread.
- 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', 'payload': payload})
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)
-
-
-
-Expand source code
-
-
def send_sneak_peek(self,
- chat_id: str = None,
- sneak_peek_text: str = None,
- payload: dict = None) -> RtmResponse:
- ''' Sends a sneak peek to a chat.
-
- Args:
- chat_id (str): ID of the chat to send a sneak peek to.
- sneak_peek_text (str): Sneak peek text.
- 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_sneak_peek', 'payload': payload})
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)
-
-
-
-Expand source code
-
-
def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_event_properties',
- 'payload': payload
- })
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)
-
-
-
-Expand source code
-
-
def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None) -> RtmResponse:
- ''' Updates thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Chat properties to set.
- 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': 'update_thread_properties',
- 'payload': payload
- })
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/customer/rtm/api/v35.html b/docs/customer/rtm/api/v35.html
index d8261ae..8f4a051 100644
--- a/docs/customer/rtm/api/v35.html
+++ b/docs/customer/rtm/api/v35.html
@@ -704,7 +704,7 @@
sort_order: str = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
+ ''' It returns chat info for the chats a Customer participated in.
Args:
limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id (str): Page ID.
payload (dict): Custom payload to be used as request's data.
@@ -468,7 +468,9 @@
Args:
name (str): Customer`s name.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Customer`s email.
+ phone_number (str): Customer`s phone number.
avatar (str): Customer`s avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -514,6 +518,40 @@
Module livechat.customer.rtm.api.v36
'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:
@@ -634,6 +672,22 @@
Module livechat.customer.rtm.api.v36
'action': 'get_predicted_agent',
'payload': {} if payload is None else payload
})
+
+ def request_welcome_message(self, payload: dict = None) -> RtmResponse:
+ ''' Requests a welcome message.
+
+ 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': 'request_welcome_message',
+ 'payload': {} if payload is None else payload
+ })
def get_url_info(self,
url: str = None,
@@ -726,7 +780,7 @@
sort_order: str = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
+ ''' It returns chat info for the chats a Customer participated in.
Args:
limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id (str): Page ID.
payload (dict): Custom payload to be used as request's data.
@@ -1164,7 +1218,9 @@
Args:
name (str): Customer`s name.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Customer`s email.
+ phone_number (str): Customer`s phone number.
avatar (str): Customer`s avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -1210,6 +1268,40 @@
Classes
'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:
@@ -1330,6 +1422,22 @@
Classes
'action': 'get_predicted_agent',
'payload': {} if payload is None else payload
})
+
+ def request_welcome_message(self, payload: dict = None) -> RtmResponse:
+ ''' Requests a welcome message.
+
+ 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': 'request_welcome_message',
+ 'payload': {} if payload is None else payload
+ })
def get_url_info(self,
url: str = None,
@@ -1458,6 +1566,45 @@
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)
+
+
+
+Expand source code
+
+
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
+ })
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)
+
+
+
+Expand source code
+
+
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
+ })
It returns summaries of the chats a Customer participated in.
+
It returns chat info for the chats a Customer participated in.
Args
limit : int
Chat limit. Default: 10, maximum: 25.
sort_order : str
-
Possible values: asc, desc (default). Chat summaries are sorted by the
+
Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id : str
Page ID.
@@ -2008,11 +2194,11 @@
Returns
sort_order: str = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
+ ''' It returns chat info for the chats a Customer participated in.
Args:
limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id (str): Page ID.
payload (dict): Custom payload to be used as request's data.
@@ -2138,7 +2324,7 @@
Args:
name (str): Customer`s name.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Customer`s email.
+ phone_number (str): Customer`s phone number.
avatar (str): Customer`s avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -2865,9 +3097,11 @@
sort_order: str = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
+ ''' It returns chat info for the chats a Customer participated in.
Args:
limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id (str): Page ID.
payload (dict): Custom payload to be used as request's data.
@@ -468,7 +468,9 @@
Args:
name (str): Customer`s name.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Customer`s email.
+ phone_number (str): Customer`s phone number.
avatar (str): Customer`s avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -514,6 +518,40 @@
Module livechat.customer.rtm.api.v37
'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:
@@ -619,8 +657,8 @@
Module livechat.customer.rtm.api.v37
payload = prepare_payload(locals())
return self.ws.send({'action': 'get_form', 'payload': payload})
- def get_predicted_agent(self, payload: dict = None) -> RtmResponse:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
+ def request_welcome_message(self, payload: dict = None) -> RtmResponse:
+ ''' Requests a welcome message.
Args:
payload (dict): Custom payload to be used as request's data.
@@ -631,7 +669,7 @@
Module livechat.customer.rtm.api.v37
`type`, `success` and `payload` properties)
'''
return self.ws.send({
- 'action': 'get_predicted_agent',
+ 'action': 'request_welcome_message',
'payload': {} if payload is None else payload
})
@@ -726,7 +764,7 @@
sort_order: str = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
+ ''' It returns chat info for the chats a Customer participated in.
Args:
limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id (str): Page ID.
payload (dict): Custom payload to be used as request's data.
@@ -1164,7 +1202,9 @@
Args:
name (str): Customer`s name.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Customer`s email.
+ phone_number (str): Customer`s phone number.
avatar (str): Customer`s avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -1210,6 +1252,40 @@
Classes
'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:
@@ -1315,8 +1391,8 @@
Classes
payload = prepare_payload(locals())
return self.ws.send({'action': 'get_form', 'payload': payload})
- def get_predicted_agent(self, payload: dict = None) -> RtmResponse:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
+ def request_welcome_message(self, payload: dict = None) -> RtmResponse:
+ ''' Requests a welcome message.
Args:
payload (dict): Custom payload to be used as request's data.
@@ -1327,7 +1403,7 @@
Classes
`type`, `success` and `payload` properties)
'''
return self.ws.send({
- 'action': 'get_predicted_agent',
+ 'action': 'request_welcome_message',
'payload': {} if payload is None else payload
})
@@ -1458,6 +1534,45 @@
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)
+
+
+
+Expand source code
+
+
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
+ })
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)
+
+
+
+Expand source code
+
+
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
+ })
Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-
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)
-
-
-
-Expand source code
-
-
def get_predicted_agent(self, payload: dict = None) -> RtmResponse:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-
- 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': 'get_predicted_agent',
- 'payload': {} if payload is None else payload
- })
It returns summaries of the chats a Customer participated in.
+
It returns chat info for the chats a Customer participated in.
Args
limit : int
Chat limit. Default: 10, maximum: 25.
sort_order : str
-
Possible values: asc, desc (default). Chat summaries are sorted by the
+
Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id : str
Page ID.
@@ -2008,11 +2124,11 @@
Returns
sort_order: str = None,
page_id: str = None,
payload: dict = None) -> RtmResponse:
- ''' It returns summaries of the chats a Customer participated in.
+ ''' It returns chat info for the chats a Customer participated in.
Args:
limit (int): Chat limit. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default). Chat summaries are sorted by the
+ sort_order (str): Possible values: asc, desc (default). Chat info entries are sorted by the
creation date of its last thread.
page_id (str): Page ID.
payload (dict): Custom payload to be used as request's data.
@@ -2138,7 +2254,7 @@
Args:
name (str): Customer`s name.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Customer`s email.
+ phone_number (str): Customer`s phone number.
avatar (str): Customer`s avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -2865,9 +3027,11 @@
from typing import Callable, Union
from livechat.config import CONFIG
-from livechat.customer.rtm.api.v34 import CustomerRtmV34
from livechat.customer.rtm.api.v35 import CustomerRtmV35
from livechat.customer.rtm.api.v36 import CustomerRtmV36
from livechat.customer.rtm.api.v37 import CustomerRtmV37
@@ -51,7 +50,7 @@
Module containing Customer Web API client class in v3.4.
-
-
-Expand source code
-
-
''' Module containing Customer Web API client class in v3.4. '''
-from __future__ import annotations
-
-import typing
-
-import httpx
-
-from livechat.utils.helpers import prepare_payload
-from livechat.utils.http_client import HttpClient
-from livechat.utils.structures import AccessToken
-
-
-class CustomerWebV34(HttpClient):
- ''' Customer Web API Class containing methods in version 3.4. '''
- def __init__(self,
- organization_id: str,
- access_token: typing.Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- if all([access_token, isinstance(access_token, str)]):
- super().__init__(access_token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- else:
- raise ValueError(
- 'Incorrect or missing `access_token` argument (should be of type str.)'
- )
-
- self.api_url = f'https://{base_url}/v3.4/customer/action'
- if isinstance(organization_id, str):
- self.organization_id = organization_id
- self.query_string = f'?organization_id={organization_id}'
- else:
- raise ValueError(
- 'Incorrect or missing `organization_id` argument (should be of type str.)'
- )
-
-# Chats
-
- def list_chats(self,
- limit: int = None,
- sort_order: str = None,
- page_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
-
- Args:
- limit (int): Limit of results per page. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
- page_id (str): ID of the page with paginated results.
- 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}/list_chats{self.query_string}',
- json=payload,
- headers=headers)
-
- def list_threads(self,
- chat_id: str = None,
- limit: str = None,
- sort_order: str = None,
- page_id: str = None,
- min_events_count: int = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns threads that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which threads are to be listed.
- limit (str): Limit of results per page. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
- page_id (str): ID of the page with paginated results.
- min_events_count (int): Range: 1-100;
- Specifies the minimum number of events to be returned in the response.
- 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}/list_threads{self.query_string}',
- json=payload,
- headers=headers)
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
- 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}/get_chat{self.query_string}',
- json=payload,
- headers=headers)
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Starts a chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/start_chat{self.query_string}',
- json=payload,
- headers=headers)
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/resume_chat{self.query_string}',
- json=payload,
- headers=headers)
-
- def deactivate_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deactivates a chat by closing the currently open thread.
- Sending messages to this thread will no longer be possible.
-
- Args:
- id (str): ID of chat to be deactivated.
- 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}/deactivate_chat{self.query_string}',
- json=payload,
- headers=headers)
-
-# Configuration
-
- def get_dynamic_configuration(self,
- group_id: int = None,
- url: str = None,
- channel_type: str = None,
- test: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the dynamic configuration of a given group.
- It provides data to call Get Configuration and Get Localization.
-
- Args:
- group_id (int): The ID of the group that you want to get a dynamic configuration for. ID of the default group is used if not provided.
- url (str): The URL that you want to get a dynamic configuration for.
- channel_type (str): The channel type that you want to get a dynamic configuration for.
- test (bool): Treats a dynamic configuration request as a test.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_dynamic_configuration',
- params=payload,
- headers=headers)
-
- def get_configuration(self,
- group_id: int = None,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the configuration of a given group in a given version. Contains data based on which the Chat Widget can be built.
-
- Args:
- group_id (int): The ID of the group that you want to get a configuration for.
- version (str): The version that you want to get a configuration for.
- Returned from Get Dynamic Configuration as the config_version parameter.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_configuration',
- params=payload,
- headers=headers)
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
- The method updates the requester's `events_seen_up_to` as if they've seen all chat events.
-
- Args:
- chat_id (int): ID of the chat that you to send a message to.
- event (dict): The event object.
- attach_to_last_thread (bool): The flag is ignored for active chats.
- For inactive chats:
- True – the event will be added to the last thread;
- False – the request will fail. Default: False.
- 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{self.query_string}',
- json=payload,
- headers=headers)
-
- def upload_file(self,
- file: typing.BinaryIO = None,
- headers: dict = None) -> httpx.Response:
- ''' Uploads a file to the server as a temporary file. It returns a URL that expires after 24 hours unless the URL is used in `send_event`.
-
- Args:
- file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
- 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. '''
- return self.session.post(
- f'{self.api_url}/upload_file{self.query_string}',
- files=file,
- headers=headers)
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- event_id: str = None,
- postback: dict = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send rich message postback to.
- event_id (str): ID of the event related to the rich message postback.
- postback (dict): Object containing postback data (id, toggled).
- thread_id (str): ID of the thread to send rich message postback to.
- 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_rich_message_postback{self.query_string}',
- json=payload,
- headers=headers)
-
- def send_sneak_peek(self,
- chat_id: str = None,
- sneak_peek_text: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a sneak peek to a chat.
-
- Args:
- chat_id (str): ID of the chat to send a sneak peek to.
- sneak_peek_text (str): Sneak peek text.
- 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_sneak_peek{self.query_string}',
- json=payload,
- headers=headers)
-
-# Localization
-
- def get_localization(self,
- group_id: int = None,
- language: str = None,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the localization of a given language and group in a given version. Contains translated phrases for the Chat Widget.
-
- Args:
- group_id (int): ID of the group that you want to get a localization for.
- language (str): The language that you want to get a localization for.
- version (str): The version that you want to get a localization for.
- Returned from `get_dynamic_configuration` as the `localization_version` parameter.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_localization',
- params=payload,
- headers=headers)
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_chat_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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}/delete_chat_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_thread_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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}/delete_thread_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_event_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you to delete the properties for.
- thread_id (str): ID of the thread you want to delete the properties for.
- event_id (str): ID of the event you want to delete the properties for.
- properties (dict): Event properties to delete.
- 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}/delete_event_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def list_license_properties(self,
- namespace: str = None,
- name: str = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties of a given license. It only returns the properties a Customer has access to.
-
- Args:
- namespace (str): Property namespace to retrieve.
- name (str): Property name.
- 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. '''
- params = {}
- if namespace:
- params['namespace'] = namespace
- if name:
- params['name'] = name
- params['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/list_license_properties',
- params=params,
- headers=headers)
-
- def list_group_properties(self,
- group_id: int = None,
- namespace: str = None,
- name: str = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties of a given group. It only returns the properties a Customer has access to.
- Args:
- group_id (int): ID of the group you want to return the properties of.
- namespace (str): Property namespace to retrieve.
- name (str): Property name.
- 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. '''
- params = {}
- if namespace:
- params['namespace'] = namespace
- if name:
- params['name'] = name
- if group_id is not None:
- params['id'] = str(group_id)
- params['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/list_group_properties',
- params=params,
- headers=headers)
-
-# Customers
-
- def get_customer(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer requesting it.
-
- Args:
- 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.
- '''
- return self.session.post(
- f'{self.api_url}/get_customer{self.query_string}',
- json={} if payload is None else payload,
- headers=headers)
-
- def update_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's properties.
-
- Args:
- name (str): Name of the customer.
- email (str): Email of the customer.
- avatar (str): The URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/update_customer{self.query_string}',
- json=payload,
- headers=headers)
-
- def set_customer_session_fields(self,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's session fields.
-
- Args:
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items. Max keys: 100.
- 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}/set_customer_session_fields{self.query_string}',
- json=payload,
- headers=headers)
-
-# Status
-
- def list_group_statuses(self,
- all: bool = None,
- group_ids: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns object with info about current routing statuses of agent groups.
- One of the optional parameters needs to be included in the request.
-
- Args:
- all (bool): If set to True, you will get statuses of all the groups.
- group_ids (list): A table of groups' IDs
- 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}/list_group_statuses{self.query_string}',
- json=payload,
- headers=headers)
-
-
-# Other
-
- def check_goals(self,
- session_fields: list = None,
- group_id: int = None,
- page_url: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Customer can use this method to trigger checking if goals were achieved.
- Then, Agents receive the information. You should call this method to provide goals parameters for the server
- when the customers limit is reached. Works only for offline Customers.
-
- Args:
- session_fields (list): An array of custom object-enclosed key:value pairs.
- group_id (int): Group ID to check the goals for.
- page_url (str): URL of the page to check the goals for.
- 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}/check_goals{self.query_string}',
- json=payload,
- headers=headers)
-
- def get_form(self,
- group_id: int = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns an empty ticket form of a prechat or postchat survey.
-
- Args:
- group_id (int): ID of the group from which you want the form.
- type (str): Form type; possible values: prechat or postchat.
- 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}/get_form{self.query_string}',
- json=payload,
- headers=headers)
-
- def get_predicted_agent(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
- To use this method, the Customer needs to be logged in, which can be done via the `login` method.
-
- Args:
- 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.
- '''
- return self.session.post(
- f'{self.api_url}/get_predicted_agent{self.query_string}',
- json={} if payload is None else payload,
- headers=headers)
-
- def get_url_info(self,
- url: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info on a given URL.
-
- Args:
- url (str): Valid website URL.
- 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}/get_url_info{self.query_string}',
- json=payload,
- headers=headers)
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates `seen_up_to` value for a given chat.
-
- Args:
- chat_id (str): ID of the chat to update `seen_up_to`.
- seen_up_to (str): RFC 3339 date-time format.
- 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}/mark_events_as_seen{self.query_string}',
- json=payload,
- headers=headers)
-
- def accept_greeting(self,
- greeting_id: int = None,
- unique_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks an incoming greeting as seen.
-
- Args:
- greeting_id (int): ID of the greeting configured within the license to accept.
- unique_id (str): ID of the greeting to accept. You can get it from the `incoming_greeting` push.
- 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}/accept_greeting{self.query_string}',
- json=payload,
- headers=headers)
-
- def cancel_greeting(self,
- unique_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Cancels a greeting (an invitation to the chat).
- For example, Customers could cancel greetings by minimalizing the chat widget with a greeting.
-
- Args:
- unique_id (str): ID of the greeting to cancel. You can get it from the `incoming_greeting` push.
- 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}/cancel_greeting{self.query_string}',
- json=payload,
- headers=headers)
-
- def request_email_verification(self,
- callback_uri: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Requests the verification of the customer's email address by sending them a verification email
- with the identity confirmation link.
-
- Args:
- callback_uri (str): URI to be called after the customer confirms their email address.
- 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}/request_email_verification{self.query_string}',
- json=payload,
- headers=headers)
Customer Web API Class containing methods in version 3.4.
-
-
-Expand source code
-
-
class CustomerWebV34(HttpClient):
- ''' Customer Web API Class containing methods in version 3.4. '''
- def __init__(self,
- organization_id: str,
- access_token: typing.Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- if all([access_token, isinstance(access_token, str)]):
- super().__init__(access_token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- else:
- raise ValueError(
- 'Incorrect or missing `access_token` argument (should be of type str.)'
- )
-
- self.api_url = f'https://{base_url}/v3.4/customer/action'
- if isinstance(organization_id, str):
- self.organization_id = organization_id
- self.query_string = f'?organization_id={organization_id}'
- else:
- raise ValueError(
- 'Incorrect or missing `organization_id` argument (should be of type str.)'
- )
-
-# Chats
-
- def list_chats(self,
- limit: int = None,
- sort_order: str = None,
- page_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
-
- Args:
- limit (int): Limit of results per page. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
- page_id (str): ID of the page with paginated results.
- 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}/list_chats{self.query_string}',
- json=payload,
- headers=headers)
-
- def list_threads(self,
- chat_id: str = None,
- limit: str = None,
- sort_order: str = None,
- page_id: str = None,
- min_events_count: int = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns threads that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which threads are to be listed.
- limit (str): Limit of results per page. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
- page_id (str): ID of the page with paginated results.
- min_events_count (int): Range: 1-100;
- Specifies the minimum number of events to be returned in the response.
- 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}/list_threads{self.query_string}',
- json=payload,
- headers=headers)
-
- def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
- 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}/get_chat{self.query_string}',
- json=payload,
- headers=headers)
-
- def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Starts a chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/start_chat{self.query_string}',
- json=payload,
- headers=headers)
-
- def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/resume_chat{self.query_string}',
- json=payload,
- headers=headers)
-
- def deactivate_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deactivates a chat by closing the currently open thread.
- Sending messages to this thread will no longer be possible.
-
- Args:
- id (str): ID of chat to be deactivated.
- 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}/deactivate_chat{self.query_string}',
- json=payload,
- headers=headers)
-
-# Configuration
-
- def get_dynamic_configuration(self,
- group_id: int = None,
- url: str = None,
- channel_type: str = None,
- test: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the dynamic configuration of a given group.
- It provides data to call Get Configuration and Get Localization.
-
- Args:
- group_id (int): The ID of the group that you want to get a dynamic configuration for. ID of the default group is used if not provided.
- url (str): The URL that you want to get a dynamic configuration for.
- channel_type (str): The channel type that you want to get a dynamic configuration for.
- test (bool): Treats a dynamic configuration request as a test.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_dynamic_configuration',
- params=payload,
- headers=headers)
-
- def get_configuration(self,
- group_id: int = None,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the configuration of a given group in a given version. Contains data based on which the Chat Widget can be built.
-
- Args:
- group_id (int): The ID of the group that you want to get a configuration for.
- version (str): The version that you want to get a configuration for.
- Returned from Get Dynamic Configuration as the config_version parameter.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_configuration',
- params=payload,
- headers=headers)
-
-# Events
-
- def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
- The method updates the requester's `events_seen_up_to` as if they've seen all chat events.
-
- Args:
- chat_id (int): ID of the chat that you to send a message to.
- event (dict): The event object.
- attach_to_last_thread (bool): The flag is ignored for active chats.
- For inactive chats:
- True – the event will be added to the last thread;
- False – the request will fail. Default: False.
- 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{self.query_string}',
- json=payload,
- headers=headers)
-
- def upload_file(self,
- file: typing.BinaryIO = None,
- headers: dict = None) -> httpx.Response:
- ''' Uploads a file to the server as a temporary file. It returns a URL that expires after 24 hours unless the URL is used in `send_event`.
-
- Args:
- file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
- 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. '''
- return self.session.post(
- f'{self.api_url}/upload_file{self.query_string}',
- files=file,
- headers=headers)
-
- def send_rich_message_postback(self,
- chat_id: str = None,
- event_id: str = None,
- postback: dict = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send rich message postback to.
- event_id (str): ID of the event related to the rich message postback.
- postback (dict): Object containing postback data (id, toggled).
- thread_id (str): ID of the thread to send rich message postback to.
- 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_rich_message_postback{self.query_string}',
- json=payload,
- headers=headers)
-
- def send_sneak_peek(self,
- chat_id: str = None,
- sneak_peek_text: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a sneak peek to a chat.
-
- Args:
- chat_id (str): ID of the chat to send a sneak peek to.
- sneak_peek_text (str): Sneak peek text.
- 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_sneak_peek{self.query_string}',
- json=payload,
- headers=headers)
-
-# Localization
-
- def get_localization(self,
- group_id: int = None,
- language: str = None,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the localization of a given language and group in a given version. Contains translated phrases for the Chat Widget.
-
- Args:
- group_id (int): ID of the group that you want to get a localization for.
- language (str): The language that you want to get a localization for.
- version (str): The version that you want to get a localization for.
- Returned from `get_dynamic_configuration` as the `localization_version` parameter.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_localization',
- params=payload,
- headers=headers)
-
-# Properties
-
- def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_chat_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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}/delete_chat_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_thread_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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}/delete_thread_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_event_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you to delete the properties for.
- thread_id (str): ID of the thread you want to delete the properties for.
- event_id (str): ID of the event you want to delete the properties for.
- properties (dict): Event properties to delete.
- 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}/delete_event_properties{self.query_string}',
- json=payload,
- headers=headers)
-
- def list_license_properties(self,
- namespace: str = None,
- name: str = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties of a given license. It only returns the properties a Customer has access to.
-
- Args:
- namespace (str): Property namespace to retrieve.
- name (str): Property name.
- 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. '''
- params = {}
- if namespace:
- params['namespace'] = namespace
- if name:
- params['name'] = name
- params['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/list_license_properties',
- params=params,
- headers=headers)
-
- def list_group_properties(self,
- group_id: int = None,
- namespace: str = None,
- name: str = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties of a given group. It only returns the properties a Customer has access to.
- Args:
- group_id (int): ID of the group you want to return the properties of.
- namespace (str): Property namespace to retrieve.
- name (str): Property name.
- 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. '''
- params = {}
- if namespace:
- params['namespace'] = namespace
- if name:
- params['name'] = name
- if group_id is not None:
- params['id'] = str(group_id)
- params['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/list_group_properties',
- params=params,
- headers=headers)
-
-# Customers
-
- def get_customer(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer requesting it.
-
- Args:
- 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.
- '''
- return self.session.post(
- f'{self.api_url}/get_customer{self.query_string}',
- json={} if payload is None else payload,
- headers=headers)
-
- def update_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's properties.
-
- Args:
- name (str): Name of the customer.
- email (str): Email of the customer.
- avatar (str): The URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/update_customer{self.query_string}',
- json=payload,
- headers=headers)
-
- def set_customer_session_fields(self,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's session fields.
-
- Args:
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items. Max keys: 100.
- 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}/set_customer_session_fields{self.query_string}',
- json=payload,
- headers=headers)
-
-# Status
-
- def list_group_statuses(self,
- all: bool = None,
- group_ids: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns object with info about current routing statuses of agent groups.
- One of the optional parameters needs to be included in the request.
-
- Args:
- all (bool): If set to True, you will get statuses of all the groups.
- group_ids (list): A table of groups' IDs
- 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}/list_group_statuses{self.query_string}',
- json=payload,
- headers=headers)
-
-
-# Other
-
- def check_goals(self,
- session_fields: list = None,
- group_id: int = None,
- page_url: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Customer can use this method to trigger checking if goals were achieved.
- Then, Agents receive the information. You should call this method to provide goals parameters for the server
- when the customers limit is reached. Works only for offline Customers.
-
- Args:
- session_fields (list): An array of custom object-enclosed key:value pairs.
- group_id (int): Group ID to check the goals for.
- page_url (str): URL of the page to check the goals for.
- 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}/check_goals{self.query_string}',
- json=payload,
- headers=headers)
-
- def get_form(self,
- group_id: int = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns an empty ticket form of a prechat or postchat survey.
-
- Args:
- group_id (int): ID of the group from which you want the form.
- type (str): Form type; possible values: prechat or postchat.
- 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}/get_form{self.query_string}',
- json=payload,
- headers=headers)
-
- def get_predicted_agent(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
- To use this method, the Customer needs to be logged in, which can be done via the `login` method.
-
- Args:
- 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.
- '''
- return self.session.post(
- f'{self.api_url}/get_predicted_agent{self.query_string}',
- json={} if payload is None else payload,
- headers=headers)
-
- def get_url_info(self,
- url: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info on a given URL.
-
- Args:
- url (str): Valid website URL.
- 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}/get_url_info{self.query_string}',
- json=payload,
- headers=headers)
-
- def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates `seen_up_to` value for a given chat.
-
- Args:
- chat_id (str): ID of the chat to update `seen_up_to`.
- seen_up_to (str): RFC 3339 date-time format.
- 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}/mark_events_as_seen{self.query_string}',
- json=payload,
- headers=headers)
-
- def accept_greeting(self,
- greeting_id: int = None,
- unique_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks an incoming greeting as seen.
-
- Args:
- greeting_id (int): ID of the greeting configured within the license to accept.
- unique_id (str): ID of the greeting to accept. You can get it from the `incoming_greeting` push.
- 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}/accept_greeting{self.query_string}',
- json=payload,
- headers=headers)
-
- def cancel_greeting(self,
- unique_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Cancels a greeting (an invitation to the chat).
- For example, Customers could cancel greetings by minimalizing the chat widget with a greeting.
-
- Args:
- unique_id (str): ID of the greeting to cancel. You can get it from the `incoming_greeting` push.
- 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}/cancel_greeting{self.query_string}',
- json=payload,
- headers=headers)
-
- def request_email_verification(self,
- callback_uri: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Requests the verification of the customer's email address by sending them a verification email
- with the identity confirmation link.
-
- Args:
- callback_uri (str): URI to be called after the customer confirms their email address.
- 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}/request_email_verification{self.query_string}',
- json=payload,
- headers=headers)
ID of the greeting configured within the license to accept.
-
unique_id : str
-
ID of the greeting to accept. You can get it from the incoming_greeting push.
-
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.
-
-
-
-Expand source code
-
-
def accept_greeting(self,
- greeting_id: int = None,
- unique_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Marks an incoming greeting as seen.
-
- Args:
- greeting_id (int): ID of the greeting configured within the license to accept.
- unique_id (str): ID of the greeting to accept. You can get it from the `incoming_greeting` push.
- 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}/accept_greeting{self.query_string}',
- json=payload,
- headers=headers)
Cancels a greeting (an invitation to the chat).
-For example, Customers could cancel greetings by minimalizing the chat widget with a greeting.
-
Args
-
-
unique_id : str
-
ID of the greeting to cancel. You can get it from the incoming_greeting push.
-
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.
-
-
-
-Expand source code
-
-
def cancel_greeting(self,
- unique_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Cancels a greeting (an invitation to the chat).
- For example, Customers could cancel greetings by minimalizing the chat widget with a greeting.
-
- Args:
- unique_id (str): ID of the greeting to cancel. You can get it from the `incoming_greeting` push.
- 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}/cancel_greeting{self.query_string}',
- json=payload,
- headers=headers)
Customer can use this method to trigger checking if goals were achieved.
-Then, Agents receive the information. You should call this method to provide goals parameters for the server
-when the customers limit is reached. Works only for offline Customers.
-
Args
-
-
session_fields : list
-
An array of custom object-enclosed key:value pairs.
-
group_id : int
-
Group ID to check the goals for.
-
page_url : str
-
URL of the page to check the goals for.
-
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.
-
-
-
-Expand source code
-
-
def check_goals(self,
- session_fields: list = None,
- group_id: int = None,
- page_url: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Customer can use this method to trigger checking if goals were achieved.
- Then, Agents receive the information. You should call this method to provide goals parameters for the server
- when the customers limit is reached. Works only for offline Customers.
-
- Args:
- session_fields (list): An array of custom object-enclosed key:value pairs.
- group_id (int): Group ID to check the goals for.
- page_url (str): URL of the page to check the goals for.
- 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}/check_goals{self.query_string}',
- json=payload,
- headers=headers)
Deactivates a chat by closing the currently open thread.
-Sending messages to this thread will no longer be possible.
-
Args
-
-
id : str
-
ID of chat to be deactivated.
-
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.
-
-
-
-Expand source code
-
-
def deactivate_chat(self,
- id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deactivates a chat by closing the currently open thread.
- Sending messages to this thread will no longer be possible.
-
- Args:
- id (str): ID of chat to be deactivated.
- 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}/deactivate_chat{self.query_string}',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def delete_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat properties.
-
- Args:
- id (str): ID of the chat you want to delete properties of.
- properties (dict): Chat properties to delete.
- 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}/delete_chat_properties{self.query_string}',
- json=payload,
- headers=headers)
ID of the thread you want to delete the properties for.
-
event_id : str
-
ID of the event you want to delete the properties for.
-
properties : dict
-
Event properties to delete.
-
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.
-
-
-
-Expand source code
-
-
def delete_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes event properties.
-
- Args:
- chat_id (str): ID of the chat you to delete the properties for.
- thread_id (str): ID of the thread you want to delete the properties for.
- event_id (str): ID of the event you want to delete the properties for.
- properties (dict): Event properties to delete.
- 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}/delete_event_properties{self.query_string}',
- json=payload,
- headers=headers)
ID of the chat you want to delete the properties of.
-
thread_id : str
-
ID of the thread you want to delete the properties of.
-
properties : dict
-
Thread properties to delete.
-
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.
-
-
-
-Expand source code
-
-
def delete_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Deletes chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you want to delete the properties of.
- thread_id (str): ID of the thread you want to delete the properties of.
- properties (dict): Thread properties to delete.
- 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}/delete_thread_properties{self.query_string}',
- json=payload,
- headers=headers)
Returns a thread that the current Customer has access to in a given chat.
-
Args
-
-
chat_id : str
-
ID of the chat for which thread is to be returned.
-
thread_id : str
-
ID of the thread to show. Default: the latest thread (if exists)
-
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.
-
-
-
-Expand source code
-
-
def get_chat(self,
- chat_id: str = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns a thread that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which thread is to be returned.
- thread_id (str): ID of the thread to show. Default: the latest thread (if exists)
- 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}/get_chat{self.query_string}',
- json=payload,
- headers=headers)
Returns the configuration of a given group in a given version. Contains data based on which the Chat Widget can be built.
-
Args
-
-
group_id : int
-
The ID of the group that you want to get a configuration for.
-
version : str
-
The version that you want to get a configuration for.
-Returned from Get Dynamic Configuration as the config_version parameter.
-
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.
-
-
-
-Expand source code
-
-
def get_configuration(self,
- group_id: int = None,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the configuration of a given group in a given version. Contains data based on which the Chat Widget can be built.
-
- Args:
- group_id (int): The ID of the group that you want to get a configuration for.
- version (str): The version that you want to get a configuration for.
- Returned from Get Dynamic Configuration as the config_version parameter.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_configuration',
- params=payload,
- headers=headers)
Returns the info about the Customer requesting it.
-
Args
-
-
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.
-
-
-
-Expand source code
-
-
def get_customer(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info about the Customer requesting it.
-
- Args:
- 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.
- '''
- return self.session.post(
- f'{self.api_url}/get_customer{self.query_string}',
- json={} if payload is None else payload,
- headers=headers)
Returns the dynamic configuration of a given group.
-It provides data to call Get Configuration and Get Localization.
-
Args
-
-
group_id : int
-
The ID of the group that you want to get a dynamic configuration for. ID of the default group is used if not provided.
-
url : str
-
The URL that you want to get a dynamic configuration for.
-
channel_type : str
-
The channel type that you want to get a dynamic configuration for.
-
test : bool
-
Treats a dynamic configuration request as a test.
-
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.
-
-
-
-Expand source code
-
-
def get_dynamic_configuration(self,
- group_id: int = None,
- url: str = None,
- channel_type: str = None,
- test: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the dynamic configuration of a given group.
- It provides data to call Get Configuration and Get Localization.
-
- Args:
- group_id (int): The ID of the group that you want to get a dynamic configuration for. ID of the default group is used if not provided.
- url (str): The URL that you want to get a dynamic configuration for.
- channel_type (str): The channel type that you want to get a dynamic configuration for.
- test (bool): Treats a dynamic configuration request as a test.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_dynamic_configuration',
- params=payload,
- headers=headers)
Returns an empty ticket form of a prechat or postchat survey.
-
Args
-
-
group_id : int
-
ID of the group from which you want the form.
-
type : str
-
Form type; possible values: prechat or postchat.
-
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.
-
-
-
-Expand source code
-
-
def get_form(self,
- group_id: int = None,
- type: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns an empty ticket form of a prechat or postchat survey.
-
- Args:
- group_id (int): ID of the group from which you want the form.
- type (str): Form type; possible values: prechat or postchat.
- 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}/get_form{self.query_string}',
- json=payload,
- headers=headers)
Returns the localization of a given language and group in a given version. Contains translated phrases for the Chat Widget.
-
Args
-
-
group_id : int
-
ID of the group that you want to get a localization for.
-
language : str
-
The language that you want to get a localization for.
-
version : str
-
The version that you want to get a localization for.
-Returned from get_dynamic_configuration as the localization_version parameter.
-
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.
-
-
-
-Expand source code
-
-
def get_localization(self,
- group_id: int = None,
- language: str = None,
- version: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the localization of a given language and group in a given version. Contains translated phrases for the Chat Widget.
-
- Args:
- group_id (int): ID of the group that you want to get a localization for.
- language (str): The language that you want to get a localization for.
- version (str): The version that you want to get a localization for.
- Returned from `get_dynamic_configuration` as the `localization_version` parameter.
- 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())
- payload['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/get_localization',
- params=payload,
- headers=headers)
Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-To use this method, the Customer needs to be logged in, which can be done via the login method.
-
Args
-
-
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.
-
-
-
-Expand source code
-
-
def get_predicted_agent(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
- To use this method, the Customer needs to be logged in, which can be done via the `login` method.
-
- Args:
- 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.
- '''
- return self.session.post(
- f'{self.api_url}/get_predicted_agent{self.query_string}',
- json={} if payload is None else payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def get_url_info(self,
- url: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the info on a given URL.
-
- Args:
- url (str): Valid website URL.
- 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}/get_url_info{self.query_string}',
- json=payload,
- headers=headers)
Returns summaries of the chats a Customer participated in.
-
Args
-
-
limit : int
-
Limit of results per page. Default: 10, maximum: 25.
-
sort_order : str
-
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date of its last thread.
-
page_id : str
-
ID of the page with paginated results.
-
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.
-
-
-
-Expand source code
-
-
def list_chats(self,
- limit: int = None,
- sort_order: str = None,
- page_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
-
- Args:
- limit (int): Limit of results per page. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
- page_id (str): ID of the page with paginated results.
- 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}/list_chats{self.query_string}',
- json=payload,
- headers=headers)
Returns the properties of a given group. It only returns the properties a Customer has access to.
-
Args
-
-
group_id : int
-
ID of the group you want to return the properties of.
-
namespace : str
-
Property namespace to retrieve.
-
name : str
-
Property name.
-
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.
-
-
-
-Expand source code
-
-
def list_group_properties(self,
- group_id: int = None,
- namespace: str = None,
- name: str = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties of a given group. It only returns the properties a Customer has access to.
- Args:
- group_id (int): ID of the group you want to return the properties of.
- namespace (str): Property namespace to retrieve.
- name (str): Property name.
- 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. '''
- params = {}
- if namespace:
- params['namespace'] = namespace
- if name:
- params['name'] = name
- if group_id is not None:
- params['id'] = str(group_id)
- params['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/list_group_properties',
- params=params,
- headers=headers)
Returns object with info about current routing statuses of agent groups.
-One of the optional parameters needs to be included in the request.
-
Args
-
-
all : bool
-
If set to True, you will get statuses of all the groups.
-
group_ids : list
-
A table of groups' IDs
-
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.
-
-
-
-Expand source code
-
-
def list_group_statuses(self,
- all: bool = None,
- group_ids: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns object with info about current routing statuses of agent groups.
- One of the optional parameters needs to be included in the request.
-
- Args:
- all (bool): If set to True, you will get statuses of all the groups.
- group_ids (list): A table of groups' IDs
- 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}/list_group_statuses{self.query_string}',
- json=payload,
- headers=headers)
Returns the properties of a given license. It only returns the properties a Customer has access to.
-
Args
-
-
namespace : str
-
Property namespace to retrieve.
-
name : str
-
Property name.
-
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.
-
-
-
-Expand source code
-
-
def list_license_properties(self,
- namespace: str = None,
- name: str = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the properties of a given license. It only returns the properties a Customer has access to.
-
- Args:
- namespace (str): Property namespace to retrieve.
- name (str): Property name.
- 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. '''
- params = {}
- if namespace:
- params['namespace'] = namespace
- if name:
- params['name'] = name
- params['organization_id'] = self.organization_id
- return self.session.get(f'{self.api_url}/list_license_properties',
- params=params,
- headers=headers)
Returns threads that the current Customer has access to in a given chat.
-
Args
-
-
chat_id : str
-
ID of the chat for which threads are to be listed.
-
limit : str
-
Limit of results per page. Default: 10, maximum: 25.
-
sort_order : str
-
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date of its last thread.
-
page_id : str
-
ID of the page with paginated results.
-
min_events_count : int
-
Range: 1-100;
-Specifies the minimum number of events to be returned in the response.
-
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.
-
-
-
-Expand source code
-
-
def list_threads(self,
- chat_id: str = None,
- limit: str = None,
- sort_order: str = None,
- page_id: str = None,
- min_events_count: int = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns threads that the current Customer has access to in a given chat.
-
- Args:
- chat_id (str): ID of the chat for which threads are to be listed.
- limit (str): Limit of results per page. Default: 10, maximum: 25.
- sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
- page_id (str): ID of the page with paginated results.
- min_events_count (int): Range: 1-100;
- Specifies the minimum number of events to be returned in the response.
- 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}/list_threads{self.query_string}',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def mark_events_as_seen(self,
- chat_id: str = None,
- seen_up_to: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates `seen_up_to` value for a given chat.
-
- Args:
- chat_id (str): ID of the chat to update `seen_up_to`.
- seen_up_to (str): RFC 3339 date-time format.
- 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}/mark_events_as_seen{self.query_string}',
- json=payload,
- headers=headers)
Requests the verification of the customer's email address by sending them a verification email
-with the identity confirmation link.
-
Args
-
-
callback_uri : str
-
URI to be called after the customer confirms their email address.
-
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.
-
-
-
-Expand source code
-
-
def request_email_verification(self,
- callback_uri: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Requests the verification of the customer's email address by sending them a verification email
- with the identity confirmation link.
-
- Args:
- callback_uri (str): URI to be called after the customer confirms their email address.
- 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}/request_email_verification{self.query_string}',
- json=payload,
- headers=headers)
Dict containing chat properties, access and thread.
-
active : bool
-
When set to False, creates an inactive thread; default: True.
-
continuous : bool
-
Starts chat as continuous (online group is not required); default: False.
-
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.
-
-
-
-Expand source code
-
-
def resume_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Restarts an archived chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/resume_chat{self.query_string}',
- json=payload,
- headers=headers)
Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
-The method updates the requester's events_seen_up_to as if they've seen all chat events.
-
Args
-
-
chat_id : int
-
ID of the chat that you to send a message to.
-
event : dict
-
The event object.
-
attach_to_last_thread : bool
-
The flag is ignored for active chats.
-For inactive chats:
-True – the event will be added to the last thread;
-False – the request will fail. Default: False.
-
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.
-
-
-
-Expand source code
-
-
def send_event(self,
- chat_id: str = None,
- event: dict = None,
- attach_to_last_thread: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends an Event object. Use this method to send a message by specifying the Message event type in the request.
- The method updates the requester's `events_seen_up_to` as if they've seen all chat events.
-
- Args:
- chat_id (int): ID of the chat that you to send a message to.
- event (dict): The event object.
- attach_to_last_thread (bool): The flag is ignored for active chats.
- For inactive chats:
- True – the event will be added to the last thread;
- False – the request will fail. Default: False.
- 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{self.query_string}',
- json=payload,
- headers=headers)
ID of the event related to the rich message postback.
-
postback : dict
-
Object containing postback data (id, toggled).
-
thread_id : str
-
ID of the thread to send rich message postback to.
-
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.
-
-
-
-Expand source code
-
-
def send_rich_message_postback(self,
- chat_id: str = None,
- event_id: str = None,
- postback: dict = None,
- thread_id: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a rich message postback.
-
- Args:
- chat_id (str): ID of the chat to send rich message postback to.
- event_id (str): ID of the event related to the rich message postback.
- postback (dict): Object containing postback data (id, toggled).
- thread_id (str): ID of the thread to send rich message postback to.
- 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_rich_message_postback{self.query_string}',
- json=payload,
- headers=headers)
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.
-
-
-
-Expand source code
-
-
def send_sneak_peek(self,
- chat_id: str = None,
- sneak_peek_text: str = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Sends a sneak peek to a chat.
-
- Args:
- chat_id (str): ID of the chat to send a sneak peek to.
- sneak_peek_text (str): Sneak peek text.
- 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_sneak_peek{self.query_string}',
- json=payload,
- headers=headers)
An array of custom object-enclosed key:value pairs.
-Respects the order of items. Max keys: 100.
-
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.
-
-
-
-Expand source code
-
-
def set_customer_session_fields(self,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's session fields.
-
- Args:
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items. Max keys: 100.
- 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}/set_customer_session_fields{self.query_string}',
- json=payload,
- headers=headers)
Dict containing chat properties, access and thread.
-
active : bool
-
When set to False, creates an inactive thread; default: True.
-
continuous : bool
-
Starts chat as continuous (online group is not required); default: False.
-
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.
-
-
-
-Expand source code
-
-
def start_chat(self,
- chat: dict = None,
- active: bool = None,
- continuous: bool = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Starts a chat.
-
- Args:
- chat (dict): Dict containing chat properties, access and thread.
- active (bool): When set to False, creates an inactive thread; default: True.
- continuous (bool): Starts chat as continuous (online group is not required); default: False.
- 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}/start_chat{self.query_string}',
- json=payload,
- headers=headers)
Chat properties to set.
-You should stick to the general properties format and include namespace, property name and value.
-
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.
-
-
-
-Expand source code
-
-
def update_chat_properties(self,
- id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat properties.
-
- Args:
- id (str): ID of the chat you to set a property for.
- properties (dict): Chat properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_chat_properties{self.query_string}',
- json=payload,
- headers=headers)
An array of custom object-enclosed key:value pairs.
-Respects the order of items.
-
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.
-
-
-
-Expand source code
-
-
def update_customer(self,
- name: str = None,
- email: str = None,
- avatar: str = None,
- session_fields: list = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates Customer's properties.
-
- Args:
- name (str): Name of the customer.
- email (str): Email of the customer.
- avatar (str): The URL of the Customer's avatar.
- session_fields (list): An array of custom object-enclosed key:value pairs.
- Respects the order of items.
- 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}/update_customer{self.query_string}',
- json=payload,
- headers=headers)
Thread properties to set.
-You should stick to the general properties format and include namespace, property name and value.
-
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.
-
-
-
-Expand source code
-
-
def update_event_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- event_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates event properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- event_id (str): ID of the event you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_event_properties{self.query_string}',
- json=payload,
- headers=headers)
Thread properties to set.
-You should stick to the general properties format and include namespace, property name and value.
-
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.
-
-
-
-Expand source code
-
-
def update_thread_properties(self,
- chat_id: str = None,
- thread_id: str = None,
- properties: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Updates chat thread properties.
-
- Args:
- chat_id (str): ID of the chat you to set properties for.
- thread_id (str): ID of the thread you want to set properties for.
- properties (dict): Thread properties to set.
- You should stick to the general properties format and include namespace, property name and value.
- 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}/update_thread_properties{self.query_string}',
- json=payload,
- headers=headers)
Uploads a file to the server as a temporary file. It returns a URL that expires after 24 hours unless the URL is used in send_event.
-
Args
-
-
file : typing.BinaryIO
-
File-like object with file to upload (Maximum size: 10MB).
-
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.
-
-
-
-Expand source code
-
-
def upload_file(self,
- file: typing.BinaryIO = None,
- headers: dict = None) -> httpx.Response:
- ''' Uploads a file to the server as a temporary file. It returns a URL that expires after 24 hours unless the URL is used in `send_event`.
-
- Args:
- file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
- 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. '''
- return self.session.post(
- f'{self.api_url}/upload_file{self.query_string}',
- files=file,
- headers=headers)
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/customer/web/api/v36.html b/docs/customer/web/api/v36.html
index 95af5ec..fe9e545 100644
--- a/docs/customer/web/api/v36.html
+++ b/docs/customer/web/api/v36.html
@@ -75,12 +75,12 @@
Module livechat.customer.web.api.v36
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
+ ''' Returns chat info for the chats a Customer participated in.
Args:
limit (int): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -113,7 +113,7 @@
Module livechat.customer.web.api.v36
chat_id (str): ID of the chat for which threads are to be listed.
limit (str): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
min_events_count (int): Range: 1-100;
Specifies the minimum number of events to be returned in the response.
@@ -729,7 +729,9 @@
Args:
name (str): Name of the customer.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Email of the customer.
+ phone_number (str): Phone number of the customer.
avatar (str): The URL of the Customer's avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -896,6 +900,28 @@
Module livechat.customer.web.api.v36
f'{self.api_url}/get_predicted_agent{self.query_string}',
json={} if payload is None else payload,
headers=headers)
+
+ def request_welcome_message(self,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Requests a welcome message.
+ To use this method, the Customer needs to be logged in, which can be done via the `login` method.
+
+ Args:
+ 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.
+ '''
+ return self.session.post(
+ f'{self.api_url}/request_welcome_message{self.query_string}',
+ json={} if payload is None else payload,
+ headers=headers)
def get_url_info(self,
url: str = None,
@@ -1079,12 +1105,12 @@
Classes
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
+ ''' Returns chat info for the chats a Customer participated in.
Args:
limit (int): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -1117,7 +1143,7 @@
Classes
chat_id (str): ID of the chat for which threads are to be listed.
limit (str): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
min_events_count (int): Range: 1-100;
Specifies the minimum number of events to be returned in the response.
@@ -1733,7 +1759,9 @@
Args:
name (str): Name of the customer.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Email of the customer.
+ phone_number (str): Phone number of the customer.
avatar (str): The URL of the Customer's avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -1900,6 +1930,28 @@
Classes
f'{self.api_url}/get_predicted_agent{self.query_string}',
json={} if payload is None else payload,
headers=headers)
+
+ def request_welcome_message(self,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Requests a welcome message.
+ To use this method, the Customer needs to be logged in, which can be done via the `login` method.
+
+ Args:
+ 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.
+ '''
+ return self.session.post(
+ f'{self.api_url}/request_welcome_message{self.query_string}',
+ json={} if payload is None else payload,
+ headers=headers)
def get_url_info(self,
url: str = None,
@@ -2957,14 +3009,14 @@
Returns summaries of the chats a Customer participated in.
+
Returns chat info for the chats a Customer participated in.
Args
limit : int
Limit of results per page. Default: 10, maximum: 25.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date of its last thread.
+Chat info entries are sorted by the creation date of its last thread.
page_id : str
ID of the page with paginated results.
payload : dict
@@ -2991,12 +3043,12 @@
Returns
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
+ ''' Returns chat info for the chats a Customer participated in.
Args:
limit (int): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -3199,7 +3251,7 @@
Args
Limit of results per page. Default: 10, maximum: 25.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date of its last thread.
+Chat info entries are sorted by the creation date of its last thread.
page_id : str
ID of the page with paginated results.
min_events_count : int
@@ -3237,7 +3289,7 @@
Returns
chat_id (str): ID of the chat for which threads are to be listed.
limit (str): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
min_events_count (int): Range: 1-100;
Specifies the minimum number of events to be returned in the response.
@@ -3369,6 +3421,55 @@
Requests a welcome message.
+To use this method, the Customer needs to be logged in, which can be done via the login method.
+
Args
+
+
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.
+
+
+
+Expand source code
+
+
def request_welcome_message(self,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Requests a welcome message.
+ To use this method, the Customer needs to be logged in, which can be done via the `login` method.
+
+ Args:
+ 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.
+ '''
+ return self.session.post(
+ f'{self.api_url}/request_welcome_message{self.query_string}',
+ json={} if payload is None else payload,
+ headers=headers)
Args:
name (str): Name of the customer.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Email of the customer.
+ phone_number (str): Phone number of the customer.
avatar (str): The URL of the Customer's avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -4075,6 +4184,7 @@
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
+ ''' Returns chat info for the chats a Customer participated in.
Args:
limit (int): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -113,7 +113,7 @@
Module livechat.customer.web.api.v37
chat_id (str): ID of the chat for which threads are to be listed.
limit (str): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
min_events_count (int): Range: 1-100;
Specifies the minimum number of events to be returned in the response.
@@ -729,7 +729,9 @@
Args:
name (str): Name of the customer.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Email of the customer.
+ phone_number (str): Phone number of the customer.
avatar (str): The URL of the Customer's avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -875,10 +879,10 @@
Module livechat.customer.web.api.v37
json=payload,
headers=headers)
- def get_predicted_agent(self,
+ def request_welcome_message(self,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
+ ''' Requests a welcome message.
To use this method, the Customer needs to be logged in, which can be done via the `login` method.
Args:
@@ -893,7 +897,7 @@
Module livechat.customer.web.api.v37
which contains a server’s response to an HTTP request.
'''
return self.session.post(
- f'{self.api_url}/get_predicted_agent{self.query_string}',
+ f'{self.api_url}/request_welcome_message{self.query_string}',
json={} if payload is None else payload,
headers=headers)
@@ -1079,12 +1083,12 @@
Classes
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
+ ''' Returns chat info for the chats a Customer participated in.
Args:
limit (int): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -1117,7 +1121,7 @@
Classes
chat_id (str): ID of the chat for which threads are to be listed.
limit (str): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
min_events_count (int): Range: 1-100;
Specifies the minimum number of events to be returned in the response.
@@ -1733,7 +1737,9 @@
Args:
name (str): Name of the customer.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Email of the customer.
+ phone_number (str): Phone number of the customer.
avatar (str): The URL of the Customer's avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -1879,10 +1887,10 @@
Classes
json=payload,
headers=headers)
- def get_predicted_agent(self,
+ def request_welcome_message(self,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
+ ''' Requests a welcome message.
To use this method, the Customer needs to be logged in, which can be done via the `login` method.
Args:
@@ -1897,7 +1905,7 @@
Classes
which contains a server’s response to an HTTP request.
'''
return self.session.post(
- f'{self.api_url}/get_predicted_agent{self.query_string}',
+ f'{self.api_url}/request_welcome_message{self.query_string}',
json={} if payload is None else payload,
headers=headers)
@@ -2852,55 +2860,6 @@
Gets the predicted Agent - the one the Customer will chat with when the chat starts.
-To use this method, the Customer needs to be logged in, which can be done via the login method.
-
Args
-
-
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.
-
-
-
-Expand source code
-
-
def get_predicted_agent(self,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Gets the predicted Agent - the one the Customer will chat with when the chat starts.
- To use this method, the Customer needs to be logged in, which can be done via the `login` method.
-
- Args:
- 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.
- '''
- return self.session.post(
- f'{self.api_url}/get_predicted_agent{self.query_string}',
- json={} if payload is None else payload,
- headers=headers)
Returns summaries of the chats a Customer participated in.
+
Returns chat info for the chats a Customer participated in.
Args
limit : int
Limit of results per page. Default: 10, maximum: 25.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date of its last thread.
+Chat info entries are sorted by the creation date of its last thread.
page_id : str
ID of the page with paginated results.
payload : dict
@@ -2991,12 +2950,12 @@
Returns
page_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
- ''' Returns summaries of the chats a Customer participated in.
+ ''' Returns chat info for the chats a Customer participated in.
Args:
limit (int): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
@@ -3199,7 +3158,7 @@
Args
Limit of results per page. Default: 10, maximum: 25.
sort_order : str
Possible values: asc, desc (default).
-Chat summaries are sorted by the creation date of its last thread.
+Chat info entries are sorted by the creation date of its last thread.
page_id : str
ID of the page with paginated results.
min_events_count : int
@@ -3237,7 +3196,7 @@
Returns
chat_id (str): ID of the chat for which threads are to be listed.
limit (str): Limit of results per page. Default: 10, maximum: 25.
sort_order (str): Possible values: asc, desc (default).
- Chat summaries are sorted by the creation date of its last thread.
+ Chat info entries are sorted by the creation date of its last thread.
page_id (str): ID of the page with paginated results.
min_events_count (int): Range: 1-100;
Specifies the minimum number of events to be returned in the response.
@@ -3369,6 +3328,55 @@
Requests a welcome message.
+To use this method, the Customer needs to be logged in, which can be done via the login method.
+
Args
+
+
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.
+
+
+
+Expand source code
+
+
def request_welcome_message(self,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Requests a welcome message.
+ To use this method, the Customer needs to be logged in, which can be done via the `login` method.
+
+ Args:
+ 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.
+ '''
+ return self.session.post(
+ f'{self.api_url}/request_welcome_message{self.query_string}',
+ json={} if payload is None else payload,
+ headers=headers)
Args:
name (str): Name of the customer.
+ name_is_default (bool): Flag which states if the name is default.
email (str): Email of the customer.
+ phone_number (str): Phone number of the customer.
avatar (str): The URL of the Customer's avatar.
session_fields (list): An array of custom object-enclosed key:value pairs.
Respects the order of items.
@@ -4066,7 +4082,6 @@
Reports API module with client class in version 3.4.
-
-
-Expand source code
-
-
''' Reports API module with client class in version 3.4. '''
-
-from typing import Union
-
-import httpx
-
-from livechat.utils.helpers import prepare_payload
-from livechat.utils.http_client import HttpClient
-from livechat.utils.structures import AccessToken
-
-
-class ReportsApiV34(HttpClient):
- ''' Reports API client class in version 3.4. '''
- def __init__(self,
- token: Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- super().__init__(token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- self.api_url = f'https://{base_url}/v3.4/reports'
-
- # Chats
-
- def duration(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average chatting duration of agents within a license.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/duration',
- json=payload,
- headers=headers)
-
- def tags(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the distribution of tags for chats.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/tags',
- json=payload,
- headers=headers)
-
- def total_chats(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows how many chats occurred during the specified period.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/total_chats',
- json=payload,
- headers=headers)
-
- def ratings(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the number of rated chats along with their ratings during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/ratings',
- json=payload,
- headers=headers)
-
- def ranking(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the ratio of good to bad ratings for each operator.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/ranking',
- json=payload,
- headers=headers)
-
- def engagement(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the distribution of chats based on engagement during the specified period.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/engagement',
- json=payload,
- headers=headers)
-
- def greetings_conversion(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/greetings_conversion',
- json=payload,
- headers=headers)
-
- def surveys(self,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the number of submitted chat surveys along with the count of specific answers.
-
- Args:
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/surveys',
- json=payload,
- headers=headers)
-
- def response_time(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average agents' response time within a licence.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/response_time',
- json=payload,
- headers=headers)
-
- def first_response_time(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average agents' first response time within a licence.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/first_response_time',
- json=payload,
- headers=headers)
-
- # Agents
-
- def availability(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/agents/availability',
- json=payload,
- headers=headers)
-
- def performance(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/agents/performance',
- json=payload,
- headers=headers)
class ReportsApiV34(HttpClient):
- ''' Reports API client class in version 3.4. '''
- def __init__(self,
- token: Union[AccessToken, str],
- base_url: str,
- http2: bool,
- proxies=None,
- verify: bool = True,
- disable_logging: bool = False,
- timeout: float = httpx.Timeout(15)):
- super().__init__(token, base_url, http2, proxies, verify,
- disable_logging, timeout)
- self.api_url = f'https://{base_url}/v3.4/reports'
-
- # Chats
-
- def duration(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average chatting duration of agents within a license.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/duration',
- json=payload,
- headers=headers)
-
- def tags(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the distribution of tags for chats.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/tags',
- json=payload,
- headers=headers)
-
- def total_chats(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows how many chats occurred during the specified period.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/total_chats',
- json=payload,
- headers=headers)
-
- def ratings(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the number of rated chats along with their ratings during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/ratings',
- json=payload,
- headers=headers)
-
- def ranking(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the ratio of good to bad ratings for each operator.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/ranking',
- json=payload,
- headers=headers)
-
- def engagement(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the distribution of chats based on engagement during the specified period.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/engagement',
- json=payload,
- headers=headers)
-
- def greetings_conversion(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/greetings_conversion',
- json=payload,
- headers=headers)
-
- def surveys(self,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the number of submitted chat surveys along with the count of specific answers.
-
- Args:
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/surveys',
- json=payload,
- headers=headers)
-
- def response_time(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average agents' response time within a licence.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/response_time',
- json=payload,
- headers=headers)
-
- def first_response_time(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average agents' first response time within a licence.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/first_response_time',
- json=payload,
- headers=headers)
-
- # Agents
-
- def availability(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/agents/availability',
- json=payload,
- headers=headers)
-
- def performance(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/agents/performance',
- json=payload,
- headers=headers)
Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def availability(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/agents/availability',
- json=payload,
- headers=headers)
Shows the average chatting duration of agents within a license.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def duration(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average chatting duration of agents within a license.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/duration',
- json=payload,
- headers=headers)
Shows the distribution of chats based on engagement during the specified period.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def engagement(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the distribution of chats based on engagement during the specified period.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/engagement',
- json=payload,
- headers=headers)
Shows the average agents' first response time within a licence.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def first_response_time(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average agents' first response time within a licence.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/first_response_time',
- json=payload,
- headers=headers)
Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def greetings_conversion(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/greetings_conversion',
- json=payload,
- headers=headers)
Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def performance(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/agents/performance',
- json=payload,
- headers=headers)
Shows the ratio of good to bad ratings for each operator.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def ranking(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the ratio of good to bad ratings for each operator.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/ranking',
- json=payload,
- headers=headers)
Shows the number of rated chats along with their ratings during a specified period of time.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def ratings(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the number of rated chats along with their ratings during a specified period of time.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/ratings',
- json=payload,
- headers=headers)
Shows the average agents' response time within a licence.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def response_time(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the average agents' response time within a licence.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/response_time',
- json=payload,
- headers=headers)
Returns the number of submitted chat surveys along with the count of specific answers.
-
Args
-
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def surveys(self,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Returns the number of submitted chat surveys along with the count of specific answers.
-
- Args:
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/surveys',
- json=payload,
- headers=headers)
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def tags(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows the distribution of tags for chats.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/tags',
- json=payload,
- headers=headers)
Shows how many chats occurred during the specified period.
-
Args
-
-
distribution : str
-
Allowed values: hour, day, day-hours, month or year. Defaults to day.
-
timezone : str
-
IANA Time Zone (e.g. America/Phoenix).
-Defaults to the requester's timezone.
-When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
-
filters : dict
-
If none provided, your report will span the last seven days.
-
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.
-
-
-
-Expand source code
-
-
def total_chats(self,
- distribution: str = None,
- timezone: str = None,
- filters: dict = None,
- payload: dict = None,
- headers: dict = None) -> httpx.Response:
- ''' Shows how many chats occurred during the specified period.
-
- Args:
- distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
- timezone (str): IANA Time Zone (e.g. America/Phoenix).
- Defaults to the requester's timezone.
- When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
- filters (dict): If none provided, your report will span the last seven days.
- 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}/chats/total_chats',
- json=payload,
- headers=headers)
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/reports/api/v37.html b/docs/reports/api/v37.html
index c299b71..8c63d9f 100644
--- a/docs/reports/api/v37.html
+++ b/docs/reports/api/v37.html
@@ -567,6 +567,38 @@
Module livechat.reports.api.v37
if payload is None:
payload = prepare_payload(locals())
return self.session.post(f'{self.api_url}/customers/unique_visitors',
+ json=payload,
+ headers=headers)
+
+# Campaigns
+
+ def campaigns_conversion(self,
+ distribution: str = None,
+ timezone: str = None,
+ filters: dict = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Shows the number of campaigns sent and how many of those resulted in a chat or a goal.
+
+ Args:
+ distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
+ timezone (str): IANA Time Zone (e.g. America/Phoenix).
+ Defaults to the requester's timezone.
+ When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
+ filters (dict): If none provided, your report will span the last seven days.
+ 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}/campaigns/campaigns_conversion',
json=payload,
headers=headers)
@@ -1117,6 +1149,38 @@
Classes
if payload is None:
payload = prepare_payload(locals())
return self.session.post(f'{self.api_url}/customers/unique_visitors',
+ json=payload,
+ headers=headers)
+
+# Campaigns
+
+ def campaigns_conversion(self,
+ distribution: str = None,
+ timezone: str = None,
+ filters: dict = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Shows the number of campaigns sent and how many of those resulted in a chat or a goal.
+
+ Args:
+ distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
+ timezone (str): IANA Time Zone (e.g. America/Phoenix).
+ Defaults to the requester's timezone.
+ When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
+ filters (dict): If none provided, your report will span the last seven days.
+ 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}/campaigns/campaigns_conversion',
json=payload,
headers=headers)
@@ -1190,6 +1254,70 @@
Shows the number of campaigns sent and how many of those resulted in a chat or a goal.
+
Args
+
+
distribution : str
+
Allowed values: hour, day, day-hours, month or year. Defaults to day.
+
timezone : str
+
IANA Time Zone (e.g. America/Phoenix).
+Defaults to the requester's timezone.
+When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
+
filters : dict
+
If none provided, your report will span the last seven days.
+
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.
+
+
+
+Expand source code
+
+
def campaigns_conversion(self,
+ distribution: str = None,
+ timezone: str = None,
+ filters: dict = None,
+ payload: dict = None,
+ headers: dict = None) -> httpx.Response:
+ ''' Shows the number of campaigns sent and how many of those resulted in a chat or a goal.
+
+ Args:
+ distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
+ timezone (str): IANA Time Zone (e.g. America/Phoenix).
+ Defaults to the requester's timezone.
+ When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
+ filters (dict): If none provided, your report will span the last seven days.
+ 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}/campaigns/campaigns_conversion',
+ json=payload,
+ headers=headers)