Skip to main content

JavaScript SDK

The official Node.js / TypeScript client for the Netomi API.

Installation

npm install @netomi/sdk

Initialize the client

import { NetomiClient } from '@netomi/sdk';

const client = new NetomiClient({
apiKey: process.env.NETOMI_API_KEY,
environment: 'production', // or 'sandbox'
});

Common operations

Start a conversation:

const conversation = await client.conversations.create({
agentId: 'agent_abc123',
message: 'Hello',
userId: 'user_001',
});

Send a follow-up:

const reply = await client.conversations.sendMessage(conversation.id, {
message: 'My order number is 445566',
});

List agents:

for await (const agent of client.agents.list()) {
console.log(agent.name);
}

Configuration options

OptionTypeDefaultDescription
apiKeystringRequired. Your API key
environmentstringproductionproduction or sandbox
timeoutnumber30000Request timeout in ms
maxRetriesnumber3Auto-retry on 5xx and 429

Error handling

import { NetomiAPIError } from '@netomi/sdk';

try {
await client.conversations.create({ /* ... */ });
} catch (err) {
if (err instanceof NetomiAPIError) {
console.error(err.code, err.message);
}
}

TypeScript

The SDK ships with full type definitions — no @types/ package required.

Was this page helpful?