features/AI Chat

AI Chat

Intufind's AI chat provides a conversational interface for users to discover content, get answers, and receive personalized assistance — all grounded in your indexed products and content.

Capabilities

  • Answer questions about your products and content
  • Help users find what they're looking for
  • Provide personalized recommendations
  • Guide users through complex decisions
  • Hand off to human agents when needed

Basic Usage

curl -X POST https://api.intufind.com/chat \
  -H "Authorization: Bearer if_sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What laptops do you have for video editing?",
    "threadId": "user-session-123"
  }'
import { createClient, sendChat } from '@intufind/ai-sdk';

const client = createClient({
  baseUrl: 'https://api.intufind.com',
  auth: process.env.INTUFIND_SECRET_KEY!,
});

const { data } = await sendChat({
  client,
  body: {
    message: 'What laptops do you have for video editing?',
    threadId: 'user-session-123',
  },
});

console.log(data.message.intro);    // AI response text
console.log(data.message.products); // Matching products

Thread Management

Conversations are organized into threads that maintain context across messages:

const threadId = `user_${userId}_${Date.now()}`;

// First message
await sendChat({
  client,
  body: { message: 'I need a laptop for video editing', threadId },
});

// Follow-up — AI remembers the context
await sendChat({
  client,
  body: { message: 'What about something more portable?', threadId },
});
// AI understands "something" refers to laptops for video editing

Generate unique thread IDs for each conversation. Use a consistent scheme like user_<userId>_<timestamp> or web_<sessionId>.

Customization

Custom Instructions

Guide the AI's tone and behavior:

await sendChat({
  client,
  body: {
    message: 'Hello!',
    threadId: 'session-123',
    customInstructions: `
      You are a helpful shopping assistant for TechStore.
      Be friendly and casual in tone.
      Always suggest related accessories when recommending products.
      If asked about pricing, mention our price-match guarantee.
    `,
  },
});

Workspace Description

Provide context about your site so the AI can give more relevant answers:

await sendChat({
  client,
  body: {
    message: 'Do you have any sales?',
    threadId: 'session-123',
    workspaceDescription:
      'Premium electronics retailer specializing in laptops, gaming gear, and smart home devices.',
  },
});

Product and Content Filtering

Scope the AI's knowledge to specific subsets of your catalog:

// Only recommend in-stock gaming laptops under $2000
await sendChat({
  client,
  body: {
    message: 'What do you recommend?',
    threadId: 'session-123',
    productFilter: {
      categories: ['Gaming Laptops'],
      priceMax: 2000,
      stockStatus: 'instock',
    },
  },
});

// Only reference tutorial content
await sendChat({
  client,
  body: {
    message: 'How do I set up my new laptop?',
    threadId: 'session-123',
    postFilter: {
      postType: 'tutorial',
      categories: ['Getting Started'],
    },
  },
});

Suggested Prompts

Pre-configured prompts help users start conversations:

# Create a prompt
curl -X POST https://api.intufind.com/prompts \
  -H "Authorization: Bearer if_sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "prompt-deals",
    "title": "Show me deals",
    "prompt": "What products are currently on sale?",
    "icon": "tag",
    "priority": 10,
    "metadata": {"initial": true}
  }'
import { upsertPrompt, listPrompts } from '@intufind/ai-sdk';

await upsertPrompt({
  client,
  body: {
    id: 'prompt-deals',
    title: 'Show me deals',
    prompt: 'What products are currently on sale?',
    icon: 'tag',
    priority: 10,
    metadata: { initial: true },
  },
});

// Display initial prompts as clickable buttons
const { data } = await listPrompts({ client });

Live Agent Handoff

When the AI can't fully resolve a request, it can offer to connect the customer with a human agent:

await sendChat({
  client,
  body: {
    message: 'I want to speak to someone about a refund',
    threadId: 'session-123',
    liveAgentEnabled: true,
  },
});

The AI will present a handoff offer to the user. When accepted, the conversation transfers to your support team via Slack or other configured providers, with full conversation context preserved.

See Live Agent for provider setup.

Response Structure

The chat response includes the AI message along with any associated entities:

interface ChatResponse {
  message: {
    intro?: string;        // AI response text
    products?: Product[];  // Matching products
    posts?: Post[];        // Matching content/articles
    prompts?: Prompt[];    // Suggested follow-up prompts
    orders?: Order[];      // Customer orders (when using MCP)
    order_summary?: string;
  };
}

Streaming

For real-time, token-by-token display, the /chat endpoint returns NDJSON when streamed. See the Streaming Chat guide for implementation details and React hooks.

Widget Integration

For a ready-to-use chat widget with no code required, see the Chat Widget documentation.

Best Practices

  1. Generate unique thread IDs for each conversation
  2. Provide workspace context for more relevant responses
  3. Use custom instructions to match your brand voice
  4. Enable streaming for better user experience
  5. Implement handoff for complex support issues
  6. Track feedback to improve AI responses over time

Next Steps