Chat API

This page documents the API endpoints for managing chat conversations and messages with AI Employees.

CreateConversation

Create a new conversation with an AI Employee.

PropertyValue
URL/api/chat/
HTTP MethodPOST
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/json

Request Body

FieldTypeRequiredDescription
persona_idstringYesUUID of the AI Employee to chat with

Example

curl -X POST https://your-instance.ema.co/api/chat/ \
 -H "Authorization: Bearer <access_token>" \
 -H "Content-Type: application/json" \
 -d '{
 "persona_id": "abc12345-6789-0abc-def0-123456789abc"
 }'

Response

Returns the initial AI Employee greeting and conversation metadata.

FieldTypeDescription
conversation_idstringUUID of the created conversation
messagesarrayInitial messages (e.g., welcome message)

RespondToMessage (Synchronous)

Send a user message and receive an AI response synchronously.

PropertyValue
URL/api/chat/{conversation_id}
HTTP MethodPOST
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeDescription
conversation_idstringUUID of the conversation

Request Body

FieldTypeRequiredDescription
messagestringYesThe user's message text

Example

curl -X POST https://your-instance.ema.co/api/chat/<conversation_id> \
 -H "Authorization: Bearer <access_token>" \
 -H "Content-Type: application/json" \
 -d '{
 "message": "How do I reset my password?"
 }'

Response

Returns the AI Employee's reply, including message content, snippets, and sources.

FieldTypeDescription
messagesarrayAI response messages with snippets and sources

RespondToMessage (Asynchronous)

Send a user message without waiting for the AI response.

PropertyValue
URL/api/chat/{conversation_id}/async
HTTP MethodPOST
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeDescription
conversation_idstringUUID of the conversation

Request Body

FieldTypeRequiredDescription
messagestringYesThe user's message text

Example

curl -X POST https://your-instance.ema.co/api/chat/<conversation_id>/async \
 -H "Authorization: Bearer <access_token>" \
 -H "Content-Type: application/json" \
 -d '{
 "message": "Generate a summary report for Q4 sales"
 }'

The response acknowledges receipt. Poll GetMessages to retrieve the AI response when ready.

GetMessages

Retrieve all messages in a conversation.

PropertyValue
URL/api/chat/{conversation_id}
HTTP MethodGET
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token

Path Parameters

ParameterTypeDescription
conversation_idstringUUID of the conversation

Example

curl -X GET https://your-instance.ema.co/api/chat/<conversation_id> \
 -H "Authorization: Bearer <access_token>"

Response

Returns the full message history for the conversation, including all messages and conversation metadata.

GetChatbotConfig

Retrieve the chatbot configuration for a specific AI Employee.

PropertyValue
URL/api/chat/config/{persona_id}
HTTP MethodGET
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token

Path Parameters

ParameterTypeDescription
persona_idstringUUID of the AI Employee

Example

curl -X GET https://your-instance.ema.co/api/chat/config/<persona_id> \
 -H "Authorization: Bearer <access_token>"

Response

Returns the chatbot configuration including welcome message, suggested questions, branding, and display settings.

GetConversationFeedback

Retrieve aggregated feedback for conversations.

PropertyValue
URL/api/conversations/get_conversation_feedback
HTTP MethodGET
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token

Query Parameters

ParameterTypeRequiredDescription
persona_idstringYesUUID of the AI Employee

Example

curl -X GET "https://your-instance.ema.co/api/conversations/get_conversation_feedback?persona_id=<persona_id>" \
 -H "Authorization: Bearer <access_token>"

GetConversationFeedbackDetail

Retrieve detailed feedback for a specific conversation.

PropertyValue
URL/api/conversations/get_conversation_feedback_detail
HTTP MethodGET
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token

Query Parameters

ParameterTypeRequiredDescription
conversation_idstringYesUUID of the conversation

Example

curl -X GET "https://your-instance.ema.co/api/conversations/get_conversation_feedback_detail?conversation_id=<conversation_id>" \
 -H "Authorization: Bearer <access_token>"

LogCustomEvent

Log a custom event for analytics tracking in a chatbot session.

PropertyValue
URL/api/chat/events
HTTP MethodPOST
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/json

Request Body

FieldTypeRequiredDescription
event_namestringYesName of the custom event
event_dataobjectNoAdditional event data

Last updated: Aug 12, 2026