Skip to main content

Upload a Chat to Ender Turing for analysis using the API

The chat can be uploaded through the API endpoint

Updated this week

Chat upload

The chat can be uploaded through an API endpoint (using POST https://{fqdn}/api/v1/sessions/chats).

Due to compliance and security concerns, API documentation is only accessible to users who are logged in. Please log in to the Ender Turing platform to read the API documentation

Metadata can be uploaded separately through the Update session metadata API endpoint.

API Upload (recommended method)

Python example

Please install the Ender Turing Python SDK using

pip install enderturing

Minimalistic code snippet example to upload a chat to the API

import getpass
from enderturing import Config, EnderTuring

# --- Set your parameters (Manual step) ---
et_api_user = "[email protected]"
et_domain = "company.enderturing.com"
# define chat
chat = {
"language_code": "en",
"direction": "in",
"start_dt": "2024-09-09T09:03:00.000Z",
"end_dt": "2024-09-09T09:12:00.000Z",
"additional_info": "additional info in dict can be added", # Optional
"metadata": { # Optional
"chat_system_id": "c7233bee-564e-4ce6-8505", # Optional
"crm_system_id": "5059c4a1-2cdb-4acd-95dd", # Optional
"crm_statuses": ["Card reissue", "Test status 2"], # Optional
"hangup_by": "agent", # Optional
"queue": "Default IN queue", # Optional
"waiting_time": 32, # Optional
"topic": "Card reissue", # Optional
},
"participants": [
{
"role": "customer",
"full_name": "John Doe",
"phone": "3807212345678",
"email": "[email protected]", # Optional
"timezone": "+04:00", # Optional
},
{
"role": "agent",
"full_name": "Name Surname",
"phone": "agent_phone",
"email": "[email protected]", # Optional
"timezone": "+06:00", # Optional
},
],
"messages": [
{
"language_code": "en",
"msg_from": "3807212345678",
"msg_to": ["agent_phone"],
"dt": "2024-09-09T09:03:00.000Z",
"text": "Hello!",
},
{
"language_code": "en",
"msg_from": "agent_phone",
"msg_to": ["3807212345678"],
"dt": "2024-09-09T09:03:20.000Z",
"text": "Hi there and Bye",
},
],
}
# --- Create configuration (Auto) ---
et_api_password = getpass.getpass(f"Provide Password for user {et_api_user} at domain {et_domain}:")
config = Config.from_url(f"https://{et_api_user}:{et_api_password}@{et_domain}")
et = EnderTuring(config)

# submit chat for analysis - will return session_id (UUID) as a result OR Error
et_response = et.sessions.chat_upload(chat)
print("Recognized in session_id: ", et_response["session_id"])
# Out[N]: Recognized in session_id: '5ef1ce61-f10a-4c18-badb-5b0f71a75c98'}

Uploaded files will appear on the "All Conversations" page shortly after upload.

CURL example

# --- Configuration - Replace these values ---
ET_DOMAIN="company.enterturing.com"
ET_USER="[email protected]"
ET_PASSWORD="your_password"
# --- End Configuration ---

# 1 - API Authorization - get Bearer Token
curl -X 'POST' \
'https://${ET_DOMAIN}/api/v1/login/access-token' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=password&username=${ET_USER}&password=${ET_PASSWORD}'

# 2 - Upload audio file to recognition
curl -X 'POST' \
'https://${ET_DOMAIN}/api/v1/sessions/chats' \
-H "Authorization: Bearer ${Token_from_step_1}" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "language_code": "en", "direction": "in", "start_dt": "2024-09-09T09:03:00.000Z", "end_dt": "2024-09-09T09:12:00.000Z", "additional_info": "any additional info or metadata in dict|list|str can be added", "metadata": { "chat_system_id": "c7233bee-564e-4ce6-8505-84f0041f744c", "crm_system_id": "5059c4a1-2cdb-4acd-95dd-5f614ecd4932", "crm_statuses": ["[DC] Card reissue done", "Test status 2"], "hangup_by": "agent", "queue": "Default IN queue", "waiting_time": 32, "topic": "Card reissue" }, "participants": [ { "role": "customer", "full_name": "John Doe", "phone": "3807212345678", "email": "[email protected]", "timezone": "+04:00" }, { "role": "agent", "full_name": "Name Surname", "phone": "agent_phone", "email": "[email protected]", "timezone": "+06:00" } ], "messages": [ { "language_code": "en", "msg_from": "3807212345678", "msg_to": ["agent_phone"], "dt": "2024-09-09T09:03:00.000Z", "text": "Hello!" }, { "language_code": "en", "msg_from": "agent_phone", "msg_to": ["3807212345678"], "dt": "2024-09-09T09:03:20.000Z", "text": "Hi there and Bye" } ] }'

