AI Agent Management
Deploy
Add your chatbot to a website or ecommerce storefront.
Before You Deploy
Deployment makes the chatbot available to customers, so complete the quality checks first. The chatbot should answer core questions, escalate correctly, and match the website where it will appear.
- Data sources are processed.
- Playground tests pass for common questions.
- Appearance matches your brand.
- Lead forms and escalation settings are configured.
- Billing and usage limits are ready for expected traffic.
Deployment Method
- Open the selected chatbot.
- Go to Deploy.
- Copy the embed code.
- Paste the code into your website, theme, CMS, or tag manager.
- Publish your site changes.
- Open the live website and send a test message.
<!-- Paste before </body>. The embed key comes from Deploy > Chat bubble. -->
<script>
(function(){if(!window.qwryai||window.qwryai("getState")!=="initialized"){window.qwryai=(...arguments)=>{if(!window.qwryai.q){window.qwryai.q=[]}window.qwryai.q.push(arguments)};window.qwryai=new Proxy(window.qwryai,{get(target,prop){if(prop==="q"){return target.q}return(...args)=>target(prop,...args)}})}const onLoad=function(){const script=document.createElement("script");script.src="https://www.qwryai.com/widget/script/YOUR_EMBED_KEY";document.body.appendChild(script)};if(document.readyState==="complete"){onLoad()}else{window.addEventListener("load",onLoad)}})();
</script>JavaScript API
The embed code loads the widget after your page has loaded, so it never slows the page down. The page controls the widget through window.qwryai, which works as soon as the embed code is on the page: calls made before the widget has loaded wait and run once it has. window.chatbot offers the same controls once the widget has loaded.
// Open, close, or toggle the chat window.
window.chatbot.open();
window.chatbot.close();
// Send a message on the visitor's behalf.
await window.chatbot.sendMessage("Where is my order?");
// Identify a signed-in visitor with a JWT signed on your server (see Identity Verification).
const { token } = await fetch("/api/qwryai-token").then((response) => response.json());
await window.qwryai("identify", { token });
// React to widget events.
window.chatbot.on("messageReceived", (message) => console.log(message));
// Register client-side tools for AI Actions.
window.qwryai("registerTools", {
Read_current_page: async () => ({
status: "success",
data: { title: document.title },
}),
lookupCart: async (args, user) => ({ status: "success", data: { items: [] } }),
});window.qwryai(command, payload) accepts the same commands as a single function, for example window.qwryai("open") or window.qwryai("identify", { token }).
Identity Verification
Identity verification tells the agent who a signed-in visitor is, so it can greet them by name and run actions on their account. Your server signs a short-lived JWT for the signed-in user with the agent's secret key, and the page passes that token to the widget. QwryAI checks the signature, so visitors cannot pretend to be someone else.
- Open Deploy > Website widget and copy the Secret key under Identity verification.
- Store it on your server as an environment variable, for example QWRYAI_IDENTITY_SECRET. Never put it in browser code or commit it.
- Add a server endpoint that signs a JWT (HS256, expiring within 1 hour) for the signed-in user.
- In the browser, fetch the token and call window.qwryai("identify", { token }) after the embed code.
- Call window.qwryai("logout") when the user signs out.
// --- SERVER CODE (Node.js) ---
const jwt = require("jsonwebtoken");
app.get("/api/qwryai-token", requireSignedInUser, (req, res) => {
const token = jwt.sign(
{
user_id: req.user.id, // Required: your user's stable id
email: req.user.email,
name: req.user.name,
plan: req.user.plan, // Saved when "plan" is a contact attribute in Settings > Attributes
},
process.env.QWRYAI_IDENTITY_SECRET,
{ algorithm: "HS256", expiresIn: "1h" },
);
res.json({ token });
});
// --- CLIENT CODE ---
const { token } = await fetch("/api/qwryai-token").then((response) => response.json());
await window.qwryai("identify", { token });| Claim | Use |
|---|---|
| user_id | Required. Your user's stable id; the contact is matched on it. |
| email, name, phone | Fill the contact's details. |
| exp | Required. Tokens are rejected after it; one hour is a good lifetime. |
| Anything else | Saved to the contact attribute with the same key, when it exists in Settings > Attributes (strings, numbers, booleans). Other claims are ignored. |
Troubleshooting
| Problem | What to check |
|---|---|
| Widget does not appear | Confirm the embed code is complete, published, and not blocked by the site theme or CSP. |
| Wrong chatbot appears | Confirm the embed key belongs to the selected chatbot and workspace. |
| Widget appears but does not answer | Check chatbot active state, plan status, credits, and message limits. |
| Conversation missing in QwryAI | Confirm the live domain uses the latest published script and the correct environment. |
- Confirm the embed code was copied completely.
- Confirm the website change was published.
- Check that the chatbot is active.
- Make sure the embed key belongs to the correct chatbot.
- Check browser console errors if the widget does not load.
| Deployment area | Launch check |
|---|---|
| Chat widget | Display name, initial message, suggested messages, placeholder, feedback, copy button, notices, footer, and embed method are configured. |
| Website embed | The script is published on the live customer-facing page, not only in a preview editor. |
| Connected channels | Email, Slack, Zapier, WhatsApp, Messenger, Instagram, Telegram, and Shopify routes are tested separately when enabled. |
| Attachments | Images, PDFs, file count, file size, PDF page count, and unsupported formats are handled before launch. |