Installation
Choose your preferred installation method:- Script Tag
- React SDK
Add the script before
After the script loads, use
</body>:| Attribute | Required | Description |
|---|---|---|
data-api-url | Yes | https://api.usecrow.org |
data-product-id | Yes | Your product ID from dashboard |
data-agent-name | No | Display name (defaults to “Assistant”) |
data-variant | No | widget (default) or copilot |
data-subdomain | No | Subdomain key for multi-subdomain endpoints |
data-language | No | ISO 639-1 language code (e.g., es, fr, ja). See Multi-Language |
data-context-label | No | Label shown in the widget indicating what page the AI sees. See Context Label |
window.crow() to pass functions and objects:| Command | Description |
|---|---|
setIdentityTokenFetcher | Auto-refreshing JWT function. See Identity |
setContext | Page context object. See Context |
onToolResult | Callback on tool completion. See Callbacks |
registerToolRenderers | Custom inline visuals. See Renderers |
identify | Manual JWT token (alternative to fetcher) |
registerTools | Client-side tool handlers |
setContextLabel | Visible label for current page context. See Context Label |
open | Programmatically open/expand the widget or copilot |
close | Programmatically close/collapse the widget or copilot |
Find Your Product ID
- Go to app.usecrow.ai/deploy
- Copy your Product ID
User Identity
Authenticate users for persistent conversations and user-specific actions.- Script Tag
- React SDK
Option A — Auto-refresh (recommended). Pass a function that fetches a JWT. The SDK calls it on mount and re-calls it automatically when the token expires (401):Option B — Manual. Pass a static token (you handle refresh yourself):
Client-Side Tools
Register tools the agent can call. The return value from your handler is sent back to the agent, so it can confirm success or handle errors intelligently. See Client-Side Tools for full setup.- Script Tag
- React SDK
Page Context
Give the AI context about the current page so it can perform page-aware actions.- Script Tag
- React SDK
Context Label
Show users what page context the AI is aware of — a small label displayed at the top of the widget. Unlikecontext (which is invisible data sent to the AI), contextLabel is a visible indicator for the user.
- Script Tag
- React SDK
Tool Result Callbacks
React to server-side tool completions — refresh data, show a diff UI, dispatch events, etc.- Script Tag
- React SDK
Tool Renderers
Render custom visuals inline in the chat when a tool completes — data cards, tables, charts, and more. Your renderer receives{ result, status } and returns one of:
| Return type | Use case |
|---|---|
| HTML string | Data cards, tables, simple visuals |
| HTMLElement | Charts via Chart.js, D3, ECharts, Plotly |
| ReactNode | Full React components (React SDK only) |
- Script Tag
- React SDK
Programmatic Open / Close
Open or close the widget from your own code — useful for onboarding flows, feature tours, or reacting to in-app events.Quick Q&A
Some users find it more intuitive to read setup instructions in Q&A format. Here’s everything above as quick answers:How do I add the chat to my app?
How do I add the chat to my app?
Install the SDK and drop in one component:That’s it. Chat works anonymously out of the box. No provider wrapping needed.
How do I authenticate users?
How do I authenticate users?
Two steps:The SDK calls this on mount and auto-refreshes when the token expires. No
- Create a backend endpoint (~15 lines) that reads your existing session and mints a JWT signed with your Crow verification secret. Crow never sees your auth system — the JWT is the bridge.
- Pass it as a prop:
useEffect, no setInterval, no manual calls.This enables: conversation history, personalized responses, and user-specific tool actions.See Identity Verification for the backend JWT setup.How do I give the AI context about the current page?
How do I give the AI context about the current page?
Pass a This gets injected into the AI’s system prompt so it can perform page-aware actions like “edit this item” without asking which one.
context object. It’s reactive — when it changes (e.g., user navigates), the AI automatically knows.How do I handle SPA navigation for links?
How do I handle SPA navigation for links?
How do I react when the AI calls a tool?
How do I react when the AI calls a tool?
React SDK — use Script Tag — use
onToolResult and toolRenderers as props:window.crow():What does the full setup look like?
What does the full setup look like?
Everything is a prop on one component:No providers, no initializers, no polling.
Troubleshooting
| Issue | Solution |
|---|---|
| Widget not appearing | Check Product ID, verify script/component is rendered |
| Console errors | Check apiUrl is correct |
| CORS errors | Contact support to whitelist your domain |
