Chat integrations/REST API

Batch chat message endpoint

Concepts

  • You can send chat messages to your AI agents over the REST API.
  • Complex chat messages requests can take a long time, and the message endpoint could time-out because of this.
  • The batch chat message returns a batchJobId, which you can then poll the get batch message endpoint with to check when the results are ready.

The batch chat message endpoint

Go to the agent's project page to get your:

  • User profile id
  • Project environment id

Go the the agent's details page to get the:

  • Agent id

Send a POST request to https://server-name/api/v1/chat/batch-message with the following JSON in the body:

NameTypeRequiredDescription
userProfileIdstringyesThe internal user profile id.
externalUserIdstringnoThe user's id in your system.
chatSessionIdstringno (*1)The internal chat session id.
externalChatSessionIdstringno (*1)The chat session id in your system.
projectEnvIdstringyesThe project's environment id.
agentIdstringyesThe agent's id.
filtersjsonnoSpecified to filter entity data in the prompt.
messagesstringyesStringified JSON of an array of messages to send.

*1: You only need to specify either a chatSessionId or externalChatSessionId. For a new chat session, only the externalChatSessionId needs to be specified if it will be used at all.

A chatSessionId is returned and can be used to reference the session in future message calls.

The filters parameter JSON is defined as:

NameTypeRequiredDescription
includeEntitiesstringnoInclude entities: all (defaut) or filtered (only entities in the filtered list).
entityFiltersjson[]yesAn array of JSON specifying how to filter each entity.

The entityFilter JSON is defined as:

NameTypeRequiredDescription
entityIdstringyesThe id of the entity (from the entity's page).
selectstring[]noAn array of fields to select in camelCase.
whereJSONnoA JSON map of fields (in camelCase) to values.

This endpoint will return a batchJobId. You can then poll the get batch message endpoint with the batchJobId, which will return the chat message results once ready.

On this page