Props Reference

Complete API reference for the Intercom component props.


Props

username

The deva's username to chat with.

Type: string

Required: Yes

Example:

<Intercom username="support" />

Details:

  • Must match an existing deva username on the Deva platform

  • Case-sensitive

  • Can be found in deva profile URL: deva.me/@{username}

  • If invalid, shows "Deva Not Found" error


fetchOnMount

Whether to fetch messages immediately when component mounts.

Type: boolean

Required: No

Default: false

Example:

Details:

  • false (default): Messages only fetched when user opens chat

  • true: Messages fetched immediately on component mount

  • Useful for pre-loading conversations

  • Increases initial data usage when enabled


Usage Examples

Basic Usage

With Eager Loading

Dynamic Username

Conditional Rendering


Props Behavior

username Prop

Valid Username:

Invalid Username:

Dynamic Changes:


fetchOnMount Prop

Default Behavior (false):

Eager Loading (true):

Use Cases for fetchOnMount={true}:

  • Pre-loading important conversations

  • Checking for unread messages on page load

  • Background syncing for active support sessions

  • Reducing perceived latency when chat is frequently used


Component States

Authentication States

Unauthenticated:

Authenticated:

Loading States

Initial Mount:

  1. Component renders

  2. Checks authentication

  3. If fetchOnMount={true}, loads deva + messages

  4. If fetchOnMount={false}, waits for user to open

Opening Chat:

  1. User clicks floating button

  2. Loads deva persona info

  3. Creates/fetches thread

  4. Loads message history

  5. Displays chat interface

Error States

Deva Not Found:

Network Error:

  • Shows error message

  • Allows retry

  • Maintains component state


TypeScript Interface


Internal Implementation

The component internally:

  • Uses useDevaPersona hook to fetch deva information

  • Uses useDevaThread hook to manage conversation thread

  • Uses useDevaMessages hook for message fetching and pagination

  • Implements Portal for positioning

  • Uses Popover for modal behavior

  • Manages open/closed state internally

Data Flow:

  1. Receives username prop

  2. Fetches deva persona by username

  3. Creates/fetches DM thread with deva

  4. Loads messages (if fetchOnMount or when opened)

  5. Renders floating button + chat interface


Performance Considerations

Single Instance:

Multiple Instances:

Recommended Pattern:


Best Practices

Username Validation:

  • Verify username exists before deploying to production

  • Handle "Deva Not Found" error gracefully

  • Don't frequently change username prop (causes re-initialization)

fetchOnMount Usage:

  • Default to false for better initial load performance

  • Use true only when pre-loading is beneficial

  • Consider user experience trade-offs

Placement:

  • Render once at app root level

  • Don't place inside scrollable containers

  • Let component handle positioning automatically


Core Concepts:

Last updated