> For the complete documentation index, see [llms.txt](https://docs.wonderchat.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wonderchat.io/setup-guides/adding-your-chatbot-to-your-website/set-up-with-an-ai-agent.md). Agents can also search and read this documentation through its [MCP server](https://docs.wonderchat.io/~gitbook/mcp).

# Set Up with an AI Agent

Let a coding agent such as Claude Code, Cursor or Codex create, train and install your Wonderchat chatbot from one prompt.

If you build your site with a coding agent such as Claude Code, Cursor, Codex or Windsurf, it can set up Wonderchat for you: create the chatbot, train it on your website, and add the chat widget to your code. You don't need an account first.

## Paste this prompt into your agent

Open your agent in your website's project and paste:

```
Set up Wonderchat on my site by following https://app.wonderchat.io/llms.txt
```

Add your website's address if the agent can't tell it from the code, for example `My site is https://acme.com`.

The agent then:

1. Builds a chatbot trained on your website. This takes a minute or two.
2. Adds the chat widget to your site's shared layout, so it shows on every page.
3. Gives you two links: one to **try the chatbot**, and one to **keep it**.

Open the second link within 24 hours and sign up (Google works) to keep the chatbot. It moves into your new account with the same widget code, so nothing in your site changes. The link to keep it stops working after 24 hours.

## Let the agent manage your account

If you already have an account, or want the agent to also set the chatbot's name, colours and instructions, tell it so: "Set up Wonderchat on my site by following <https://app.wonderchat.io/llms.txt>. I have an account, use full control."

The agent shows you a link and a short code. Open the link, sign in, check the code matches, and click **Allow**. The agent can then create and configure chatbots on your account for the next hour. This works on every plan, including Free.

For ongoing use, such as tuning your chatbot or working your inbox from your AI tool, connect Wonderchat as an MCP server instead. See [Set-up MCP Connector](https://docs.wonderchat.io/setup-guides/using-chatbot-tools/set-up-mcp-connector.md).

***

## For AI agents

The full guide, with every request and response, is at <https://app.wonderchat.io/llms.txt>. Summary:

**Build a chatbot with no account:**

```bash
curl -s -X POST https://app.wonderchat.io/api/agent/build \
  -H 'Content-Type: application/json' -d '{"url":"https://acme.com"}'
```

Keep `agent_id` and `claim_token`, then poll every 15 seconds until `state` is `ready`:

```bash
curl -s -X POST https://app.wonderchat.io/api/agent/build-status \
  -H 'Content-Type: application/json' \
  -d '{"agent_id":"<agent_id>","claim_token":"<claim_token>"}'
```

The ready response has `embed_html`, `preview_url` (for the user to try the bot) and `claim_url` (for the user to keep it).

**The widget snippet** looks like this. Add it once, just before `</body>`, so it loads on every page:

```html
<script>
(function () {
  window.wonderchatSettings = {
    id: "<agent_id>",
    address: "app.wonderchat.io",
    widgetSize: "normal",
    widgetButtonSize: "normal"
  };
  var s = document.createElement("script");
  s.src = "https://app.wonderchat.io/scripts/wonderchat-seo.js";
  s.defer = true;
  document.body.appendChild(s);
})();
</script>
```

Where to put it:

* **Plain HTML**: the shared layout or footer include.
* **Next.js App Router**: `app/layout.tsx`, as a `next/script` with `strategy="afterInteractive"` and the snippet's JavaScript as its children.
* **Next.js Pages Router**: `pages/_document.tsx` or `pages/_app.tsx`.
* **React, Vite, Vue**: `index.html`.
* **Nuxt**: `app.vue` head or `nuxt.config` scripts.
* **WordPress, Shopify, Webflow, Wix, Framer**: the theme's footer custom-code area. See the guides in this section.

The widget's look and behaviour come from the chatbot's settings, so the snippet never changes after a settings update or after the user claims the chatbot.
