Help · Raha chat
Add Raha chat to your website.
A chat bubble on your site that your AI employee answers, in Persian, Arabic or English. You paste one line of code. Visitors can ask for a person, and you see every conversation in your Inbox.
- One line of code
- Persian, Arabic and English
- Business and Pro plans, and the trial
On this page
What it is
Raha chat is the ready-made way to talk to your website's visitors. You do not build anything: you connect it in the Raha app and add one line to your site.
- Your AI employee answers. The employee you chose in the app replies to each visitor, in the visitor's language, from your business's knowledge.
- Your team can step in. Take over a conversation from the Inbox at any time, or let the AI hand it over to a person.
- It lives in your Inbox. Website chat conversations sit beside WhatsApp, Telegram and the rest.
- Website chat works one way at a time. Raha chat, or the Custom API for businesses that build their own chat window.
Add it in four steps
Connect Raha chat in the Raha app
Channels, Website chat, Raha chat. Give it a name, list the sites that may show it, pick the languages, the colour and the corner. The app then shows your snippet.
Copy the snippet
It is one
<script>line with your chat key. The app also shows an identity secret once; you only need it if you sign in your own customers (see the developers page). You can skip it for now.The snippet <script src="https://app.raha.to/widget/v1/loader.js" data-key="wk_9mXq2LrT7vKd4HsEw1ZbPa" async></script>Paste it on your site
Before the closing
</body>tag, on every page that should show the chat. Where to paste it shows the common site builders.Try it
In the app, open the test page (Preview, or Send a test) and write a message as a visitor. Then visit your own site: the bubble appears in the corner and the chat status in the app changes from "Waiting for the first visitor" to "Connected".
The snippet
One line loads a small script that adds the chat in a corner of your page. The chat itself runs in a frame from Raha, so your page cannot read it and it cannot read your page.
<script src="https://app.raha.to/widget/v1/loader.js" data-key="wk_9mXq2LrT7vKd4HsEw1ZbPa" async></script>| Attribute | Required | Meaning |
|---|---|---|
src | Required | The loader on Raha's address. Copy it from the app; do not edit it. |
data-key | Required | Your public chat key (wk_ and 22 characters). It is safe to show in a page. |
data-locale | Optional | fa, en or ar: the language to start in, if your chat offers it. Without it the chat uses your default language. |
async | Keep | The page does not wait for the chat to load. |
<script src="https://app.raha.to/widget/v1/loader.js" data-key="wk_9mXq2LrT7vKd4HsEw1ZbPa" data-locale="fa" async></script>One snippet works for the whole site. Use the same one on every page, or put it in the shared footer or template your pages already use.
Allowed sites
Only the sites you list can show your chat. Anyone else who copies your snippet sees nothing.
- Add each site once, as it appears in the address bar:
shop.example.com. You can paste a whole address; Raha keeps only the site part and drops the path. - `www.example.com` and `example.com` are different sites. Add both if both are used.
- Subdomains are separate too.
blog.example.comis not covered byexample.com. Wildcards (*) are not accepted. - HTTPS only. An address that starts with
http://is refused. A port is kept when it is not the standard one (example.com:8443). - Up to 20 sites.
- An empty list shows the chat on no page at all. The app warns you when the list is empty.
- Testing on your own computer:
http://localhostandhttp://127.0.0.1are accepted only in a development version of the app.
| You type | Raha keeps |
|---|---|
Shop.Example.com | https://shop.example.com |
https://www.example.com/pricing?x=1 | https://www.example.com |
example.com:8443 | https://example.com:8443 |
http://example.com | Refused: use https |
Where to paste it
Every builder has a place for custom code. Menu names change from time to time; look for "custom code", "code injection", "footer" or "scripts".
WordPress#
- Install a plugin that adds scripts to the header or footer, or use your theme's own "custom code" field.
- Paste the snippet into the footer field and save.
- With a block theme: Appearance, Editor, open the footer template and add a Custom HTML block with the snippet.
Avoid editing theme files directly: a theme update replaces them.
Shopify#
- Online Store, Themes, the menu next to your theme, Edit code.
- Open
layout/theme.liquid. - Paste the snippet just before
</body>and save.
Customer accounts and checkout pages follow the platform's own rules; the chat appears on the pages that use theme.liquid.
Wix#
- Settings, Custom Code (under Advanced), Add Custom Code.
- Paste the snippet, name it "Raha chat", choose All pages, and place it in Body - end.
- Apply and publish. Custom code needs a Premium plan with a connected domain.
Squarespace#
- Settings, Developer Tools, Code Injection (or Advanced, Code Injection).
- Paste the snippet into the Footer box and save.
- Code injection needs a plan that includes it, and it does not show while you are editing: view the live site.
Webflow#
- Site settings, Custom code, Footer code.
- Paste the snippet, save, and publish the site.
- Custom code in site settings needs a paid site plan.
Plain HTML#
- Open each page (or the shared layout or template your pages use).
- Paste the snippet just before
</body>. - Upload the pages and reload the site.
The JavaScript API
The snippet adds a small RahaChat object to the page, so your own buttons and code can control the chat.
| Call | What it does |
|---|---|
| RahaChat.open() | Opens the chat panel. |
| RahaChat.close() | Closes it. The bubble stays. |
| RahaChat.setLocale("fa" | "en" | "ar") | Switches the language. Ignored if your chat does not offer that language. |
| RahaChat.on(event, fn) | Listens for an event. RahaChat.off(event, fn) stops listening. |
| RahaChat.setUser({…}) | Tells the chat who a signed-in customer is. For developers: identity verification. |
| Event | When | Data |
|---|---|---|
| ready | The chat is loaded. | - |
| opened | The panel opened. | - |
| closed | The panel closed. | - |
| message | A message arrived from the AI or a person. | { from: "ai" | "human" } |
| unread | The number of unread messages changed while the panel is closed. | { count } |
// open the chat from your own button
document.querySelector("#help-button").addEventListener("click", function () {
RahaChat.open();
});
// follow the page's language
RahaChat.setLocale(document.documentElement.lang === "ar" ? "ar" : "en");
// react to what happens in the chat
RahaChat.on("unread", function (e) {
document.title = e.count > 0 ? "(" + e.count + ") My shop" : "My shop";
});
RahaChat.on("message", function (e) {
console.log("a message from", e.from); // "ai" or "human"
});Calling it before the script has loaded#
The script loads after your page (async). To call RahaChat before it is ready, add the small queue stub above the snippet: the calls are kept and run in order once the chat loads. Without it, wait for the page to load.
<script>
window.RahaChat = window.RahaChat || { q: [] };
["open", "close", "setUser", "setLocale", "on", "off"].forEach(function (m) {
window.RahaChat[m] = window.RahaChat[m] || function () {
window.RahaChat.q.push([m].concat([].slice.call(arguments)));
};
});
</script>
<script src="https://app.raha.to/widget/v1/loader.js" data-key="wk_9mXq2LrT7vKd4HsEw1ZbPa" async></script>A call with a wrong value is ignored, with a warning in the browser console. Nothing about the visitor is ever put in a web address.
What visitors see
- A round button in the corner you chose (right or left) in your colour. It opens the chat; on a phone the chat fills the screen.
- Your chat name at the top, beside your AI employee's photo and name.
- A welcome message you wrote for each language, or Raha's own greeting if you left it empty.
- Their language. The chat shows the languages you switched on, and starts in your default one (or the page's
data-locale, or the language your page sets withsetLocale). - Replies from your AI employee, and a clear note when a person from your team takes over.
- Files. Visitors can send images and PDFs: up to 10 MB each and 5 per message. Other types, including SVG and HTML, are refused.
- A badge with the number of unread replies while the panel is closed.
- "Powered by RahaAi" at the bottom on the free trial. It is removed on paid plans.
The e-mail request
When a visitor asks for a person and nobody can answer, the chat asks for an e-mail address so your team can follow up. "Nobody can answer" means it is outside the business's weekly hours, or nobody replied within 10 minutes.
- It is on by default. Turn it off in the chat's settings in the app.
- The address is kept on the customer's profile in the Inbox. It is asked for once.
- Raha does not send replies by e-mail yet. A visitor sees your reply in the chat when they come back; write to the address yourself if you need to reach them sooner.
- If a person replies before the request is shown, the request is not shown at all.
Privacy: what is kept
The chat is built to collect only what a conversation needs.
| What | Why | Where |
|---|---|---|
| The messages and files | They are the conversation. | Your Inbox, like every channel. |
| The page the visitor is on: its address without the query and fragment, and its title | So your team and the AI know what the visitor was looking at. | On the conversation. |
| A visitor token | So the visitor keeps the same conversation when they return. | In the chat frame's own browser storage. Raha chat sets no cookie on your site. |
| An e-mail address, if the visitor gives one | So your team can follow up. | Sealed on the customer's profile. |
| Name, ID and e-mail of a signed-in customer | Only if your server sends them (identity verification). | On the customer's profile. |
- Raha chat does not read the rest of your page and does not track visitors across sites. It stores nothing on your site.
- Message text is shown as text. Links are made only for web addresses, and open in a new tab.
- To limit abuse, Raha limits how fast one visitor, one network address and one chat can send. Visitors behind a shared network (a company or a VPN) can still chat.
- Your privacy notice should say that you use a chat provider. Raha's own policy is at rahaai.com/privacy.
If your site has a strict Content-Security-Policy
Most sites need nothing. If your pages send a Content-Security-Policy that limits scripts and frames, allow Raha's address in two places.
| Directive | Allow | Why |
|---|---|---|
script-src | https://app.raha.to | The loader script. Use the address in your snippet. |
frame-src | https://app.raha.to | The chat frame. |
Content-Security-Policy:
default-src 'self';
script-src 'self' https://app.raha.to;
frame-src https://app.raha.to<meta http-equiv="Content-Security-Policy"
content="script-src 'self' https://app.raha.to; frame-src https://app.raha.to">- Use the address from your snippet:
https://app.raha.tois Raha's cloud. - If you set
default-srcand noframe-src,child-srcordefault-srcdecides for frames: add Raha's address there. - Nothing else is needed: the chat runs its own requests, styles and fonts inside its frame, not on your page. The loader sets the frame's size through the page's style object, so
style-srcdoes not need to change. - Your page's
frame-ancestorsandX-Frame-Optionsonly control who may frame your page; they do not affect the chat.
If the chat does not appear
| Check | What to do |
|---|---|
| Is the site in the allowed list, exactly as visitors see it? | Add it in the chat's settings. www. and the bare name are two sites, and so are subdomains. |
| Is the list empty? | An empty list shows the chat nowhere. Add your site. |
Is the page on https://? | Raha chat does not show on plain http:// pages (except localhost in a development version). |
| Is the snippet on this page, and did you publish? | View the page's source and look for widget/v1/loader.js. Some builders show custom code only on the published site. |
Does the snippet's data-key match the chat in the app? | Copy the snippet again from the chat's settings. |
| Does your plan include Raha chat? | It needs the Business or Pro plan, or the trial. If your plan lapsed, the chat stays but your AI employee does not reply. |
| Does a Content-Security-Policy, an ad blocker or a privacy extension block it? | See strict sites. Test in a clean browser window. |
| Is the daily reply limit reached? | The settings page shows today's count. At the limit, replies pause until the next day and the chats wait in your Inbox. |
Questions? Write to [email protected]. Developers who sign in their own customers: identity verification.
