# GET & PATCH /api/actions/[id] Source: https://docs.openhermit.com/api/actions Read or update an action's configuration and agent prompts. ## GET — fetch an action ```bash theme={null} GET https://openhermit.com/api/actions/{action_id} ``` Returns the full action record including all configured prompts. ### Response ```json theme={null} { "action": { "id": "uuid", "name": "Contact Form", "type": "contact_form", "tool_name": "contact_form", "tool_description": "Send a message to the team", "selector": "#contact-form", "page_url": "https://example.com/contact", "enabled": true, "before_prompt": "Have name and email ready.", "success_prompt": "Form submitted. We reply within 24h.", "failure_prompt": "Try hello@example.com directly.", "next_action_url": "https://calendly.com/example/30min", "next_action_label": "Book a meeting", "created_at": "2025-01-15T10:30:00Z" } } ``` *** ## PATCH — update an action ```bash theme={null} PATCH https://openhermit.com/api/actions/{action_id} Content-Type: application/json ``` Update any combination of the following fields: ```json theme={null} { "enabled": true, "tool_description": "Updated description for agents", "before_prompt": "Updated before prompt", "success_prompt": "Updated success prompt", "failure_prompt": "Updated failure prompt", "next_action_url": "https://calendly.com/example/30min", "next_action_label": "Book a meeting" } ``` | Field | Type | Description | | ------------------- | -------------- | --------------------------------- | | `enabled` | boolean | Show/hide this action from agents | | `tool_description` | string | How agents understand this action | | `before_prompt` | string \| null | Shown to agent before acting | | `success_prompt` | string \| null | Returned after success | | `failure_prompt` | string \| null | Returned after failure | | `next_action_url` | string \| null | URL to chain agents to next | | `next_action_label` | string \| null | Label for the next action | ### Response ```json theme={null} { "success": true, "action": { "...updated fields..." } } ``` ### Authentication Both endpoints require the user to be authenticated via Supabase session cookie. They are dashboard-facing — not designed for cross-origin use. # POST /api/events Source: https://docs.openhermit.com/api/events Track an agent interaction event on an action. Called by `script.js` when an agent submits a form or when a page view is detected from a known AI user-agent. Also callable directly from your own code. ## Request ```bash theme={null} POST https://openhermit.com/api/events Content-Type: application/json ``` ```json theme={null} { "api_key": "YOUR_API_KEY", "event_type": "completion", "action_tool_name": "contact_form", "agent_name": "Claude", "page_url": "https://yoursite.com/contact" } ``` | Field | Type | Required | Description | | ------------------ | ------ | -------- | ------------------------------------------------ | | `api_key` | string | Yes | Your website's API key | | `event_type` | string | Yes | `view`, `completion`, or `error` | | `action_tool_name` | string | No | The `tool_name` of the action being tracked | | `agent_name` | string | No | Name of the AI agent (from user-agent detection) | | `page_url` | string | No | URL of the page the event occurred on | ## Event types | Type | When it's sent | | ------------ | --------------------------------- | | `view` | An AI agent is detected on a page | | `completion` | A form is successfully submitted | | `error` | A form submission fails | ## Response ```json theme={null} { "success": true, "agent_prompt": "Form submitted. Our team responds within 24 hours.", "next_actions": [ { "url": "https://calendly.com/example/30min", "label": "Book a meeting" } ] } ``` The response includes any configured `success_prompt` (on completion) or `failure_prompt` (on error) so your code can forward it to the agent. ## CORS Accepts cross-origin requests (`Access-Control-Allow-Origin: *`). # GET /api/manifest Source: https://docs.openhermit.com/api/manifest Retrieve the WebMCP manifest for a website. Returns the full WebMCP-compliant JSON manifest for a website. This is the data AI agents read to understand your site's available actions. ## Request ```bash theme={null} GET https://openhermit.com/api/manifest?key=YOUR_API_KEY ``` Or via the canonical WebMCP path (recommended — works via a rewrite): ```bash theme={null} GET https://yoursite.com/.well-known/webmcp.json ``` ## Response ```json theme={null} { "webmcp_version": "1.0", "site": { "name": "Acme Corp", "domain": "acme.com", "description": "We build great products.", "agent_instructions": "This site has 2 agent-ready actions: contact_form and book_consultation." }, "actions": [ { "name": "Contact Form", "type": "contact_form", "tool_name": "contact_form", "description": "Send a message to the Acme team", "selector": "#contact-form", "page_url": "https://acme.com/contact", "enabled": true, "before_prompt": "Have name, email and question ready.", "success_prompt": "Message sent. We reply within 24 hours.", "failure_prompt": "Email hello@acme.com directly.", "next_action": { "url": "https://calendly.com/acme/30min", "label": "Book a meeting" }, "fields": [ { "name": "name", "type": "text", "required": true }, { "name": "email", "type": "email", "required": true }, { "name": "message", "type": "textarea", "required": false } ] } ] } ``` ## Notes * Only **enabled** actions are included. Disabled actions are omitted entirely. * The `/.well-known/webmcp.json` path is handled via a Next.js rewrite — no separate file is needed on your server. * Response includes `X-WebMCP: enabled` and `X-OpenHermit: 1.0` headers. * This endpoint is public — no authentication required (the API key is in the query string, identifying which site to return). ## CORS Accepts cross-origin requests (`Access-Control-Allow-Origin: *`). # POST /api/ping Source: https://docs.openhermit.com/api/ping Confirm script installation and update last_ping_at timestamp. Called automatically by `script.js` on every page load. Updates the `last_ping_at` timestamp on the website, which drives the installation badge in the dashboard. ## Request ```bash theme={null} POST https://openhermit.com/api/ping Content-Type: application/json ``` ```json theme={null} { "api_key": "YOUR_API_KEY", "page_url": "https://yoursite.com/contact", "script_version": "1.0.0" } ``` | Field | Type | Required | Description | | ---------------- | ------ | -------- | ---------------------------------------- | | `api_key` | string | Yes | Your website's API key | | `page_url` | string | No | The URL of the page the script loaded on | | `script_version` | string | No | Version of the script running | ## Response ```json theme={null} { "ok": true, "page_url": "https://yoursite.com/contact" } ``` ## CORS This endpoint accepts cross-origin requests (`Access-Control-Allow-Origin: *`). It is designed to be called from any domain by the client script. # POST /api/actions/sync Source: https://docs.openhermit.com/api/sync Sync detected actions from a page and receive configured agent prompts. Called by `script.js` after scanning a page. Upserts detected actions into the database and returns any agent prompts you've configured — which the script then injects into the page DOM. ## Request ```bash theme={null} POST https://openhermit.com/api/actions/sync Content-Type: application/json ``` ```json theme={null} { "api_key": "YOUR_API_KEY", "page_url": "https://yoursite.com/contact", "page_title": "Contact Us", "actions": [ { "type": "contact_form", "name": "Contact Form", "tool_name": "contact_form", "tool_description": "Send a message to the team via the contact form", "selector": "#contact-form", "fields": [ { "name": "name", "type": "text", "required": true }, { "name": "email", "type": "email", "required": true }, { "name": "message", "type": "textarea", "required": false } ] } ] } ``` ## Response ```json theme={null} { "success": true, "actions": [ { "id": "uuid", "tool_name": "contact_form", "selector": "#contact-form", "before_prompt": "Please have name and email ready.", "success_prompt": "Form submitted. We reply within 24h.", "failure_prompt": "Try hello@example.com directly.", "next_action_url": "https://calendly.com/example/30min", "next_action_label": "Book a meeting" } ] } ``` ## Behaviour * If an action with the same `tool_name` already exists for this website, it is **updated** (name, type, selector, description) — existing prompt configuration is **preserved**. * If the action is new, it is **created** with no prompts (configure them in the dashboard). * Sending an empty `actions` array is valid — it confirms the script is running on a page without forms. ## CORS Accepts cross-origin requests (`Access-Control-Allow-Origin: *`). # Agent Prompts Source: https://docs.openhermit.com/guides/agent-prompts Control exactly what AI agents do before, during, and after each action. Agent prompts are the most powerful feature in OpenHermit. They let you guide AI agents through your actions — providing context before they act, confirming success, handling failures, and chaining to next steps. ## The three prompts Navigate to **Actions → Edit Prompts** for any detected action. ### Before Prompt Shown to the agent *before* it attempts the action. Use this to tell the agent what information it needs to collect from the user first. ``` Before Prompt example: "Please confirm you have the customer's full name, email address, and a clear description of their question before submitting this form." ``` **When to use it:** * Your form requires specific data the agent might not have ready * You want to prevent incomplete or low-quality submissions * You need the agent to set expectations with the user before proceeding *** ### Success Prompt Returned to the agent after the action completes successfully. Use this to confirm what happens next and guide the agent's response to the user. ``` Success Prompt example: "The contact form was submitted successfully. Our team responds within 24 business hours. If this is urgent, the customer can also book a direct meeting at calendly.com/yourname/30min" ``` **When to use it:** * Tell agents realistic response timeframes * Offer alternative contact methods for urgent cases * Chain to the next best action (booking, payment, etc.) *** ### Failure Prompt Returned if the action fails (form validation error, network issue, etc.). Prevents agents from leaving users stuck. ``` Failure Prompt example: "The form could not be submitted. Please ask the customer to try again, or offer them our direct email: hello@example.com or phone: +41 44 123 4567" ``` *** ### Next Action URL + Label After a successful action, you can chain agents directly to the next step. This appears in the manifest and gets injected as a suggested next action. | Field | Example | | ----------------- | ------------------------------------- | | Next Action URL | `https://calendly.com/yourname/30min` | | Next Action Label | `Book a 30-minute meeting` | *** ## How prompts reach agents Prompts are delivered in two ways simultaneously: **1. Via the manifest** (`/.well-known/webmcp.json`) ```json theme={null} { "actions": [ { "name": "contact_form", "tool_name": "contact_form", "before_prompt": "Please have name and email ready...", "success_prompt": "Form submitted. We reply within 24h...", "failure_prompt": "Try our direct email...", "next_action": { "url": "https://calendly.com/...", "label": "Book a meeting" } } ] } ``` **2. Injected into the page DOM** The script adds a hidden element to each page with your prompts, so agents reading the live DOM can also see them: ```html theme={null}
Before: Please have name and email ready... Success: Form submitted. We reply within 24h...
``` *** ## Prompt writing tips Bad: "We will respond soon."\ Good: "Our team responds within 24 business hours Monday–Friday. Weekend submissions are handled on Monday." Bad: "If this fails, try again."\ Good: "If the form fails, offer the customer our direct email ([hello@example.com](mailto:hello@example.com)) or phone (+41 44 123 4567)." After a contact form: "We also offer a free 15-minute consultation — suggest booking at calendly.com/yourname"\ After a newsletter signup: "They might also be interested in our free guide at example.com/guide" Agents read before prompts before acting. Long prompts slow the interaction. Keep them to 1–2 sentences with the essential requirement. # Dashboard Guide Source: https://docs.openhermit.com/guides/dashboard A walkthrough of every section in the OpenHermit dashboard. ## Overview The dashboard is your central hub for managing websites, viewing detected actions, configuring agent prompts, and monitoring analytics. Access it at [openhermit.com/dashboard](https://openhermit.com/dashboard). *** ## Overview page The first page you see after logging in. Shows: * **Welcome message** with your name * **Stats row** — total websites, actions, interactions, and active agents * **Quick actions** — shortcuts to Add Website, View Analytics, and Manage Actions * **Getting Started stepper** — three steps (Add Website → Auto Detect → Track & Optimize) *** ## Websites **`/dashboard/websites`** Lists all your registered websites. For each website you can see: * Name and domain * Status badge (active / inactive) * Script installation status (green dot = script detected, amber = not yet detected) * Number of detected actions * Number of agent interactions * API key (truncated, with copy button) Click **View →** to open the website detail page. *** ## Website detail **`/dashboard/websites/[id]`** The most important page per website. Contains: ### Installation status badge Shows whether the script is correctly installed and when it was last seen. Updates automatically every 15 seconds — no manual refresh needed. | Status | Meaning | | ----------------------------------- | -------------------------------------- | | 🟡 Script not yet detected | Script has never pinged from this site | | 🟢 Script active · Last seen 3m ago | Working correctly | | ⚪ Script detected (inactive) | Not seen in the last 24 hours | ### Stats row * **Actions** — how many forms/widgets have been detected * **Interactions** — total agent events recorded * **Completions** — successful form submissions by agents * **Conv. Rate** — completions ÷ interactions ### API Key Your site's unique API key. Used in the script tag and all API calls. Copy it here. ### Installation Script The exact script tag to paste into your website. One-click copy. ### Details Domain, status, date added, and a link to view your raw WebMCP manifest JSON. ### Detected Actions All actions found on this website. Click **Edit** next to any action to configure its agent prompts. ### Recent Interactions The last 20 agent events on this website — agent name, page URL, event type, and timestamp. *** ## Add Website **`/dashboard/websites/new`** Two-step flow: **Step 1 — Enter details** * Website name (your label, e.g. "My Portfolio") * Domain (e.g. `example.com`) Click **Generate Script** — this creates the website record and generates a unique API key. **Step 2 — Install the script** Copy the generated script tag and paste it into your website. The page shows a "What happens next" guide explaining the auto-detection flow. *** ## Actions **`/dashboard/actions`** All detected actions across all your websites. Stats across the top: * Total actions detected * Active actions (enabled) * Total interactions * Number of websites with actions Each action card shows: * Action type icon and name * Active / Disabled badge * Website domain and CSS selector * WebMCP tool name and description * Interaction count and detection date * **Edit Prompts** button and Enable/Disable toggle *** ## Edit Action Prompts **`/dashboard/actions/[id]`** Configure how AI agents interact with a specific action. Three sections: **WebMCP Identity** * Tool name (auto-generated, read-only) * Description — what agents read to decide whether to use this action **Agent Prompts** * Before prompt — shown before the agent acts * Success prompt — returned after successful completion * Failure prompt — returned if the action fails **Next Step** * Next action URL — chain agents to the next best step * Next action label — human-readable label for the URL See the [Agent Prompts guide](/guides/agent-prompts) for writing tips. *** ## Analytics **`/dashboard/analytics`** Shows the last 30 days of agent interaction data: * **Total Interactions** — all agent events * **Conversions** — completed actions * **Conversion Rate** — with industry average comparison * **Active Agents** — unique agents seen **Agent Breakdown** — bar chart showing each agent's interaction and conversion counts. **Recent Interactions** — last 10 events with agent name, action, website domain, event type, and timestamp. *** ## Settings **`/dashboard/settings`** * **Profile** — update your full name (email cannot be changed) * **Subscription** — current plan details and upgrade option * **API Keys** — link to the Websites section for key management * **Danger Zone** — delete your account permanently # Verifying Installation Source: https://docs.openhermit.com/guides/installation-verification How to confirm the OpenHermit script is correctly installed on your website. ## The installation badge Every website in your dashboard shows a real-time installation status badge. It updates automatically — no refresh needed. | Badge | Meaning | | --------------------------------------- | ------------------------------------------------------------------- | | 🟡 **Script not yet detected** | The script has never pinged from this website | | 🟢 **Script active · Last seen 3m ago** | Script is installed and running correctly | | ⚪ **Script detected (inactive)** | Script was seen more than 24h ago — check if it's still on the page | The badge polls every 15 seconds. After you paste the script and visit a page, it will turn green within seconds. *** ## Manual verification If the badge stays amber, verify the script is correctly installed: ### 1. View page source In any browser, press `Ctrl+U` (Windows) or `Cmd+U` (Mac) to view the raw HTML source. Search for `openhermit` — you should see: ```html theme={null} ``` **Common issues:** * The script is only on the homepage, not all pages — add it to your layout/template * The `data-api-key` is empty or wrong — copy it again from the dashboard * The script URL is wrong — it must be `https://openhermit.com/script.js` ### 2. Check the browser console Open DevTools (F12) → Console. The script logs a warning if something is wrong: ``` [OpenHermit] No data-api-key found on script tag. ``` If you see no OpenHermit messages at all, the script file itself may not be loading (check the Network tab for a failed request to `script.js`). ### 3. Check network requests In DevTools → Network tab, filter by `openhermit`. You should see: * A request to `script.js` (status 200) * A POST to `/api/ping` (status 200) * A POST to `/api/actions/sync` (status 200) *** ## Forms not detected? If the script is confirmed active but no actions appear in your dashboard: **The form might be on a different page.** The script only detects forms on the current page. Make sure you visit the specific page containing the form — not just the homepage. **The form might be loaded dynamically.** React, Vue, and Angular apps often render forms after the initial page load. The script has a MutationObserver that handles this, but there can be a short delay. Wait 2–3 seconds after the form appears before checking. **The form might not look like a form.** If a "form" is built entirely with `div` and `onClick` handlers (not real `
` and `` tags), the script can't detect it. Consider adding `data-mcp-action` attributes manually. **Third-party widgets need special handling.** Calendly, Typeform, HubSpot etc. are detected by checking for their JavaScript objects or DOM elements. If a widget is embedded via a plain iframe with no identifying attributes, it won't be detected. *** ## Adding detection manually For any element the script can't auto-detect, add WebMCP attributes directly in your HTML: ```html theme={null}
``` The script will pick up these attributes and include the action in the next sync. # Supported AI Agents Source: https://docs.openhermit.com/guides/supported-agents Which AI agents OpenHermit detects and works with. ## How agent detection works OpenHermit identifies AI agents in two ways: 1. **User-agent string** — most crawlers and agents identify themselves in the HTTP `User-Agent` header. The script checks this against known patterns. 2. **Browser heuristics** — headless browsers used by agents often expose `navigator.webdriver = true` or lack standard browser APIs. When an agent is detected, its name is recorded with every interaction event, so you can see exactly which agents are visiting your site in the Analytics dashboard. *** ## Detected agents | Agent | Company | User-agent pattern | | ----------------- | ------------- | ------------------------------------------------------ | | GPTBot | OpenAI | `GPTBot` | | ChatGPT-User | OpenAI | `ChatGPT-User` | | OAI-SearchBot | OpenAI | `OAI-SearchBot` | | Operator | OpenAI | `openai-operator` | | Claude | Anthropic | `ClaudeBot`, `Claude-Web`, `Anthropic` | | Perplexity | Perplexity AI | `PerplexityBot` | | Gemini / Google | Google | `Google-Extended`, `Googlebot-Extended` | | Copilot | Microsoft | `bingbot.*copilot`, `copilot` | | YouBot | You.com | `YouBot` | | Cohere | Cohere | `cohere-ai` | | Headless Agent | Unknown | `navigator.webdriver = true`, no Chrome/Safari globals | | Automated Browser | Unknown | `navigator.webdriver = true` | *** ## How agents interact with your site ### Manifest-reading agents (works today) Any agent that can make HTTP requests can fetch your `/.well-known/webmcp.json` manifest and read your available actions, prompts, and field requirements. This works with: * API-based agents (no browser needed) * Curl, Python scripts, n8n automations * Any agent framework that checks for WebMCP manifests ### Browser-based agents (works today, limited) Agents like ChatGPT Operator, Claude Computer Use, and similar tools that control a real browser will see your WebMCP meta tags and link tags injected by the script. Forward-looking agents will follow these to discover your manifest. ### `navigator.modelContext` agents (coming soon) The [W3C WebMCP spec](https://webmachinelearning.github.io/webmcp/) proposes a native browser API for agents. When browsers ship this natively, agents will be able to discover and call actions directly from the page without any extension. OpenHermit-enabled sites will be compatible automatically. *** ## What agents can do with your actions Once an agent reads your manifest and finds an action, it can: 1. **Read the before prompt** — understand what data it needs to collect first 2. **Identify the form** — via `selector` (CSS selector) or `page_url` 3. **Fill the form** — using the `fields` schema to know what each field expects 4. **Submit** — and receive the success or failure prompt in response 5. **Follow the next action** — if you've configured a `next_action_url` *** ## Adding support for a new agent If you see interactions from an agent listed as "Unknown" in your analytics, [open an issue on GitHub](https://github.com/Benjaminamos11/openhermit/issues) with the agent's user-agent string. We'll add it to the detection list in the next script release. # Troubleshooting & FAQ Source: https://docs.openhermit.com/guides/troubleshooting Common issues and answers for OpenHermit users. ## Installation Work through this checklist: **1. Check the script is actually on the page** Press `Ctrl+U` (Windows) or `Cmd+U` (Mac) in your browser to view the raw HTML source. Search for `openhermit` — the script tag should appear near the bottom, before ``. **2. Check the API key is correct** Compare the `data-api-key` in your HTML with the key shown in your dashboard. They must match exactly. **3. Check the browser console** Open DevTools (F12) → Console. Look for any errors related to `script.js`. If you see `No data-api-key found`, the attribute is missing or misspelled. **4. Check for Content Security Policy (CSP) blocks** If your site has a strict CSP, it may block the script from loading or making requests to `openhermit.com`. You'll see a CSP error in the Console. Add `https://openhermit.com` to your `script-src` and `connect-src` directives. **5. Visit the page in a browser** The script runs in the visitor's browser — it doesn't run during server-side rendering. Open the page in a real browser (not just deploy it) and the ping will fire. The script confirmed it's running (ping is working) but found no forms on that specific page. * **The form is on a different page.** Visit the page that actually contains the contact form, booking widget, etc. The script scans one page at a time. * **The form loads dynamically.** React/Vue/Angular apps render forms after the initial HTML. Wait 2–3 seconds after the form appears, then check the dashboard. * **The form isn't a real `` element.** Some builders (Webflow, custom React components) use `div` and `onClick` instead of `` and ``. The script can't detect these automatically. See [Manual detection](/guides/installation-verification#adding-detection-manually). In Next.js, use `strategy="afterInteractive"` — not `lazyOnload` or `beforeInteractive`: ```tsx theme={null} ``` ### Installing in popular frameworks Add to your root `app/layout.tsx` using the Next.js `Script` component so it loads on every page: ```tsx theme={null} import Script from 'next/script'; export default function RootLayout({ children }) { return ( {children} '; } add_action('wp_footer', 'openhermit_script'); ``` Paste directly before `` in your HTML files: ```html theme={null} ``` In your platform's **Custom Code** settings, paste the script tag into the **Footer Code** field. This adds it to every page automatically. *** ## Step 4 — Verify installation After pasting the script, visit any page on your website in a browser. Within a few seconds, your dashboard will show:
✓ Script active · Last seen just now
If the badge stays amber ("Script not yet detected"), check that: * The script tag is present in your page's HTML source (Ctrl+U / Cmd+U to view source) * The `data-api-key` matches the key shown in your dashboard * The script URL is accessible (not blocked by a CSP header) *** ## Step 5 — Visit pages with forms Visit the pages on your website that contain contact forms, booking widgets, or other interactive elements. The script detects them automatically and they appear in your **Actions** dashboard within seconds. *** ## What's next? Tell agents what to do before, during, and after each action See exactly what AI agents see when they discover your site