Chat integrations

REST API

Connect to the REST API

Concepts

  • You can connect to your AI agents over the REST API.

The 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/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.

The number of messages is usually only one, since you don't need to resend any chat history (the platform handles that). For example:

[
  {
    type: '',
    text: 'Hi'
  }
]

On this page