Utils
Utils for the Integreat Chat
Chat Bot
Wrapper for the Chat Bot / LLM API
- integreat_cms.api.v3.chat.utils.chat_bot.automatic_answer(message: str, region: Region, language_slug: str) str | None [source]
Get automatic answer to question
Zammad API
- class integreat_cms.api.v3.chat.utils.zammad_api.ZammadChatAPI(region: Region)[source]
Bases:
object
Class providing an API for Zammad used in the context of user chats.
- Parameters:
url – The region’s Zammad URL
http_token – The region’s client secret
region (Region)
- create_ticket(device_id: str, language_slug: str) dict [source]
Create a new ticket (i.e. initialize a new chat conversation)
- get_attachment(attachment_map: AttachmentMap) bytes | dict [source]
Get the (binary) attachment file from Zammad.
- Parameters:
attachment_map (AttachmentMap) – the object containing the IDs Zammad requires to identify attachments
- Returns:
the binary object file or a dict containing an error message
- Return type:
- get_messages(chat: UserChat) dict[str, dict | list[dict]] [source]
Get all non-internal messages for a given ticket
- send_message(chat_id: int, message: str, internal: bool = False, automatic_message: bool = False) dict [source]
Post a new message to the given ticket
param chat_id: Zammad ID of the chat param message: The message body param internal: keep the message internal in Zammad (do not show to user) param automatic_message: sets title to “automatically generated message” return: dict with Zammad article data