INNER CODE UNIT · Python
send_to_bot
arc53/DocsGPT · extensions/chatwoot/app.py:42
def send_to_bot(sender: Any, message: str) -> str | None:
"""Ask the DocsGPT agent a question through ``/api/answer``.
Args:
sender: The Chatwoot contact id (kept for logging).
message: The customer's message text.
Returns:
The agent's answer, or ``None`` if DocsGPT could not be reached or returned an error.
"""
data = {
'question': message,
'api_key': docsgpt_key,
'history': json.dumps([]),
}
headers = {"Content-Type": "application/json",
"Accept": "application/json"}