Skip to main content
Generates an AI response for a customer message using your assistant. Conversations are automatically created or resumed based on the customer_identifier, making this ideal for integrating AI replies into external platforms, CRMs, or custom messaging interfaces.
This endpoint is rate-limited to 5 requests per minute per API token.

Endpoint

POST /user/ai/generate-reply

Request

integer
required
ID of the assistant to use. Must belong to your account.
string
required
A unique identifier for the customer. Used to maintain conversation context across multiple messages. Examples: phone number, email, CRM contact ID, Facebook user ID. Maximum 255 characters.
string
required
The customer’s message to respond to.
object
Optional context variables to pass to the assistant. Merged with any existing conversation variables.

Response

boolean
Whether the request was successful.
string
UUID of the conversation. Use this to reference the conversation later.
string
The customer identifier provided in the request.
string
The AI-generated response.
array
Functions the assistant executed while processing the message.
boolean
Whether AI responses are disabled for this conversation (e.g., due to manual takeover).

Example

200 Success
404 Assistant not found
402 Insufficient balance
429 Rate limited

Conversation persistence

Conversations are automatically persisted by assistant_id + customer_identifier:
  • Same identifier: Messages are added to the existing conversation, maintaining full context.
  • New identifier: A new conversation is created.
  • Variables merge: Variables provided in the request are merged with existing conversation variables.
Use consistent identifier formats (e.g., always E.164 format for phone numbers) to ensure conversation continuity across requests.