A chat agent is a separate agent from your phone agent, but it can read the same knowledge. Knowledge bases belong to the organisation, not to one agent, so a single source of truth about your hours, pricing or policies can be attached to a voice agent and a chat agent at the same time. Write it once, answer on both channels, and there is no second document to keep in step.
The build is short. The part worth reading carefully is the security model at the end, because a public widget is public in ways that surprise people.
Step 1: Create the agent and choose Chat Agent
Go to Agent, then New Agent. The first thing you see is a dialog titled Choose Agent Type, with the note "Select the type of agent you want to create. This cannot be changed later."
Two cards: Voice Agent ("Live call AI agent with voice capabilities") and Chat Agent ("Web widget chat agent for your website"). Pick Chat Agent.
Take the warning literally. The type is fixed at creation, so you cannot promote a chat agent to a voice agent later or the other way round. If you want both channels, you build two agents. That is less duplication than it sounds, because the expensive part, the knowledge, is shared.
Fill in the same core fields you would for a voice agent: a name, Agent Identity, Agent Personality and Agent Task. The voice specific fields, Language and accent and Pronunciation, do not apply to a chat agent. Keep all of it inside the combined instruction budget, which warns at 3,000 characters and refuses edits over 4,000 characters across every instruction field on the agent.
Step 2: Attach the knowledge the agent should answer from
Expand the Knowledge Bases accordion. Its description reads "Attach org knowledge to this agent." That word org is the whole point: the source you built for your phone agent is already in the list.
If you have not built one yet, go to Knowledge, then Add Knowledge Base. You give it a name, a description of what it covers, and then either files or pasted text. The dashboard takes up to 5 files, at most 4 MB each, in PDF, DOCX, TXT or MD. Ingestion is asynchronous, so a large source is not queryable the instant you press save.
Two limits are worth knowing before you upload. A knowledge source cannot be edited after upload, so a source that will change often is better built as pasted text you can replace wholesale than as a PDF somebody has to re-export. And retrieval is semantic, not keyword matching, so headings and full sentences work better than a bullet list of fragments. Building a knowledge base your voice agent will not hallucinate from goes into how to structure one properly.
From here you need a real agent and a real token, so create a free account and keep the dashboard open in another tab. Web agents covers what the widget does once it is embedded, and phone agents covers the other half of the same knowledge base.
Step 3: Generate a widget token
Expand the Embed Widget accordion. Its description is "Generate a widget token, then copy the embed script into your site."
Three things to know about tokens before you generate one:
- An agent can hold at most 3 active widget tokens.
- A token is shown once and cannot be recovered. Copy it somewhere before you navigate away.
- Tokens are revocable individually, which is why you get three. One per site, or one per environment, makes a revocation cheap.
If you lose a token, you do not recover it, you revoke it and generate another. With a cap of three, there is no room for a drawer full of forgotten tokens, which is a deliberate design choice rather than an inconvenience.
Step 4: Paste the script before the closing body tag
The dashboard gives you the snippet already filled in with your agent id and token. Paste it immediately before </body> on every page where the widget should appear.
<script
src="https://chat.foan.ai/app/sdk/chat_widget.js?v=20260526-gemini"
data-chat-url="https://chat.foan.ai"
data-backend-url="https://api.foan.ai"
data-agent="<agentId>"
data-widget-token="<token>"
data-title="Chat with us"
data-launcher="Chat"
data-color="#14b8a6"
data-intro-mode="branded"
></script>
data-title is the header of the chat panel, data-launcher is the label on the button, and data-color is the accent colour, so set those three to match your site rather than shipping the defaults.
Step 5: Decide whether visitors can call from the browser
The Web Call accordion controls in-browser voice. Its description is "Show a phone icon in the chat widget so visitors can start an in-browser voice call with this agent", and the switch is labelled "Allow in-browser voice calls".
Turn it on and the snippet gains two attributes:
data-web-call="true"
data-web-call-agent="<agentId>"
This is genuinely useful on a pricing page or a support page, where a visitor who is halfway through typing would rather talk. It is also the setting with the largest cost consequence, for reasons covered in the next section. Turn it on deliberately, not by default.
There is a third chat-only accordion, Callback Agent, described as "Select a voice agent to place phone callbacks for chat users." That is where a chat conversation can end in a phone call back rather than in the browser.
What the widget token exposes, and why that is fine
Foan says this in the product rather than burying it, so here it is plainly.
The widget token is public by design. It sits in your page source. Anybody who opens view source, or reads the network tab, can read it. That is not a leak, it is how a browser-side widget works.
What the token gives them is scoped to that one agent, and it is more than people expect:
- The agent's full instructions, including anything you wrote about how to handle awkward customers.
- The agent's custom variables.
- The setup of every tool the agent can call, including any credentials saved in those tools.
- Where in-browser calling is on, the ability to start voice calls that you pay for.
What it does not give them is anything else in your organisation. It does not reach your other agents, your campaigns, your call history or your wallet. The blast radius is one agent.
What is the practical rule?
Keep the tools a public chat agent can call read only and harmless, and put anything sensitive on the phone agent.
That single rule resolves almost every design question you will have. Worked through:
| Job | Chat agent | Phone agent |
|---|---|---|
| Answer from published policies and pricing | Yes | Yes |
| Look up stock or opening hours | Yes | Yes |
| Look up an order by an id the visitor types | Only if the id alone is not enough to reveal personal data | Yes |
| Issue a refund, change an address, cancel a booking | No | Yes |
| Anything using a saved API credential you would not print | No | Yes |
Two more habits worth forming. Write the chat agent's instructions as though a competitor will read them, because one might. And if in-browser calling is on for a widget on a high traffic page, watch the usage on that agent the way you would watch any other public endpoint, because the calls are billed to you.
None of this is an argument against a public widget. It is an argument for deciding, once, which side of the line each tool sits on. An agent is limited to 5 function tools anyway, so the choice is small enough to make properly.
Rotating and revoking a token
Revoking is a two-part job and people routinely do only half of it.
- Revoke the token. The widget using it stops working immediately.
- Remove the old script tag from the site. A revoked token in your page source is dead weight and will confuse whoever debugs the widget next.
Rotate when an agency or contractor who had the snippet stops working with you, when a token has been pasted somewhere you did not intend, or when you retire a site. With three token slots per agent, the comfortable pattern is to generate the replacement, deploy it, then revoke the old one, so the widget is never down.
Where do chat conversations end up?
Under Chat History in the sidebar, next to Call History for voice. Read them the way you read call transcripts: the questions your agent answers badly on chat are almost always the same ones it answers badly on the phone, and a fix to the shared knowledge base repairs both at once.
That is the real return on sharing a knowledge base across channels. Not the setup time you save on day one, but the fact that every correction lands in one place for the rest of the agent's life.
What about memory?
Each agent has a Memory section, with a toggle and a Memory Instructions field, for example "Remember user's preferred language and last order details. Do not store credit card numbers."
Read that as an agent level setting, because that is what it is. Configure it on the chat agent and on the voice agent separately, and write the instruction on each with the channel in mind. Telling an agent what not to retain is as important as telling it what to keep.
Where to go next
If you are choosing where a job belongs in the first place, voice agent or web chat is the honest version of that decision from a vendor that sells both. If the phone side is not built yet, how to build an AI phone agent covers it end to end, and the knowledge base you create there is the one you will attach here.
For what the widget looks like in place, see web agents.
Try it on your own number
Build an agent, point a number at it and listen to the first call.