Intufind AI JavaScript SDK
Official JavaScript/TypeScript SDK for Intufind AI Cloud Services — AI-powered semantic search, chat, and recommendations for e-commerce.

Installation
npm install @intufind/ai-sdk
yarn add @intufind/ai-sdk
pnpm add @intufind/ai-sdk
Quick Start
import { IntufindClient } from '@intufind/ai-sdk';
const client = new IntufindClient({
apiKey: 'your-api-key',
siteUrl: 'https://your-site.com',
});
const results = await client.products().search({
text: 'wireless noise cancelling headphones',
limit: 10,
});
for (const product of results.results) {
console.log(`${product.name} - $${product.price}`);
}
Features
- Semantic Search — AI-powered product and content search
- AI Chat — Conversational shopping assistant with streaming support
- Recommendations — Trending, similar, and personalized product suggestions
- Content Indexing — Index products, posts, and custom content
- Webhooks — Real-time event notifications
- Full TypeScript Support — Complete type definitions included
Configuration
import { IntufindClient, Configuration } from '@intufind/ai-sdk';
const client = new IntufindClient({
apiKey: 'your-api-key',
siteUrl: 'https://your-site.com',
apiEndpoint: 'https://api.intufind.com',
streamingEndpoint: 'https://stream.intufind.com',
timeout: 30000,
debug: false,
});
const config = new Configuration({
apiKey: 'your-api-key',
siteUrl: 'https://your-site.com',
});
const client = new IntufindClient(config);
Usage Examples
Products
await client.products().upsert({
id: 'sku-123',
name: 'Wireless Headphones',
content: 'Premium wireless headphones with active noise cancellation...',
price: 299.99,
categories: ['electronics', 'audio'],
attributes: {
color: ['Black', 'Silver'],
brand: ['AudioPro'],
},
});
const results = await client.products().search({
text: 'comfortable headphones for working from home',
limit: 10,
filters: {
categories: ['electronics'],
},
});
await client.products().delete('sku-123');
Posts / Content
await client.posts().upsert({
id: 'post-456',
title: 'Best Headphones for Remote Work',
content: 'Finding the perfect headphones for your home office...',
status: 'publish',
categories: ['guides', 'audio'],
});
const results = await client.posts().search({
text: 'headphone buying guide',
limit: 5,
});
AI Chat
const response = await client.chat().send({
message: 'I need headphones for working from home, budget around $200',
threadId: 'user-session-123',
});
console.log(response.intro);
for (const product of response.products) {
console.log(`- ${product.name}: $${product.price}`);
}
const stream = await client.chat().stream({
message: 'Tell me more about the first option',
threadId: 'user-session-123',
});
for await (const chunk of stream) {
if (isTextDelta(chunk)) {
process.stdout.write(chunk.delta);
} else if (isProduct(chunk)) {
console.log('\nProduct:', chunk.product.name);
}
}
Webhooks
await client.webhooks().create({
url: 'https://yoursite.com/webhook',
events: ['product.indexed', 'chat.completed'],
});
const webhooks = await client.webhooks().list();
const result = await client.webhooks().test('webhook-id');
Error Handling
import {
IntufindError,
AuthenticationError,
RateLimitError,
ValidationError,
NotFoundError,
} from '@intufind/ai-sdk';
try {
const results = await client.products().search({ text: 'headphones' });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Auth failed:', error.message);
} else if (error instanceof RateLimitError) {
console.error('Rate limited. Retry after:', error.retryAfter);
} else if (error instanceof ValidationError) {
console.error('Validation error:', error.message);
} else if (error instanceof NotFoundError) {
console.error('Not found:', error.message);
} else if (error instanceof IntufindError) {
console.error('API error:', error.message);
}
}
Available Services
| Products | client.products() | Product indexing and search |
| Posts | client.posts() | Content/blog post management |
| Chat | client.chat() | AI conversational interface |
| Prompts | client.prompts() | Custom AI prompt templates |
| Threads | client.threads() | Chat thread management |
| Webhooks | client.webhooks() | Webhook management |
| Tenant | client.tenant() | Account and subscription info |
| Provisioning | client.provisioning() | License activation |
| Config | client.config() | Widget/theme configuration |
Immutable Configuration
The client supports immutable configuration updates:
const debugClient = client.withDebug(true);
const otherSite = client.withSiteUrl('https://other-site.com');
const otherKey = client.withApiKey('different-api-key');
Requirements
- Node.js 18.0.0 or later
- Modern browsers with
fetch support
Development
npm install
npm run build
npm run dev
npm test
npm run type-check
npm run lint
Support
License
MIT License — see LICENSE for details.