Conversation Management
Get Conversation State
const state = whatsapp.getConversationState('1234567890');
console.log(state);
// {
// id: '1234567890',
// state: 'active',
// lastActivity: Date,
// messageCount: 42,
// displayName: 'John Doe',
// metadata: {},
// currentStep: 'waiting_for_response',
// context: {}
// }Update Conversation Context
// Store custom data for conversation
whatsapp.updateConversationContext('1234567890', {
userName: 'John',
preferredLanguage: 'en',
orderInProgress: true,
cartItems: ['item1', 'item2']
});Conversation State Structure
interface ConversationState {
id: string; // Conversation ID (phone number)
state: 'active' | 'waiting' | 'completed' | 'archived';
lastActivity: Date; // Last message timestamp
messageCount: number; // Total messages
displayName: string; // User's display name
metadata: Record<string, any>; // System metadata
currentStep?: string; // Current conversation step
context: Record<string, any>; // Custom context data
}Source captured: 2026-10-11