Embedded widget
One script tag puts a chat on your site. It answers only from the documents in one workspace.
The widget is a chat panel for your own website. A visitor asks a question and gets an answer taken only from the documents in the workspace you choose. Visitors do not sign in, cannot upload or change anything, and do not see your files or which document an answer came from.
Add it in three steps
Open the Embed page
In the console, open your app, then the workspace the widget should answer from, and choose Embed. The page shows a live preview and your snippet. Change the look (color, theme, language, texts) and press <b>Save</b>: the next time you open the page, even after you sign in again, it shows the look you saved. Only the workspace owner can save it. At the top, turn on <b>Widget for this workspace</b>: a new workspace starts off, and the widget does not answer for a workspace that is off — not even on an allowed site.
Add your domain
Under Allowed domains, add every site that will show the widget, for example
clinic.irandwww.clinic.ir. All sites are blocked by default: with an empty list, the widget works on no site.Paste the snippet
Copy the snippet and paste it into your site, once per page, just before
</body>. It loads withasync, so it does not slow your page down.HTML<script src="https://app.daneshyar.info/widget.js" data-api-key="sk_9f3aC2xQ7mB1vT8sE4nK6pR0jY5wZ2hL" data-app-id="2d7c0e91-4a5b-4f8e-b3c6-9e1f0a7d5c42" data-workspace-id="8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f" async ></script>
Using React, Next.js, Vue or another framework? See Framework guides.
How it works
The script draws a button on your page. When a visitor opens it, the chat loads inside an iframe on Daneshyar's own site, so your CSS cannot break it and it cannot read your page.
<script src="…/widget.js">frame-ancestors/api/widget/chat/- The widget only reads. It lists the workspace's documents and answers questions about them.
- It talks to two endpoints only:
/api/widget/config/and/api/widget/chat/. - Answers are grounded. If the documents do not hold the answer, the widget says so instead of guessing.
About the key in the snippet
The widget authenticates with the app's public widget key. It is not the key the REST API accepts. What it can and cannot do:
- It can ask questions only in the workspaces where you turned the widget on, and read the widget's allowed domains. Nothing else. Your other workspaces in the same app stay closed to it.
- It cannot list, read or download your files, and its answers do not say which document they came from.
- Answers still repeat what your documents say, so put only documents in this workspace whose content you are happy for visitors to learn.
What visitors see
- A round button in the corner of the page, or the chat inside an element you choose (inline mode).
- A list of the documents the answers come from.
- Answers in Persian or English, written only from your documents.
- A full-screen chat on phones narrower than 480px.
Allowed domains
The allowed list says which sites may show the widget. It belongs to the whole app, so one list covers every workspace you embed. Enter a host, with no https:// and no path. A port counts as part of the host.
| You enter | Works on | Does not work on |
|---|---|---|
clinic.ir | clinic.ir | www.clinic.ir |
*.clinic.ir | www.clinic.ir · help.clinic.ir | clinic.ir |
localhost:5173 | localhost:5173 | localhost:3000 |
- All sites are blocked by default. An empty list means the widget works on no site — only the preview in the console.
- A wildcard like *.clinic.ir covers subdomains but not clinic.ir itself. Add both if you need both.
- Today you cannot remove the last domain from the list in the console. To turn the widget off everywhere, delete the widget key on the app page.
Limits and costs
Each limit works on its own. When a visitor reaches one, the widget asks them to wait and try again later.
| Limit | Default | What it counts |
|---|---|---|
widget_chat_ip | 20 per hour | Questions from one IP address. |
widget_chat_app | 500 per day | Questions to your whole app, from every visitor. |
widget_get_ip | 60 per hour | Loads of the widget's settings and document list from one IP address. |
Every answer is paid from the wallet of the account that owns the app, the same as a chat in the console. When the wallet is empty, visitors see “The assistant can't answer right now”, and they never see a billing message.