Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

channel3-sdk

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

channel3-sdk

The official TypeScript/JavaScript SDK for Channel3 AI Shopping API

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
33
175%
Maintainers
1
Weekly downloads
 
Created
Source

Channel3 TypeScript/JavaScript SDK

npm version TypeScript License: MIT Node.js

The official TypeScript/JavaScript SDK for the Channel3 AI Shopping API. Search for products using text, images, and advanced filters with AI-powered semantic search.

🚀 Features

  • 🔍 Text Search: Natural language product search
  • 🖼️ Visual Search: Search by image URL or base64 data
  • 🎯 Advanced Filters: Filter by brand, price, gender, availability
  • ⚙️ Search Configuration: Control query enrichment and semantic search
  • 🔧 TypeScript First: Full type safety with auto-generated types from OpenAPI
  • 🛡️ Robust Error Handling: Detailed error types for different scenarios

📦 Installation

npm install channel3-sdk
# or
yarn add channel3-sdk
# or
pnpm add channel3-sdk

🏃‍♂️ Quick Start

Basic Usage

import { Channel3Client } from 'channel3-sdk';

const client = new Channel3Client({
  apiKey: process.env.CHANNEL3_API_KEY!,
});

// Search for products
const products = await client.search({
  query: 'blue denim jacket',
});

console.log(`Found ${products.length} products`);
products.forEach((product) => {
  console.log(`${product.title} - $${product.price.price} ${product.price.currency}`);
});

Advanced Search with Configuration

// Search with custom configuration and context
const results = await client.search({
  query: 'running shoes',
  config: {
    enrich_query: true, // Enable query enrichment
    semantic_search: true, // Enable semantic search
  },
  context: 'Looking for athletic footwear for marathon training',
  filters: {
    price: { min_price: 50, max_price: 200 },
    gender: 'male',
    brand_ids: ['nike-id', 'adidas-id'],
  },
  limit: 10,
});
// Search by image URL
const imageResults = await client.search({
  image_url: 'https://example.com/product-image.jpg',
});

// Search by base64 image
const base64Results = await client.search({
  base64_image: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...',
});

📚 API Reference

Client Configuration

interface Channel3ClientConfig {
  apiKey: string; // Your Channel3 API key
}

Methods

search(options: SearchRequest): Promise<Product[]>

Search for products with various options.

Parameters:

  • query?: string - Text search query
  • image_url?: string - URL of image for visual search
  • base64_image?: string - Base64-encoded image for visual search
  • config?: SearchConfig - Search configuration options
  • context?: string - Additional context for the search
  • filters?: SearchFilters - Advanced filtering options
  • limit?: number - Maximum results to return (default: 20)

getProduct(productId: string): Promise<ProductDetail>

Get detailed information about a specific product.

getBrands(options?: GetBrandsV0BrandsGetRequest): Promise<PaginatedResponseBrand>

Get list of available brands with pagination.

getBrand(brandId: string): Promise<Brand>

Get detailed information about a specific brand.

🔧 Configuration Options

Search Configuration

interface SearchConfig {
  enrich_query?: boolean; // Enable AI query enrichment (default: true)
  semantic_search?: boolean; // Enable semantic search (default: true)
}

Search Filters

interface SearchFilters {
  brand_ids?: string[]; // Filter by specific brand IDs
  gender?: 'male' | 'female' | 'unisex'; // Gender filter
  price?: {
    // Price range filter
    min_price?: number;
    max_price?: number;
  };
  availability?: AvailabilityStatus[]; // Availability filter
}

🌍 Environment Variables

  • CHANNEL3_API_KEY - Your Channel3 API key (required)

🚨 Error Handling

The SDK provides specific error types for different scenarios:

import {
  Channel3AuthenticationError, // 401 - Invalid API key
  Channel3ValidationError, // 422 - Invalid request data
  Channel3NotFoundError, // 404 - Resource not found
  Channel3ServerError, // 500 - Server error
  Channel3ConnectionError, // Network/timeout errors
} from 'channel3-sdk';

try {
  const products = await client.search({ query: 'shoes' });
} catch (error) {
  if (error instanceof Channel3AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof Channel3ValidationError) {
    console.error('Invalid request:', error.message);
  } else if (error instanceof Channel3ConnectionError) {
    console.error('Network error:', error.message);
  }
}

📝 License

MIT License - see LICENSE file for details.

🤝 Support

Made with ❤️ by Channel3

Keywords

ai

FAQs

Package last updated on 12 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts