Skip to main content
Conversation history determines how many previous messages are included when your bot calls its AI integration. This context window is crucial for maintaining coherent conversations.

Overview

When a user sends a message, your bot sends a history of recent messages to the AI integration:
The number of messages included is controlled by the 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.
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)

System messages are included at the beginning if configured in your integration.

How History Works

Example Conversation Flow

Initial Message:
History: 1 message After First Response:
History: 2 messages After Second User Message:
History: 3 messages When History Limit Reached (limit=10):
The oldest messages are dropped as new ones arrive.

Chronological Order

Messages are always sent in chronological order, oldest first:
This ensures the AI understands the conversation flow.

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
Too Many Messages:
  • Higher API costs
  • Slower response times
  • May exceed model limits
  • Irrelevant old context
Sweet Spot:
  • 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 of history_limit:

Retrieving Full History

Use the API to retrieve complete conversation history:

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.

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
Solution:
  • 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
Solution:
  • 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
Solution:
  • 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