Skip to main content
Triggered after the chat receives a response from the agent and the response renders in the UI. Use this event for post-processing, analytics, or triggering follow-up actions.

Event properties

type
string
required
Always 'receive'.
message
object
required
The agent’s response that was rendered.

Example

instance.on('receive', (event, instance) => {
    console.log('Message received:', event.message);
    
    // Hide typing indicator
    hideTypingIndicator();
    
    // Auto-scroll to latest message
    instance.doAutoScroll();
    
    // Log to analytics
    analytics.track('message_received', {
        messageId: event.message.id,
        timestamp: Date.now()
    });
});

Do you need practical examples?

Learn how to apply the features available for embedded chat into your implementation with guidance and examples.