# How to add an AI chat to your website

> Put an AI agent in a chat bubble on your site with one line of code. It answers visitors from your own content and hands conversations to your team when needed.

An AI chat on your website is a bubble in the corner of every page. Visitors write, and an agent answers from what you taught it. When a visitor needs a person, someone on your team picks the conversation up in an inbox and replies in the same bubble.

With Ñomongeta the chat is one `<script>` tag pasted into your site. No plugin is needed.

## 1. Have an agent ready

If you don't have one yet, open **Agents**, press **New agent** and choose **Template**. Then give it your FAQ or policies in **Knowledge** and press **Save changes**. The [WhatsApp guide](https://www.zenhalab.com/www/zenhalab/en/guides/ai-agents/whatsapp-ai-agent#2-teach-it-your-business) walks through teaching it.

## 2. Turn the chat on and copy the code

1. Open the agent and go to its **Channels** tab.
2. Under **Embed on your site**, switch on **Allow the public chat widget**.
3. Press **Copy embed code**. To see the bubble before it's on your site, press **Preview the widget**.

> [!IMPORTANT]
> The chat is public: anyone on your site can write to the agent. Set its **Token budget** and **Messages per minute** in **Configure** before you go live.

## 3. Paste it into your site

Paste the code into every page that should show the chat, just before the closing `</body>` tag. Site builders usually have a field for it called "custom code", "footer code" or "scripts"; set it once there and every page gets the bubble.

The chat speaks the language set in the code: `en`, `pt` or `es`. Remove that attribute and it follows your page's own language instead.

## 4. Answer visitors yourself when needed

Conversations from the chat land in the inbox with those from your other channels. To answer one yourself, open it and press **Take over**: the agent stays quiet and your replies appear in the visitor's bubble. Use **Assigned to** to give it to a teammate. When you're done, **Return to bot** lets the agent carry on, or **Close** ends the conversation.

To have the agent hand over by itself, turn on its handoff tool in **Skills & tools**. Switch on **Hand off to a person when the AI fails** too, so a visitor still reaches a person if the AI can't reply.

## Turn it off

Switch **Allow the public chat widget** off and the agent stops answering on your site, even where the code is still pasted. Past conversations are kept.

## Related

- [Answer WhatsApp customers with an AI agent](https://www.zenhalab.com/www/zenhalab/en/guides/ai-agents/whatsapp-ai-agent)
- [Website chat in the Ñomongeta docs](https://www.zenhalab.com/www/nomongeta/en/docs/channels/website-widget)
- [Ñomongeta for customer support](https://www.zenhalab.com/www/nomongeta/en/use-cases/support)
