Actions & automation
Build an in-app assistant
Put your agent inside your own web app: it knows who's signed in and which page they're on, guides them step by step, and does tasks for them after they confirm.
An in-app assistant lives inside your product (a dashboard, a customer portal, a booking app). Your users ask "How do I create an API key?" and the agent explains the steps, opens the right page — or creates it for them after they approve. AnytimeReply's own dashboard assistant ("Ask AI") is built exactly this way.
It combines four things you already have:
| Piece | What it does |
|---|---|
| Identity verification | The agent knows who is signed in (name, email, plan and any other attributes you send). |
| Page awareness | The agent knows which page they're chatting from — single-page apps included. |
| Website actions | The agent calls functions in your app, in the user's own session, with their own permissions. |
| Your docs as knowledge | Train the agent on your help center or docs so the steps it explains are right. |
- 1
Train the agent on your docs
Add your docs site or sitemap on Train → Sources, and add Q&A for anything tricky.
- 2
Load the chat in your app, signed in
Create a short-lived token on your server (see Identity verification) and hide the floating bubble so the chat opens from your own "Help" button:
Your app<script> window.AnytimeReplySettings = { user: { token: "JWT_FROM_YOUR_SERVER" }, // { user_id, email, name, attributes: { plan: "Pro" } } launcher: false, }; </script> <script src="https://anytimereply.com/widget.js" data-agent="YOUR_AGENT_ID" data-launcher="none" defer></script> <button onclick="AnytimeReply.toggle()">Ask AI</button> - 3
Add website actions for the tasks
On Build → Actions → + Website action, describe each task and its inputs (e.g.
open_pagewithpage,create_api_keywithname). Then register the handlers in your app:Your appAnytimeReply.onAction("open_page", async ({ page }) => { router.push(PAGES[page]); return { ok: true, opened: page }; }); AnytimeReply.onAction("create_api_key", async ({ name }) => { if (!(await confirmDialog(`Create the API key “${name}”?`))) return { ok: false, cancelled: true }; const key = await api.createKey(name); // runs as the signed-in user showSecretOnce(key); // show secrets in your UI, never return them to the chat return { ok: true, name }; }); - 4
Tell the agent how to behave
In Instructions, explain when to guide and when to offer doing it, e.g. "Explain the steps first, then offer to open the page or do it for them. Never ask for passwords or card details."
Keep it safe
- Confirm every change in your own UI (like the dialog above). Your handler decides — the agent can only ask.
- Run tasks with the user's own session and permissions. Your server's normal checks (plan limits, roles) still apply; return the error and the agent explains it.
- Never return secrets (API keys, tokens, passwords) to the chat. Show them in your app.
- Leave payments, deleting data and changing passwords to your own pages — the agent can open them.
The agent also knows the page a visitor is on in single-page apps automatically. You can tell it yourself with AnytimeReply.setPage(location.href) after a route change.