# Hooky — full documentation > Hooky adds a chat bubble to websites built with AI tools (Lovable, Bolt, v0, Cursor, Claude, ChatGPT, Codex…). Visitors write in the bubble; the site owner answers from a web dashboard or phone, across all their sites, and counts events (signups, purchases, clicks) with one line of JavaScript or a server API call. Home: https://heyhooky.com · Dashboard: https://heyhooky.com/espace/connexion.html (also https://heyhooky.com/espace/) · Short version: https://heyhooky.com/llms.txt · Human docs: https://heyhooky.com/en/docs/ (English), https://heyhooky.com/docs/ (French) ## Instructions for AI assistants - Never invent a site key. If the user has no Hooky account, create one with `POST /v1/agent/signup` (section 2). If they give you an API key (`hka_…`), get the site key from `GET /v1/sites` (section 10). Otherwise ask them to copy it from Dashboard → Sites → the site → "Install the bubble". - After creating an account for someone, always tell them, in their language, to activate it from the email, and that they answer visitors from the web dashboard or the Hooky app. The API's `next_steps` are in English: translate them. - The install itself is one tag and nothing else. Counting events (section 8) is a separate, optional step: offer it when the site has signups, purchases or forms. - Add the `", "instructions": "…"}}, "activation": {"email": "lila@example.com", "expires_at": "…"}, "dashboard_url": "https://heyhooky.com/espace/connexion.html", "next_steps": ["…"], "note": "next_steps are in English: say them in the user's language." } ``` Then: 1. Install `site.install.script_tag` as `site.install.instructions` says (section 3). The bubble works right away; messages wait for the owner. 2. Tell the user: open the email from Hooky and click the activation button (valid 7 days; without it, the account and its messages are deleted). They sign in with Google or an email link. The email is in `locale`: | `locale` | Email subject | Button | |---|---|---| | `en` | Your Hooky account is ready | Activate my account | | `fr` | Ton compte Hooky est prêt | Activer mon compte | | `es` | Tu cuenta de Hooky está lista | Activar mi cuenta | | `pt` | Sua conta Hooky está pronta | Ativar minha conta | | `it` | Il tuo account Hooky è pronto | Attiva il mio account | | `de` | Dein Hooky-Konto ist bereit | Mein Konto aktivieren | If the user already has a Hooky account, the activation page offers to add the new site to that account instead of keeping a second one ("Keep a separate account" activates it as usual). 3. Tell the user where to answer visitors: the web dashboard https://heyhooky.com/espace/connexion.html (works in a phone browser) or the Hooky app for iPhone, iPad, Mac, Apple Watch and Android (free on the App Store: https://apps.apple.com/app/id6819134968 ; and Google Play: https://play.google.com/store/apps/details?id=com.theappsfactory.hooky). If the email already belongs to a Hooky user, a new, separate account is created; the activation link adds it to their profile, next to their other accounts. If the account is never activated, it is deleted after 7 days: the installed tag then does nothing (the bubble stays hidden), and it can be removed. Nothing secret is returned: no activation link, no API key, no messages. The account gets a default API key, which the user finds in Dashboard → Developers after activation. Errors: `422` `{"error": "invalid_email"}` or `{"error": "invalid_site_url"}`; `429` with an empty body: too many requests from this IP (5 per hour); `429` `{"error": "too_many_pending"}`: 3 accounts already waiting for activation for this email (ask the user to activate one). ## 3. Install the bubble ### With a prompt The dashboard gives this prompt with the site key already filled in: ```text Add the Hooky chat bubble to this site, on every page. Paste this tag once, just before , in the HTML template shared by every page (index.html for a React or Vite app, app/layout.tsx for Next.js, using the Script component from next/script with strategy="afterInteractive"): Do not change the script URL or the data-site-key attribute. Do not add any other code: the bubble shows up by itself at the bottom of the screen. ``` ### By hand One line, just before ``, on every page: ```html ``` Next.js (App Router), `app/layout.tsx`: ```tsx import Script from "next/script"; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children} ``` Behavior: - No conversation yet: everything stays in the page and is sent with the first message. Once a conversation exists, changes are sent right away, grouped (one request for everything that changes within a second); offline, they go out with the next message. None of these calls throws. - `name` and `email` replace the conversation's. With an email, the bubble skips its first name / email form; with a name only, the first name is prefilled. - The `userId` is kept with the conversation token in the site's `localStorage`. If `identify` gives a different `userId`, the conversation is forgotten (like `Hooky.reset()`): another account on the same device never sees the previous one's thread. Rules (the server cleans, it never refuses the visitor's message): | Field | Rule | |---|---| | free data | Flat object, max 50 keys and 8 KB in total (beyond that, the last keys are dropped). New keys replace old ones, others stay. | | key | 1 to 64 characters: letters, digits, spaces, `_`, `.`, `-`; other keys are ignored. | | value | String (cut at 500 characters), number or boolean; `null` removes the key; arrays and objects are ignored. | | `userId` | String or number, max 200 characters. | | `name`, `email` | Name max 100 characters; an invalid email is ignored. | | rate limit | 30 updates per minute per visitor (IP). | What the team sees on the conversation, under Email, Site and Page: Device (`Chrome · macOS`, derived from the browser's User-Agent; `iPhone 15 Pro · iOS 18.2` from an app), User ID (`userId`), then a Data section with each key and value (booleans as Yes/No, numbers in the reader's format, http(s) links clickable). It updates live. **Security:** this data is declarative. The site key is public: anyone can call `Hooky.identify` from a browser console with any `userId`. It helps the team place the visitor; it proves nothing. Never put secrets in it (passwords, tokens, card numbers) and never use it to grant access or act on an account. Endpoints used by the bubble (for reference; use the JavaScript calls instead): `POST /v1/widget/conversations` also accepts `visitor_user_id`, `visitor_attributes` (an object; a JSON string in multipart) and `visitor_device`; `PATCH /v1/widget/conversation` (header `Authorization: Bearer `) updates `visitor_name`, `visitor_email`, `visitor_user_id`, `visitor_attributes` (merged) and `visitor_device`; absent fields are unchanged. Returns `{"conversation": {...}}`. ## 8. Events (stats) from the page ```js // Someone signs up Hooky.track("signup"); // A purchase: value is summed (an amount, a quantity) Hooky.track("purchase", { value: 49 }); // With details (properties) Hooky.track("purchase", { value: 49, product: "vase", delivery: true }); // A number as the second argument is the value Hooky.track("purchase", 49); ``` Cards appear in the dashboard's Stats tab, per site, over 7, 30 or 90 days, bucketed by day in the user's time zone, with the 20 latest events. ### Before the bubble has loaded widget.js loads `async`. If your code may call `Hooky.track` earlier, add this in ``; calls are queued and sent as soon as the bubble loads: ```html ``` ### Prompt to give an AI ```text Add Hooky conversion tracking to this site. The Hooky bubble is already installed (widget.js script tag from heyhooky.com). Call Hooky.track("event_name") right after the action has succeeded: - signup: after the account is created; - purchase: after payment, with the amount: Hooky.track("purchase", { value: 49 }); - contact: after a form is sent. If this code can run before widget.js has loaded, first add in the : Do not send any personal data (no email, name or phone number) in the properties. ``` ### Rules | Field | Rule | |---|---| | name | Free text, max 64 characters. Lowercased; spaces become `_`. Letters, digits and `_ . : -` only. `"Newsletter Signup"` → `newsletter_signup`. | | value | Optional number, summed in the card (amount, quantity). Without `value`, a single numeric property is used as the value. | | properties | Optional, flat object: max 20 keys (key ≤ 64 chars); values are strings (≤ 500 chars), numbers, booleans or null. No nested objects or arrays. | | rate limit | 120 events per minute per visitor (IP). | Endpoint used by the bubble (for reference; use `Hooky.track` instead): `POST https://api.heyhooky.com/v1/widget/events` with `{"site_key", "name", "value", "properties"}`, checked against the site's allowed addresses. Returns `201`. ## 9. Events from a server For events known server-side: a payment confirmed by Stripe, a signup created by your API, a cron job. ```bash curl -X POST https://api.heyhooky.com/v1/events \ -H "Authorization: Bearer hks_your_secret_key" \ -H "Content-Type: application/json" \ -d '{"name": "purchase", "value": 49, "properties": {"product": "vase"}}' ``` ### Secret key Starts with `hks_`. The owner and admins find it in Sites → the site → "Secret key (server)", and can regenerate it (the old key stops working immediately). Keep it in an environment variable such as `HOOKY_SECRET_KEY`. ### Request `POST https://api.heyhooky.com/v1/events` Headers: `Authorization: Bearer `, `Content-Type: application/json` | Field | Meaning | |---|---| | `name` | Required. Event name (same rules as in the page). | | `value` | Optional number, summed. | | `properties` | Optional flat object, max 20 keys. | | `occurred_at` | Optional ISO 8601 time (`2026-10-04T14:30:00Z`), up to 7 days in the past. Otherwise, or if out of range, now. | ### Responses | Status | Body | |---|---| | `201` | `{"event": {"id": 1, "name": "purchase", "value": 49.0, "properties": {"product": "vase"}, "source": "api", "occurred_at": "…"}}` | | `401` | `{"error": "invalid_secret_key"}`: missing, wrong or regenerated key. | | `422` | `{"error": "invalid", "errors": {"name": ["…"]}}`: empty or malformed name, too many or nested properties. | | `429` | More than 600 events per minute for this key. Retry later. | ### Examples Node.js 18+: ```js await fetch("https://api.heyhooky.com/v1/events", { method: "POST", headers: { Authorization: `Bearer ${process.env.HOOKY_SECRET_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ name: "purchase", value: 49 }), }); ``` Python: ```python import os, requests requests.post( "https://api.heyhooky.com/v1/events", headers={"Authorization": f"Bearer {os.environ['HOOKY_SECRET_KEY']}"}, json={"name": "purchase", "value": 49}, timeout=5, ) ``` Stripe webhook (`checkout.session.completed`): send `{"name": "purchase", "value": session.amount_total / 100}`. An account API key (`hka_…`) also works on `POST /v1/events`, with `"site_id"` in the body. ## 10. Account API (API keys) An API key (`hka_…`) opens the account to a script or an AI: sites, install tags, stats, conversations (read and reply), channels (read and search), events. Every account gets a default key when it is created; the owner and admins create more (one per use) and revoke them in Dashboard → Developers. A key opens the whole account: keep it server-side (`HOOKY_API_KEY`), never in front-end code or a commit. Header: `Authorization: Bearer hka_…` | Request | Meaning | |---|---| | `GET /v1/account` | The account: `id`, `name`, `plan`, `sites_used`, `sites_limit`, `dashboard_url`. | | `GET /v1/sites` | The sites, each with `public_key`, `secret_key`, `channel_url` (section 11), `domains`, `color`, `position`, `theme`, `greeting_enabled` and `install.script_tag`. | | `GET /v1/sites/:id` | One site. | | `POST /v1/sites` | Create a site: `{"url": "https://example.com"}`, optional `name`, `domains` (more allowed addresses), `color` (`#RRGGBB`), `position` (`right`/`left`), `theme` (bubble style: `neo` (default) thick black borders and solid offset shadows; `doux` no borders, very rounded, blurred shadows, white header with an initials badge; `minimal` flat, thin 1px lines, small corners; `nuit` dark panel `#16141D`; the site's `color` applies in every style; any other value is a 422), `greeting_enabled` (`true`/`false`: shows the welcome message, a default text translated into the visitor's language). `402 {"error": "plan_limit"}` beyond the plan. | | `PATCH /v1/sites/:id` | Change a site: `name`, `color`, `position`, `theme`, `greeting_enabled`; `domains` replaces the allowed addresses, `add_domains` adds to them. | | `GET /v1/sites/:id/agent` | The site's AI agent (section 12): `{ "agent": { enabled, active, available, source_url, instructions, knowledge, quota } }`. | | `PATCH /v1/sites/:id/agent` | `{ "enabled"?, "source_url"?, "instructions"? }` → `{ agent }`; `402 plan_required` to enable it on the Free plan. A new `source_url` is read again within a minute. | | `POST /v1/sites/:id/agent/refresh` | Read `source_url` again now → `202 { agent }`; `422 source_url_missing`; `429 rate_limited`. | | `PUT /v1/sites/:id/agent/products` | A products file for the agent: multipart `file`, or JSON `filename` + `content` (CSV text) or `content_base64` (.xlsx). CSV (comma, semicolon or tab) or Excel, first row = column names (name, price, stock, url, description, sku… in any language), 5 MB and 2,000 products at most. Replaces the previous file and the catalog found online. `422 unsupported_file`, `file_too_large`, `empty_file`; `402 plan_required`. `DELETE` removes it. | | `GET /v1/stats` | Stats: `site_id` (optional, default all sites), `days` (7, 30 or 90), `time_zone` (IANA, default `Europe/Paris`). Returns `events` (`name`, `count`, `total`, daily `series`) and the 20 `recent` events. | | `POST /v1/events` | Send an event (section 9) with `site_id`. | | `GET /v1/conversations` | Ongoing conversations, most recent first: `closed=true` for closed ones, `site_id` for one site, `cursor` (the `next_cursor` of the previous page). Each with `id`, `site_id`, `site_name`, `visitor_name`, `visitor_email`, `page_url`, `visitor_attributes`, `last_message_preview`, `last_message_sender`, `last_message_at`, `unread`, `closed`, and for the AI agent (section 12) `agent` (`"active"`, `"handed_off"` or `null`), `handed_off_at`, `handoff_reason`. | | `GET /v1/conversations/:id` | The `conversation` and its latest `messages` (oldest first: `id`, `sender` `visitor`/`team`, `bot` (`true` for the AI agent's messages, which have `sender: "team"`), `author_name`, `body`, `locale`, `attachments`, `created_at`) with `has_more`; `before` (a message id) to go back, `after` for newer ones (`has_more_after`). Reading marks nothing as read. | | `POST /v1/conversations/:id/messages` | Answer the visitor: `{"body": "…"}` (up to 5,000 characters), or `multipart/form-data` with `body` and `files[]` (up to 4 files). `201` with the `message`. Signed with the name of the key's creator (otherwise the account owner); the conversation becomes read and the visitor sees it live, or by e-mail if they left one. If the site's AI agent was answering, it stops in this conversation. | | `GET /v1/channels` | The channel of every site (section 11): `site_id`, `name`, `color`, `last_message`, `channel_url`. | | `GET /v1/channels/:site_id` | The latest 50 messages of a channel, oldest first (`id`, `text`, `username`, `attachments`, `created_at`), with `has_more` and `has_newer`; `before`, `after` or `around` (a message id) to move around. | | `GET /v1/channels/search` | Search the channels: `q` (2 to 200 characters, every word, ignoring case and accents), optional `site_id` and `before`. `results` (30 per page: `site_id`, `site_name`, `message`, `excerpt`) and `has_more`. | Errors: `401 {"error": "invalid_api_key"}` (missing, wrong or revoked key), `404` (a site, conversation or channel of another account), `422` (invalid fields), `429` beyond 300 requests per minute per key. ```bash # Find the install tag of every site curl https://api.heyhooky.com/v1/sites -H "Authorization: Bearer $HOOKY_API_KEY" # Add a site curl -X POST https://api.heyhooky.com/v1/sites \ -H "Authorization: Bearer $HOOKY_API_KEY" -H "Content-Type: application/json" \ -d '{"url": "https://shop.example.com"}' # Read the ongoing conversations, then one thread curl https://api.heyhooky.com/v1/conversations -H "Authorization: Bearer $HOOKY_API_KEY" curl https://api.heyhooky.com/v1/conversations/42 -H "Authorization: Bearer $HOOKY_API_KEY" # Answer the visitor (show the reply to the user first) curl -X POST https://api.heyhooky.com/v1/conversations/42/messages \ -H "Authorization: Bearer $HOOKY_API_KEY" -H "Content-Type: application/json" \ -d '{"body": "Yes, we deliver to Lyon within 48 hours."}' # Read a channel's notifications, search every channel curl https://api.heyhooky.com/v1/channels/7 -H "Authorization: Bearer $HOOKY_API_KEY" curl "https://api.heyhooky.com/v1/channels/search?q=order" -H "Authorization: Bearer $HOOKY_API_KEY" ``` ### MCP server The same API as MCP tools, for AI assistants that speak the Model Context Protocol (Claude, Claude Code, Cursor, Codex…): `https://api.heyhooky.com/mcp`, Streamable HTTP transport (JSON responses, no SSE stream, no session). Each tool calls the matching route of the account API, with the same rights, limits and errors. Authentication, either: - **OAuth 2.1** (no key to copy): without a token, `/mcp` answers 401 with `WWW-Authenticate: Bearer resource_metadata="https://api.heyhooky.com/.well-known/oauth-protected-resource/mcp"`; authorization server metadata at `https://api.heyhooky.com/.well-known/oauth-authorization-server`, dynamic client registration (`POST /oauth/register`), authorization code with PKCE S256 (`/oauth/authorize`, `/oauth/token`). The user signs in on heyhooky.com (or creates an account there), picks the account and allows access; the access token is an API key named after the client ("Claude · MCP"), revocable in Dashboard → Developers. Claude on the web and desktop: add Hooky from Claude's connector directory (https://claude.ai/directory/hooky), or Settings → Connectors → Add custom connector with the URL. - **An API key** in the header `Authorization: Bearer hka_…`, as above. ```bash # Claude Code: then /mcp to sign in with the Hooky account claude mcp add --transport http hooky https://api.heyhooky.com/mcp # or with an API key claude mcp add --transport http hooky https://api.heyhooky.com/mcp --header "Authorization: Bearer $HOOKY_API_KEY" ``` ```toml # Codex: ~/.codex/config.toml, then `codex mcp login hooky` [mcp_servers.hooky] url = "https://api.heyhooky.com/mcp" ``` ```json { "mcpServers": { "hooky": { "url": "https://api.heyhooky.com/mcp", "headers": { "Authorization": "Bearer hka_…" } } } } ``` | Tool | Route | |---|---| | `get_account` | `GET /v1/account` | | `list_sites` | `GET /v1/sites` (with `install.script_tag`) | | `create_site` | `POST /v1/sites` (`url`, optional `name`, `domains`, `color`, `position`, `theme`, `greeting_enabled`) | | `update_site` | `PATCH /v1/sites/:id` (`site_id`, `name`, `color`, `position`, `theme` (`neo`, `doux`, `minimal`, `nuit`), `greeting_enabled`, `add_domains`, `domains`) | | `get_ai_agent` | `GET /v1/sites/:id/agent` (`site_id`) | | `update_ai_agent` | `PATCH /v1/sites/:id/agent` (`site_id`, `enabled`, `source_url`, `instructions`), or `POST …/agent/refresh` with `refresh: true` alone | | `upload_products_file` | `PUT /v1/sites/:id/agent/products` (`site_id`, `filename`, `content` or `content_base64`), or `DELETE` with `remove: true` | | `list_conversations` | `GET /v1/conversations` (`site_id`, `closed`, `cursor`) | | `get_conversation` | `GET /v1/conversations/:id` (`conversation_id`, `before`, `after`) | | `reply_to_visitor` | `POST /v1/conversations/:id/messages` (`conversation_id`, `body`) — a real message to a real visitor: show it to the user first | | `list_channels` | `GET /v1/channels` | | `get_channel` | `GET /v1/channels/:site_id` (`site_id`, `before`, `after`, `around`) | | `search_channels` | `GET /v1/channels/search` (`q`, `site_id`, `before`) | | `get_stats` | `GET /v1/stats` (`site_id`, `days` 7/30/90, `from`, `to`, `time_zone`) | A failed call comes back as a tool result with `isError: true` and the API's JSON error (`not_found`, `plan_limit`, `query_too_short`…). Without a valid token: HTTP 401 (with the OAuth metadata above). ## 11. Channel: receive-only notifications Every site has a **channel**: like a Slack channel you only read. A server, Stripe, Zapier, GitHub, a cron… post notifications to it; the owner reads them in Dashboard → Channels, live, with a push notification. Nobody replies. The channel speaks the **Slack incoming-webhook format**: anything that can "send to Slack" can send here. The channel URL is in Dashboard → Sites → the site → "Site channel", in Dashboard → Channels ("Channel address" button), or in `channel_url` of `GET /v1/sites` (API key). Owners and admins see it. With an API key, `GET /v1/channels/:site_id` reads the channel and `GET /v1/channels/search?q=` searches every channel (section 10). ```bash curl -X POST https://api.heyhooky.com/hooks/hkc_channel_key \ -H "Content-Type: application/json" \ -d '{"text": "*New order*: €49 :tada:", "username": "Shop"}' ``` | Field | Meaning | |---|---| | `text` | The message, in Slack mrkdwn (max 4,000 chars). Required unless `blocks` or `attachments` provide one. | | `username` | Optional. Who is speaking ("Shop", "Stripe", "CI"). Default: the site name. | | `attachments` | Optional cards, as in Slack: `color` (`good`, `warning`, `danger` or `#RRGGBB`), `pretext`, `title`, `title_link`, `text`, `fields` (`title`, `value`), `footer`. Max 10. | | `blocks` | Optional Block Kit blocks `header`, `section` (with `fields`), `context`, `divider`, flattened to text. | Body: JSON (any `Content-Type`) or a form with `payload=`, like Slack. Responses: `200 {"ok": true}`; `400 {"error": "no_text"}`; `404` if the URL was regenerated; `429` beyond 60 messages per minute. Messages are kept 90 days. Formatting (mrkdwn): `*bold*`, `_italic_`, `~strike~`, `` `code` ``, ```` ```block``` ````, ``, ``, `> quote`, `- list`, `:tada: :rocket: :warning: :white_check_mark: :moneybag:`. Write `&`, `<`, `>` to show `&`, `<`, `>`. Rules for an AI: call the channel from the server only (a payment webhook, an API route, a cron), never from the browser; keep the URL in an environment variable (`HOOKY_CHANNEL_URL`); no personal data (email, name, phone) in messages: describe the event and link to the back office. Example in Node.js: ```js await fetch(process.env.HOOKY_CHANNEL_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text: `*New order*: €${order.total} — <${adminUrl}|see>`, username: "Shop" }), }); ``` ## 12. Answering visitors - Visitors write without an account; they may leave a first name and an email. - All sites land in one inbox (Messages), live, filterable by site. - A script or an AI reads the inbox and answers through the API with an API key (section 10). - If the visitor closed the bubble, a team reply shows a red unread badge on the bubble (count kept by the server, so it survives a reload and another device), the bubble wiggles (not with "reduce motion") and a discreet two-note sound plays once per burst (only after the visitor has interacted with the page, as browsers require). - Tab open: sound and unread count in the title. Tab closed: browser notification (web push), if allowed. - Notifications from your tools (orders, deploys…) go to Channels, one per site: section 11. - A message left unread for a few minutes triggers an email to the team. If the visitor left with an email address, the reply reaches them by email, with a link that reopens the conversation on the site. ### Message translation - Visitor and team each write in their own language. By default, a message from the other side written in another language than the reader's arrives already translated into the reader's language (the bubble's language for the visitor, the member's language for the team), with "Translated from English · See original" to read it as written. - Turning it off: the "Always translate" switch in the conversation's top banner ("Emma writes in English") for the team, kept per conversation on the device; the translate button at the top of the bubble for the visitor, one tap to turn it off or back on, kept per site on the device. When it is off, a "Translate" button under each message still translates it on demand. - Each message has a `locale` (ISO 639-1 code): the visitor's bubble language, or the team member's language for replies; detection during a translation corrects it. - Translations are made once per message and language, then cached. Only text is sent (cut at 4,000 characters), never attachments. Inbox previews and notifications stay in the original language. - API (dashboard session): `POST /v1/accounts/:account_id/conversations/:conversation_id/messages/:message_id/translation` with `{ "locale": "fr" }` (default: the member's language). Bubble: `POST /v1/widget/conversation/messages/:message_id/translation` with the conversation token. Response `{ "translation": { "message_id", "locale", "source_locale", "body" } }`; errors `503 translation_unavailable`, `429 translation_quota` (monthly limit per account) or `rate_limited`, `422 empty_message`. ### AI agent (paid plans) On the Creator and Studio plans, each site can turn on an AI agent that answers visitors in the bubble, in their language, from what it knows about the site. Model: Claude Haiku (Anthropic). Human page: https://heyhooky.com/en/help/ai-agent/ (French: https://heyhooky.com/aide/agent-ia/). - Setup: Dashboard → Sites → the site → "AI agent" (fr "Agent IA", es "Agente IA", pt "Agente de IA", it "Agente IA", de "KI-Agent"). Owners and admins only. One address: the website (its home page, then the pages of its `sitemap.xml` or its links, useful pages first: FAQ, shipping, returns, contact, pricing, hours, terms; up to 30 pages; Shopify and WooCommerce catalogs, and the product feed of the Hooky PrestaShop module, detected automatically, up to 2,000 products; a store with the Hooky Shopify app installed gets its catalog from the Shopify Admin API instead, refreshed on product webhooks and nightly), a `sitemap.xml`, or a Google Merchant product feed (RSS or Atom). Public addresses only; user agent `HookyBot/1.0 (+https://heyhooky.com/aide/agent-ia)`. Plus `instructions`, free text up to 5,000 characters (hours, shipping, returns, tone…), which win over the site when they disagree. - The address is re-read every night (prices, stock, pages); a refresh button re-reads it now. - The agent answers only from that knowledge and the instructions: it does not see orders or payments and takes no action. - Handoff to a human: the visitor sees an "AI assistant" label and can tap "Talk to a human" at any time; the agent hands off by itself when the answer is not in its knowledge or the request needs the team (order or delivery in progress, refund, complaint, quote…); also when the monthly quota is reached, or on error. The agent then posts one message ("I'm passing your request to the team…") and stays silent in that conversation. As soon as the team replies, the agent stops in that conversation too. - Notifications: while the agent answers, the team is not notified (no push, no email, the conversation is not unread). At the handoff, the conversation becomes unread and the usual notifications and follow-up email apply. - Quotas, per account and calendar month, all sites together: Free 0 (no agent), Creator 1,000 replies, Studio 5,000 (`agent_replies` in `GET /v1/plans`). One reply = one agent message; tests count. When the quota is reached, new questions go to the team and the owner gets one email. - Data: the text of the conversation's latest messages, the page address, the site's public content and the instructions are sent to Anthropic to generate the replies; Anthropic does not use them to train its models. Fields: - Message (API, dashboard, Action Cable): `{ id, sender: "visitor"|"team", bot, author_name, body, locale, attachments, blocks, reply_to_id, choice, created_at }`. Agent messages may carry `blocks` (always with a plain-text `body` too): `{ "type": "quick_replies", "options": [{ "id", "label" }] }` (up to 4 buttons), `{ "type": "products", "items": [{ "name", "price", "availability", "url", "image_url" }] }` (1 to 3 product cards with a "View" button) and `{ "type": "link", "label", "url" }`. A visitor who taps a quick reply sends `POST /v1/widget/conversation/messages` with `reply_to_id` (the agent's message) and `choice` (the option id); `body` may be omitted (the label is used). An agent message has `sender: "team"` (older clients show it on the team side), `bot: true` and `author_name: "Assistant"` (translated). Read a missing `bot` as `false`. - Conversation (team side, `GET /v1/conversations`, dashboard): `agent` (`"active"`: the agent is handling it, `unread` is false; `"handed_off"`; `null`: no agent on this site), `handed_off_at`, `handoff_reason` (`"visitor"`, `"agent"`, `"quota"`, `"error"`, `"team"`: the team replied). "To pick up": `handed_off_at` set and `unread` true. `last_message_sender` is `"team"` for an agent message. - Conversation (visitor side, bubble): `agent` (boolean, the agent is answering now) and `handed_off` (boolean). `GET /v1/widget/site?site_key=…` returns `site.agent` (boolean). - Action Cable (conversation thread): new event `{ "type": "handoff", "reason", "handed_off_at" }`; while the agent writes: `{ "type": "typing", "sender": "team", "author_name": "Assistant" }`. API (dashboard session, `/v1/accounts/:account_id/sites/:site_id/agent`; with an API key, `GET`/`PATCH /v1/sites/:id/agent` and `POST …/agent/refresh`, the same fields — MCP tools `get_ai_agent` and `update_ai_agent`; the test route is dashboard only): | Request | Meaning | |---|---| | `GET …/agent` | `{ "agent": { enabled, active, available, source_url, instructions, knowledge: { pages, products, tokens, refreshed_at, refreshing, error, preview }, quota: { used, limit, month } } }`. `available`: the plan allows the agent; `active`: enabled, allowed and with something to say; `preview`: the first 1,500 characters of the knowledge. Any member with access to the site can read it. | | `PATCH …/agent` | `{ "enabled"?, "source_url"?, "instructions"? }` → `{ agent }`. Owners and admins only (`403 manager_only`); `402 plan_required` to enable it on the Free plan; `422 { "error": "invalid", "errors": { "source_url": [...] } }`. A `source_url` without a scheme gets `https://`. Changing it re-reads the site: `knowledge.refreshing` is `true`; poll every ~3 s while it is (up to 2 minutes). | | `POST …/agent/refresh` | Re-read now → `202 { agent }`; `422 source_url_missing`; `429 rate_limited` (5 per 10 minutes). | | `POST …/agent/test` | `{ "messages": [{ "role": "user"\|"assistant", "content": "…" }], "locale": "en" }` → `{ "reply", "handoff", "handoff_reason" }`. Nothing is saved; counts in the quota. Owners and admins. `402 plan_required`, `429 agent_quota` or `rate_limited`, `503 agent_unavailable`. | Bubble: `POST /v1/widget/conversation/handoff` with `Authorization: Bearer `, from one of the site's addresses → `200 { "conversation": … }` (visitor payload); the agent posts its handoff message itself. ## 13. Accounts, team and plans The dashboard speaks the user's language. Its tabs, to guide them: | Language | Inbox | Stats | Sites | Team | Billing | API keys | Install block (in a site) | |---|---|---|---|---|---|---|---| | en | Messages | Stats | Sites | Team | Subscription | Developers | Install the bubble | | (channels tab: en Channels, fr Canaux, es Canales, pt Canais, it Canali, de Kanäle) | | | | | | | | | fr | Messages | Stats | Sites | Équipe | Abonnement | Développeurs | Installer la bulle | | es | Mensajes | Estadísticas | Sitios | Equipo | Suscripción | Desarrolladores | Instalar la burbuja | | pt | Mensagens | Estatísticas | Sites | Equipe | Assinatura | Desenvolvedores | Instalar o balão | | it | Messaggi | Statistiche | Siti | Team | Abbonamento | Sviluppatori | Installa la bolla | | de | Nachrichten | Statistiken | Websites | Team | Abo | Entwickler | Bubble installieren | On a phone, Team, Subscription and Developers are in the "Me" menu (bottom right). An account groups sites, their conversations, stats and team. A person can belong to several accounts and switch between them. | Role | Can | |---|---| | Owner | Everything, including billing and deleting the account. | | Admin | All sites: manage them, see the secret key and API keys, invite people. | | Member | Only the sites given to them: answer and see stats, without editing. | Invitations are single-use links valid 7 days (Team tab). | Plan | Sites | People | AI agent replies / month | Price | |---|---|---|---|---| | Free | 1 | 1 | — | €0 | | Creator | 10 | 1 | 1,000 | €9 / month or €90 / year | | Studio | 50 | 5 | 5,000 | €29 / month or €290 / year | Plans differ by the number of sites and people, and by the AI agent (paid plans only, section 12): every plan includes the bubble, stats, channels, several addresses per site and the API. `GET /v1/plans` (no auth) lists them with `sites`, `members`, `agent_replies` and `prices`. Subscribe on the web (card payment with Stripe, Dashboard → Subscription; a free trial the first time) or in the Hooky app (in-app purchase through the App Store or Google Play), at the same prices. An account has one active subscription, with one provider at a time. Subscriptions renew automatically and can be cancelled at any time; the plan stays active until the end of the paid period. ## 14. Data and privacy - The bubble sets no cookies. It keeps the visitor's conversation token in the site's `localStorage`, to find the conversation again on the next visit. - It lives in a Shadow DOM: the site's CSS does not affect it, and it does not affect the site. - Stats do not track people: they count the events you send, with no visitor identifier. - `Hooky.identify` and `Hooky.setAttributes` only send what the page gives them; that data stays with the conversation, visible to the site's team only. - Translation and the AI agent use Anthropic (Claude): for translation, only the message text; for the AI agent, the conversation's latest messages, the page address, the site's public content and the owner's instructions. Anthropic does not use them to train its models. - Hooky processes visitors' data on behalf of the site owner (GDPR processor). Privacy policy: https://heyhooky.com/en/privacy/ ; terms: https://heyhooky.com/en/terms/ ; help: https://heyhooky.com/en/help/ ; contact: support@heyhooky.com. ## 15. Coming soon - Nothing pending: the apps (iPhone, iPad, Mac and Apple Watch on the App Store, Android on Google Play) and the mobile SDKs are all available. ## 16. Mobile app SDKs (iOS, Android, Flutter) The same conversation as the web bubble, native in a mobile app (no WebView): the site's color, live replies, photos and PDFs, the device's language and dark mode. Same public site key as the web bubble (`data-site-key`); messages land in the same inbox. Version 1.1.0, MIT license. Distributed only from GitHub (public repositories `Defdjamel/hooky-ios`, `Defdjamel/hooky-android`, `Defdjamel/hooky-flutter`): no Maven Central, no pub.dev, no CocoaPods trunk. Human docs: https://heyhooky.com/en/docs/ios/, https://heyhooky.com/en/docs/android/, https://heyhooky.com/en/docs/flutter/ Apps have no address: requests carry `X-Hooky-Client: hooky-ios/1.1.0` (or `hooky-android/…`, `hooky-flutter/…`) and `X-Hooky-App: ()` instead of an Origin, so they get through even when the site has allowed addresses. Do not add anything to the site's addresses for an app. The team sees the conversation as coming from `iOS · com.example.app 2.3 (45)`. ### Install | Platform | Requirements | Install | |---|---|---| | iOS | iOS 15+ (and Mac Catalyst 15+), Xcode 16+, SwiftUI and UIKit, no third-party dependency | Swift Package Manager only: `https://github.com/Defdjamel/hooky-ios`, from `1.1.0`, product `Hooky` (privacy manifest included) | | Android | Android 6.0+ (`minSdk 23`), `compileSdk 36`, Compose and XML views, Kotlin or Java | Maven repository on GitHub Pages: add `maven("https://defdjamel.github.io/hooky-android")` to the repositories in `settings.gradle.kts`, then `implementation("com.heyhooky:hooky-android:1.1.0")`; its own dependencies come from `google()` and `mavenCentral()` | | Flutter | Flutter 3.35+ (Dart 3.9), Android 7.0+ (API 24), iOS 15+; Android and iOS only | git dependency in `pubspec.yaml` (below); the native iOS and Android SDKs are embedded, no other repository; iOS with Swift Package Manager or CocoaPods; set the iOS deployment target to 15.0 | Package.swift: `.package(url: "https://github.com/Defdjamel/hooky-ios", from: "1.1.0")` and `.product(name: "Hooky", package: "hooky-ios")`. Android, `settings.gradle.kts` then `app/build.gradle.kts`: ```kotlin dependencyResolutionManagement { repositories { google() mavenCentral() maven("https://defdjamel.github.io/hooky-android") } } dependencies { implementation("com.heyhooky:hooky-android:1.1.0") } ``` Flutter, `pubspec.yaml` (then `flutter pub get`): ```yaml dependencies: hooky_sdk: git: url: https://github.com/Defdjamel/hooky-flutter ref: 1.1.0 ``` ### Start (3 lines) ```swift // iOS import Hooky Hooky.configure(siteKey: "SITE_PUBLIC_KEY") // at launch (App.init or didFinishLaunching) ContentView().hookyBubble() // the floating bubble (SwiftUI) Hooky.open() // or from your own button ``` ```kotlin // Android Hooky.configure(context, "SITE_PUBLIC_KEY") // once, in Application.onCreate HookyBubble(Modifier.align(Alignment.BottomEnd).navigationBarsPadding().padding(20.dp)) // Compose Hooky.open(context) // or from your own button ``` ```dart // Flutter import 'package:hooky_sdk/hooky_sdk.dart'; Hooky.configure('SITE_PUBLIC_KEY'); // in main(), after WidgetsFlutterBinding.ensureInitialized() Scaffold(floatingActionButton: const HookyBubble()) Hooky.open(); ``` `configure` loads the site's name, color and greeting, resumes the conversation saved on the device and keeps a live connection while the app is in the foreground. All three take `translation` (on by default; `false` hides the translation of the team's messages) and an API URL for tests; iOS also takes `language:` (`fr`, `en`, `es`, `pt`, `it`, `de`) to force the interface language. ### Bubble, open, close - iOS SwiftUI: `.hookyBubble(alignment: .bottomLeading, padding: 24, hidden: isCheckout)`; `HookyBubble(size: 56)` alone; `HookyBubble { … }` with your own action; `HookyConversationView()` to present the conversation yourself. UIKit: `Hooky.showBubble(in: view)` (`leading: true` for the left side), `HookyBubbleView`, `Hooky.open(from: self)`. - Android: `@Composable HookyBubble(modifier, onClick = null)` (64 dp, shows once the site is loaded); XML: `` in an `AppCompatActivity` or `ComponentActivity`. `Hooky.open(context)` starts the SDK's `HookyActivity` (already declared). - Flutter: `HookyBubble({size, onPressed, style})`, `HookyBubbleStyle.cupertino` (60 pt) or `.material` (64 dp), default per platform. - `Hooky.close()` closes the conversation on all three. ### Unread count (team replies not seen yet; back to 0 when the conversation opens) - iOS: `Hooky.shared.unreadCount` (`@Published`, `@ObservedObject var hooky = Hooky.shared` then `.badge(hooky.unreadCount)`), `Hooky.unreadCountUpdates()` (`AsyncStream`), `Hooky.shared.onUnreadCountChange`. Also `siteName`, `isOpen`, `isConfigured`. - Android: `Hooky.unreadCount` (`StateFlow`, `collectAsState()` in Compose), `Hooky.addUnreadCountListener { n -> … }` (returns a `Closeable`, usable from Java). - Flutter: `Hooky.unreadCount` is both a `ValueListenable` and a `Stream`; `Hooky.state` gives `isConfigured`, `unreadCount`, `siteName`, `siteColor`, `sitePosition`. - Live only while the app is in the foreground (caught up when it comes back). Version 1.1.0 sends no push notifications to app users. ### Identify the user, free data, reset ```swift Hooky.identify(name: "Lila", email: "lila@example.com", userId: "u_1042", attributes: ["plan": "Pro", "cart": 49.9, "beta": true]) Hooky.setAttributes(["cart": 12]) // merged; nil removes a key; variables: .string(x), .number(x), .bool(x) Hooky.reset() // on sign-out ``` ```kotlin Hooky.identify(name = "Lou", email = "lou@example.com", userId = "u_1042", attributes = mapOf("plan" to "Pro")) Hooky.setAttributes(mapOf("cart" to 12, "beta" to null)) Hooky.reset() ``` ```dart Hooky.identify(name: 'Lila', email: 'lila@example.com', userId: 'u_1042', attributes: {'plan': 'Pro'}); Hooky.setAttributes({'cart': 49.9, 'coupon': null}); Hooky.reset(); ``` Same behavior and rules as the web (section 7): with an email, the chat skips its name/email form; data is kept until the first message, then sent right away, grouped within a second, retried when offline; a different `userId` forgets the previous conversation (another account on the same device never sees it); `reset()` forgets conversation, identity and data. Free data: flat, max 50 keys, 8 KB, keys 1-64 characters (letters, digits, spaces, `_ . -`), values strings (≤ 500 characters), numbers or booleans. It is declarative (the site key is public): never put secrets in it, never use it to grant access. On iOS, call `configure` before `identify`/`setAttributes` (otherwise ignored, with a Debug assertion); on Android and Flutter they wait for `configure`. ### Stats ```swift Hooky.track("purchase", value: 49.9, properties: ["plan": "pro"]) // iOS: any thread, even before configure (queued, max 100) ``` ```kotlin Hooky.track("purchase", 49.9, mapOf("plan" to "pro")) // Android: ignored before configure ``` ```dart Hooky.track('purchase', value: 49.9, properties: {'plan': 'pro'}); // Flutter: queued before configure (max 100) ``` Same rules as section 8 (name, `value` summed, max 20 flat properties). Never throws; an event sent offline is lost. No personal data in events. ### The conversation First message with optional first name and email (or `identify`), then a thread like the web bubble: team names, "typing…", "Read", links, big emoji, older messages on demand. Up to 4 attachments per message, 10 MB each: photos (JPEG, PNG, HEIC, WebP, GIF) or PDFs. iOS: system photo picker (no permission), Files, camera only if the app's Info.plist has `NSCameraUsageDescription`. Android: system photo picker, the camera app, Files; the SDK adds only the `INTERNET` permission, `HookyActivity`, a `FileProvider` (`.hooky.fichiers`) and ``. The draft survives closing the conversation and the app. Errors in plain words (offline, file too large, too many files, rate limited). Message translation (section 12): under a team message written in another language than the chat's, a "Translate" link (then "Translated from English · See original"); by default those messages arrive already translated, and the header's translate button turns translation off or back on in one tap (remembered on the device per site key); a failed translation shows "Try again". The user's own messages are not translated on their side. On by default; turn it off with `translation: false` in `configure` (iOS, Flutter) or `translation = false` (Android). A translation request sends only the message id and the chat's language. AI agent (when the site's agent is on, paid plans; section on the AI agent): the native conversation shows it like the web bubble, nothing to code: the AI notice above the input until it replies, an "AI assistant" label on its messages, then "Talk to a human" (`POST /v1/widget/conversation/handoff`; the email is asked for at the handover if unknown), up to 3 stacked product cards, a link button and up to 4 quick replies (last message only, sent as `{ reply_to_id, choice }`), an `agent_product_click` stats event when a card is opened, live replies revealed word by word (the thread follows only if at the bottom; at once with Reduce Motion / Remove animations or VoiceOver / TalkBack, read whole). Unknown blocks are ignored, the text always shows. Since SDK 1.1.0. ### Data sent and stored (for App Store privacy labels and Google Play Data safety) - Sent: the messages and files, the optional name and email, your `userId` and free data, the language and time zone, the device (`iPhone 15 Pro · iOS 18.2`, `Samsung SM-S918B · Android 15`), the app id and version; on Android the page is `android-app://`. `track` events carry no person identifier. No advertising identifier, no tracking, no third-party SDK; HTTPS and secure WebSocket. - App Store: Contact Info (Name, Email Address), User Content (Customer Support, Photos or Videos), Identifiers (User ID) if you pass `userId`, Usage Data (Product Interaction, not linked to the user) if you use `track`; purposes App Functionality and Analytics; no tracking (no App Tracking Transparency prompt). - Google Play: Messages (Other in-app messages), Photos and videos, Files and docs, Personal info (Name, Email address, User IDs), App activity (Other actions) for `track`; encrypted in transit; Hooky processes the data on the developer's behalf (not "sharing"). - Stored on the device: the conversation token and `userId` (iOS Keychain, this device only; Android private file under `noBackupFilesDir`, never backed up), the draft. ### Interface languages, dark mode, accessibility English, French, Spanish, Portuguese, Italian and German: the device language, English otherwise (iOS: `configure(siteKey:language:)` can force one). Follows the device's light or dark mode. VoiceOver and Dynamic Type on iOS; TalkBack and font scaling on Android; the Flutter bubble is a labeled button for screen readers. ### R8 / ProGuard Nothing to add: no reflection, consumer rules shipped. ### Troubleshooting - Site with allowed addresses: apps are accepted anyway (they send `X-Hooky-Client`). - Nothing loads: use the site's public key, not the secret key (`hks_…`) or an API key (`hka_…`). On iOS the Xcode console logs `Hooky: the site couldn't be loaded (HTTP 404…)`. On Android the bubble stays hidden until the site loads (retried when the app returns to the foreground). - Flutter "the Hooky plugin is not available on this platform": fully restart the app after adding the package (hot reload is not enough); web and desktop are not supported. - Flutter iOS build fails: set the deployment target to iOS 15.0 (Swift Package Manager and CocoaPods refuse a lower one); after changing the package's `ref`, run `flutter clean` then `flutter pub get`. - Another user sees the previous conversation: call `reset()` on sign-out and pass a `userId` to `identify`. ### Changelog - 1.1.0: the site's AI agent in the native conversation (AI notice, "AI assistant" label, "Talk to a human" with the email asked for at the handover, stacked product cards, link button, quick replies on the last message only sent as `{ reply_to_id, choice }`, `agent_product_click` stats event, replies revealed word by word unless Reduce Motion / Remove animations or a screen reader is on; unknown blocks ignored). - 1.0.1: automatic translation by default (the team's messages in another language arrive translated; a header button turns it off or back on, no more menu). - 1.0.0: first version (iOS, Android and Flutter): `configure`, the bubble, `open`, `close`, `identify` (with `userId` and free data), `setAttributes`, `track`, `reset`, the live unread count, photos and PDFs, message translation, six languages, dark mode, accessibility.