Developer overview
AgentMySite adds an AI support assistant to your website. It answers from the content you add, and it can take actions on your site through tools you define. Site owners can install it without writing code. This section is for developers who want to embed it in an app, connect it to their own backend, or review how it works.
What you can do
Section titled “What you can do”| Capability | Status | Where to start |
|---|---|---|
| Embed the widget with one script tag, on any site or single-page app | Available | JavaScript API |
| Label conversations with your signed-in user’s ID, name, and email | Available | Script attributes |
| Let the assistant call your code: look up orders, change settings, and more | Available | AgentActions |
| Show the chat full screen in a mobile app WebView (Flutter) | Available | Mobile apps |
| Manage sites, content, and conversations through a server-side REST API, and receive webhooks | Coming soon | REST API |
The JavaScript API doesn’t yet include methods to open or close the chat or to listen for widget events. See What the API doesn’t include yet.
How the pieces fit
Section titled “How the pieces fit”- The loader (
https://widget.agentmysite.com/loader/widget.js) is a small script that runs on your page. It draws the launcher, gets a short-lived chat session for the visitor, and opens the chat. - The chat runs in a sandboxed iframe served from
widget.agentmysite.com. It can’t read your page, and your page can’t read it. window.AgentMySiteis the global object the loader adds to your page. You use it to register the handler that runs your AgentActions.- The API (
api.agentmysite.com) authenticates the widget, checks that your page’s domain is allowed, finds relevant passages in your content, and streams the assistant’s answer.
Appearance and behavior (colors, assistant name, auto-open, light or dark mode) and the assistant’s welcome message and suggestion chips are set in the admin panel and delivered to the widget when the page loads, so you don’t redeploy your site to change them.
Guides
Section titled “Guides”Mobile apps
Section titled “Mobile apps”To show the assistant in a native app, load the widget’s mobile page, https://widget.agentmysite.com/mobile.html, in a WebView. The mobile page opens the chat full screen right away, without a launcher. Your app passes its settings in a window.AgentMySiteConfig object, set before the page script runs:
| Field | Description |
|---|---|
siteKey | Required. Your site key. |
apiBase, iframeOrigin | The API and widget hosts (https://api.agentmysite.com, https://widget.agentmysite.com). |
visitorId | A stable ID your app keeps for the user, so conversations survive app restarts. |
conversationId | The conversation to resume, or null to start a new one. |
customerId, customerName, customerEmail, shopDomain | Optional labels, as on the web. |
The page talks to your app through a JavaScript channel named AgentMySiteHost (for webview_flutter) or a handler with the same name (for flutter_inappwebview). It sends JSON events: ready, conversationChanged, toolCall, requestClose, navigate, and error. Your app answers tool calls with window.agentmysite.toolResult(toolUseId, result, isError) and can close the chat with window.agentmysite.close(). In a WebView, tool calls time out after 20 seconds.
What visitors might see
Section titled “What visitors might see”These states come from the service, not from your code, but they help when you test your integration:
- The widget doesn’t appear. The site key is missing or wrong, or the page’s domain isn’t on the site’s allowed list.
- “This assistant is unavailable right now.” The site has used all its credits for the current billing period. The assistant answers again when credits renew or the plan changes.
- “You already have a request with our team.” The visitor already has an open support ticket, so the widget doesn’t create another one.
- An error after many messages. The visitor or the site reached a rate limit.
Was this page helpful?
Thanks for the feedback.