ChatWoot

class simple_chatwoot.ChatWoot(domain: str, api_access_token: str, account_id: str, inbox_id: str)[source]

Initialize the instance with the given parameters.

Arguments

  • param api_access_token – should be an administrators security token for the account, example: rkoo0op2PPsihsv8JW3IjfiF

  • param account_id – numeric ID of the account, example: 1

  • param inbox_id – ID of the inbox, example: 1

  • param domain – domain to use for connecting to Chatwoot instance, example: https://chatwoot.example.com

create_agent()[source]

Add a new Agent to Account

# Not implemented yet. Here for documentation purposes.

create_contact(name: str, email: str, phone: str, identifier: Optional[str] = None, custom_attributes: Dict = {}) str[source]

Create a new Contact

A Contact represents a Person in your chatwoot CRM. A contact can have conversations in multiple inboxes via the Contact-Inbox relationship. The contact models helps to agregate conversations from variaous inboxes belonging to a single identity.

You need to have one contact in order to create conversations and messages, because conversation creation uses source_id to tie the session and the messages together The output is the contact source_id. Example: 561f3286-a92e-4b59-ae1d-9301154313f1

Arguments

  • name – name of the contact

  • email – email of the contact

  • phone – phone number of the contact

  • identifier – a unique identifier for the contact in external system

  • custom_attributes – an object where you can store custom attributes for contact, example: {“type”:”customer”, “age”:30}

create_conversation(contact_source_id: str, contact_id: Optional[str] = None, assignee_id: Optional[str] = None, team_id: Optional[str] = None, additional_attributes: Dict = {}, status: str = 'open', **kargs) str[source]

Creating a conversation in chatwoot requires a source id. Learn more about source_id: https://github.com/chatwoot/chatwoot/wiki/Building-on-Top-of-Chatwoot:-Importing-Existing-Contacts-and-Creating-Conversations

Arguments

  • contact_source_id – source id could be the identifier hash in case of a webwidget, twitter_id in case of a twitter profile and email in case of email channel, example: 561f3286-a92e-4b59-ae1d-9301154313f1

  • contact_id – contact Id for which conversation is created

  • assignee_id – agent Id for assigning a conversation to an agent

  • team_id – team Id for assigning a conversation to a team

  • additional_attributes – lets you specify attributes like browser information

  • status – specify the conversation whether it’s pending, open, closed

  • kargs – additional named arguments

create_message(conversation_id: str, content: str, message_type: str = 'incoming', is_private: bool = False) str[source]

Conversation is a numeric identification like 5670 If using API inbox type, make sure your webhook server is up and running otherwise you’ll get errors from it

Arguments

  • conversation_id – numeric ID of the conversation

  • content – content of the message

  • message_type – weather it’s “outgoing” or “incoming”

  • is_private – flag to identify if it is a private note

get_conversation_details(conversation_id: str) Dict[source]

Get all details regarding a conversation with all messages in the conversation

Arguments

  • conversation_id – numeric ID of the conversation

list_inboxes() Dict[source]

List all inboxes available in the current account

list_messages(conversation_id: str) Dict[source]

List all messages of a conversation

Arguments

  • conversation_id – numeric ID of the conversation

search_contacts(search_key: str, page: str = '1') Dict[source]

Search the resolved contacts using a search key, currently supports email search (Page size = 15). Resolved contacts are the ones with a value for identifier, email or phone number.

Arguments

  • search_key – can be contact name, identifier, email or phone number

  • page – page number, default is 1