The uploaded chat will appear on the "All Conversations" page shortly after it is uploaded.

Example chat with Agent and Bot

{
"language_code": "en",
"direction": "in",
"start_dt": "2024-09-09T09:03:00.000Z",
"end_dt": "2024-09-09T09:07:00.000Z",
"additional_info": "additional info in dict can be added", # Optional
"metadata": { # Optional
"chat_system_id": "c7233bee-564e-4ce6-8505", # Optional
"crm_system_id": "5059c4a1-2cdb-4acd-95dd", # Optional
"crm_statuses": ["Card reissue", "Test status 2"], # Optional
"hangup_by": "agent", # Optional
"queue": "Default IN queue", # Optional
"waiting_time": 32, # Optional
"topic": "Card reissue" # Optional
},
"participants": [
{
"role": "customer",
"full_name": "John Doe",
"phone": "3807212345678",
"email": "[email protected]", # Optional
"timezone": "+04:00" # Optional
},
{
"role": "agent",
"full_name": "Name Surname",
"phone": "agent_phone",
"email": "[email protected]", # Optional
"timezone": "+06:00" # Optional
},
{ # Optional
"role": "bot",
"id": "iambot", # Optional
"short_name": "chatbot", # Optional
"full_name": "Chat Bot John",
"phone": "0000000000000",
"email": "[email protected]", # Optional
"timezone": "+02:00" # Optional
}
],
"messages": [
{
"language_code": "en",
"msg_from": "0000000000000",
"msg_to": ["3807212345678"],
"dt": "2024-09-09T09:03:00.000Z",
"text": "Hello, I am Bot!"
},
{
"language_code": "en",
"msg_from": "3807212345678",
"msg_to": ["0000000000000"],
"dt": "2024-09-09T09:04:00.000Z",
"text": "Hello, I am Client! Please call human."
},
{
"language_code": "en",
"msg_from": "agent_phone",
"msg_to": ["3807212345678"],
"dt": "2024-09-09T09:05:00.000Z",
"text": "Hi there, I am Agent!"
},

{
"language_code": "en",
"msg_from": "3807212345678",
"msg_to": ["agent_phone"],
"dt": "2024-09-09T09:06:00.000Z",
"text": "Hello, I am Client! Here is my question."
},
{
"language_code": "en",
"msg_from": "agent_phone",
"msg_to": ["3807212345678"],
"dt": "2024-09-09T09:07:00.000Z",
"text": "Hi there, I am Agent! Resolved, bye!"
}
]
}

Example chat with system message

{
"language_code": "en",
"direction": "in",
"start_dt": "2025-05-09T09:03:00.000Z",
"end_dt": "2025-05-09T09:08:00.000Z",
"participants": [
{
"role": "customer",
"full_name": "John Doe",
"phone": "3807212345678"
},
{
"role": "agent",
"full_name": "Name Surname",
"phone": "agent_phone"
},
{
"role": "bot",
"full_name": "Chat Bot John",
"phone": "0000000000000"
},
{
"role": "system",
"full_name": "System Message",
"phone": "system"
}
],
"messages": [
{
"language_code": "en",
"msg_from": "system",
"msg_to": ["3807212345678"],
"dt": "2025-05-09T09:03:00.000Z",
"text": "System Message: START"
},
{
"language_code": "en",
"msg_from": "0000000000000",
"msg_to": ["3807212345678"],
"dt": "2025-05-09T09:03:00.000Z",
"text": "Hello, I am Bot!"
},
{
"language_code": "en",
"msg_from": "3807212345678",
"msg_to": ["0000000000000"],
"dt": "2025-05-09T09:04:00.000Z",
"text": "Hello, I am Client! Please call human."
},
{
"language_code": "en",
"msg_from": "agent_phone",
"msg_to": ["3807212345678"],
"dt": "2025-05-09T09:05:00.000Z",
"text": "Hi there, I am Agent!"
},

{
"language_code": "en",
"msg_from": "3807212345678",
"msg_to": ["agent_phone"],
"dt": "2025-05-09T09:06:00.000Z",
"text": "Hello, I am Client! Here is my question."
},
{
"language_code": "en",
"msg_from": "agent_phone",
"msg_to": ["3807212345678"],
"dt": "2025-05-09T09:07:00.000Z",
"text": "Hi there, I am Agent! Resolved, bye!"
},
{
"language_code": "en",
"msg_from": "system",
"msg_to": ["3807212345678"],
"dt": "2025-05-09T09:08:00.000Z",
"text": "System Message: END"
}
]
}

Did this answer your question?