Overview
When a user sends a message, your bot sends a history of recent messages to the AI integration:history_limit setting.
History Limit Setting
Default Configuration
Default: 10 messages (5 user messages + 5 bot responses) This provides enough context for most conversations without excessive token usage.Configuring History Limit
1
Navigate to Bot Settings
Go to your bot’s settings page.
2
Find History Settings
Look for Message History or Context Window setting.
3
Set Limit
Enter the number of messages to include (e.g., 10, 20, 50).
4
Save
Click Save to apply changes immediately.
Recommended Settings
Larger history limits use more tokens and increase API costs. Find the right balance for your use case.
Message Format
Messages follow the OpenAI/Anthropic format:User Messages
Assistant Messages
System Messages (Optional)
How History Works
Example Conversation Flow
Initial Message:Chronological Order
Messages are always sent in chronological order, oldest first:Context Window vs Token Limits
Bot History Limit
Controls how many messages are sent to your integration:- Setting:
history_limit = 10 - Result: Last 10 messages included
AI Model Token Limit
Different AI models have different context windows:Even with a large
history_limit, the AI model may not be able to process all messages if they exceed its token limit.Balancing History and Tokens
Too Few Messages:- Bot forgets context quickly
- Users must repeat information
- Poor conversation flow
- Higher API costs
- Slower response times
- May exceed model limits
- Irrelevant old context
- Enough context for continuity
- Within model token limits
- Cost-effective
- Fast responses
Storage and Retrieval
Full History Stored
The platform stores the complete conversation history, regardless ofhistory_limit:
Retrieving Full History
Use the API to retrieve complete conversation history:Get full conversation history
Get full conversation history
- cURL
- JavaScript
- PHP
- Python
Get paginated history
Get paginated history
- cURL
- JavaScript
- PHP
- Python
Advanced Patterns
Dynamic History Based on Topic
Adjust history limit based on conversation type:Summarization for Long Conversations
For very long conversations, summarize old context:Custom Context Selection
Select specific messages based on relevance:API Configuration
Configure history settings programmatically.Update history limit
Update history limit
- cURL
- JavaScript
- PHP
- Python
Complete API Reference
View the full API specification with all endpoints, parameters, and response schemas.
Best Practices
Start Small
Begin with 10 messages and adjust based on needs
Monitor Costs
Track token usage as you increase history
Test Edge Cases
Test very long conversations to ensure they work
Consider Use Case
Support needs more context than simple Q&A
Review actual conversations to determine optimal history limit. Too little context causes confusion; too much increases costs without benefit.
Troubleshooting
Bot Forgets Context Too Quickly
Symptoms:- Users must repeat information
- Bot asks same questions
- Conversation feels disjointed
- Increase
history_limit - Check conversations aren’t timing out
- Verify messages are being stored
Token Limit Exceeded
Symptoms:- AI returns errors about context length
- Responses are cut off
- Integration timeouts
- Decrease
history_limit - Use a model with larger context window
- Implement summarization for old messages
High API Costs
Symptoms:- Unexpectedly high bills
- High token usage per request
- Reduce
history_limit - Monitor average message length
- Consider cheaper models for simple queries
Next Steps
Conversation API
Manage conversations programmatically
Webhook Payload
Understand message format
Conversations Overview
Learn about conversation management