INNER CODE UNIT · Python
send_to_chatwoot
arc53/DocsGPT · extensions/chatwoot/app.py:79
def send_to_chatwoot(account: Any, conversation: Any, message: str) -> dict | None:
"""Post a reply into a Chatwoot conversation.
Args:
account: The Chatwoot account id.
conversation: The Chatwoot conversation id.
message: The reply text.
Returns:
The created Chatwoot message, or ``None`` if Chatwoot could not be reached or rejected it.
"""
data = {
'content': message
}
url = f"{chatwoot_url}/api/v1/accounts/{account}/conversations/{conversation}/messages"
headers = {"Content-Type": "application/json",
"Accept": "application/json",
"api_access_token": f"{chatwoot_token}"}