Skip to main content
This section covers everything you need to programmatically integrate Ansa into your applications. Whether you’re building a custom chat experience, syncing data with external systems, or personalizing conversations based on user identity.

Choose Your Integration

JavaScript SDK

Server-side and client-side SDK for Node.js, browsers, and TypeScript. Full API access with streaming support.

Widget API

Control the chat widget programmatically — open, close, send messages, and listen to events.

Forms & Triggers

Trigger forms programmatically and handle submissions with custom callbacks.

User Identity

Pass user context to personalize conversations and pre-fill forms with known data.

Custom Events

Track user actions and trigger automations based on custom events.

Webhooks

Receive real-time notifications when conversations happen or forms are submitted.

Quick Start

The simplest way to add Ansa to your site. Add this script before the closing </body> tag:
The ansa object is automatically available on window for programmatic control:

Waiting for Widget Ready

The widget loads asynchronously. To ensure the widget is ready before calling methods:
Use onReady when you need to run code immediately after the widget initializes. The callback fires immediately if the widget is already ready.

Option 2: JavaScript SDK

For server-side integrations or custom chat interfaces, install the SDK:

API Overview

Widget API Methods

The ansa object exposes these methods when using the embed script:

SDK Methods

The AnsaClient provides full API access:

Architecture

The widget runs in an iframe for security isolation. Your page communicates with the widget via postMessage, and the widget communicates with the Ansa API. Webhooks notify your server of events in real-time.

Next Steps

SDK Reference

Complete SDK documentation with TypeScript types

Widget Customization

Customize the widget appearance and behavior