Overview
The Message Buffer System groups messages from the same phone number during a configurable time period. This is optional and backwards compatible.Quick Setup
Just addenableBuffer: true to your webhook processor:
Why Use It?
- AI Bots: Get complete conversation context
- Performance: Reduce handler calls for message bursts
- Analysis: Process related messages together
- Without buffer: 3 separate handler calls
- With buffer: 1 handler call with all 3 messages
Configuration
| Option | Default | Description |
|---|---|---|
enableBuffer | false | Enable message buffering |
bufferTimeMs | 5000 | Wait time in milliseconds |
maxBatchSize | 100 | Max messages per batch |
Basic Example
Without Buffer (Default)
Your existing code works unchanged:All Message Types Supported
Works with all handlers:onTextMessage, onImageMessage, onButtonClick, etc.