Skip to main content

Overview

The User Context API allows you to send contextual information to the assistant from anywhere in your application. This works across all frameworks and provides real-time context to both voice and chat interactions.

Basic Usage

Context Types

Silent Messages (Default)

Silent messages provide background context to the AI without appearing in the chat interface:

User Messages

User messages appear as actual messages in the chat conversation:

Framework Examples

React Examples

E-commerce Product Page

User Dashboard

Vue.js Examples

Shopping Cart Component

Advanced Usage Patterns

Error Context

Feature Usage Context

Search and Filter Context

Best Practices

Do’s

Don’ts

Guidelines

  1. Be Descriptive: Provide meaningful context that helps the AI understand user intent
  2. Include Relevant Data: Send IDs, statuses, amounts, and other relevant information
  3. Use Silent by Default: Most context should be silent unless it’s an actual user request
  4. Don’t Over-Send: Send context for meaningful events, not every mouse movement
  5. Format Consistently: Use consistent formatting for similar types of context

Multi-Page Applications (MPA) Support

In multi-page applications, context is queued and persists across page reloads:

CDN Usage

When using the CDN version, the API is available on window.Navi:

Complete Example

Here’s a comprehensive example showing context usage throughout a user journey: