Generate AI Reply
Generate AI Reply
Generates an AI reply using an assistant based on a customer identifier
POST
Generate AI Reply
This endpoint automatically generates an intelligent reply to a customer message using your configured AI assistant. The system automatically manages conversation context for each customer, so the assistant remembers previous messages and can respond contextually. Ideal for integration into external messaging platforms, CRMs, or custom chat interfaces.
Request Body
The ID of the assistant to use for reply generation. Must belong to your account.
A unique identifier for the customer. This is used to maintain conversation context across multiple messages.Examples: Phone number, email address, CRM contact ID, Facebook user ID.Maximum length: 255 characters.Important: Always use the same format for the same customer to ensure context is correctly mapped.
The customer’s message to reply to.
Optional context variables to pass to the assistant. These are merged with existing conversation variables.Useful for passing customer data, session context, or other metadata that can personalize the reply.
Response Fields
Indicates whether the request was successful
The UUID of the conversation. Use this to track or reference the conversation later.
The customer identifier provided in the request
The AI-generated reply to the customer message
Array of function calls the assistant made while processing the message. Empty array if no functions were called.
Indicates whether AI replies are disabled for this conversation (e.g. due to manual takeover)
Error Responses
Will be
false when an error occursError message describing what went wrong
Machine-readable error code. Possible values:
ASSISTANT_NOT_FOUND- The assistant ID is invalid or does not belong to your accountINSUFFICIENT_BALANCE- Your account balance is too low to process the message
Use Cases
Multi-Channel AI Replies
Use this endpoint to add AI replies to any messaging platform:- Receive a message from WhatsApp, Facebook, SMS, or another channel
- Call this endpoint with the message and customer identifier
- Send the AI reply back through the original channel
CRM Integration
Integrate AI replies into your CRM or helpdesk system:- Use the CRM contact ID as
customer_identifier - Pass customer data as variables for personalized replies
- The conversation persists across sessions when using the same identifier
Custom Chat Interfaces
Build your own chat interface powered by your Famulor assistant:- Generate a unique identifier for each user session
- Send messages through this endpoint
- Display the AI replies in your interface
Conversation Persistence
Conversations are automatically stored based on the combination ofassistant_id and customer_identifier:
- Same identifier: Messages are added to the existing conversation, maintaining full context
- New identifier: A new conversation is created for the customer
- Variable merging: When variables are provided, they are merged with existing conversation variables
Best Practices
- Use consistent identifiers: Always use the same format for customer identifiers (e.g. always E.164 for phone numbers)
- Pass relevant context: Use the
variablesfield to provide customer data that helps the AI personalize replies - Handle rate limits: Implement retry logic with exponential backoff for rate-limited requests
- Store conversation IDs: Save the returned
conversation_idfor later reference or debugging - Monitor costs: Track usage to manage costs, especially for high-volume integrations

