Widget reference
Script attributes
Section titled “Script attributes”The embed script reads just two data-* attributes:
| Attribute | Required | Description |
|---|---|---|
data-site-id |
Yes | Your site ID from the dashboard. Identifies your site (not a secret). |
data-api |
No | Advanced: override the API base URL. Defaults to where the script is served. |
<script src="https://app.yamidoo.ai/widget.js" data-site-id="YOUR_SITE_ID" async></script>Appearance and behavior are not set via attributes — they’re configured in the dashboard (see below).
Dashboard configuration
Section titled “Dashboard configuration”These options are set in the dashboard and fetched by the widget at runtime:
| Option | Values |
|---|---|
| Color | Any hex color. |
| Title | Header / launcher text. |
| Welcome message | First message shown when the widget opens. |
| Position | bottom-right or bottom-left. |
| Avatar | Optional image URL. |
| Suggested questions | List of strings, plus how many to show (1–6). |
| Contact capture | Ask name / email, and the timing of the prompt. |
| Satisfaction ratings | Per-answer thumbs rating (on/off). |
| Conversation rating | none, stars, or emojis. |
| Human handoff | On/off, and whether it requires an online agent. |
JavaScript API
Section titled “JavaScript API”The widget registers a global yamidoo() function. Call it with a command name
and optional arguments:
yamidoo('open');yamidoo('ask', 'Do you offer refunds?');yamidoo('identify', { name: 'Jane Doe', email: 'jane@example.com' });| Command | Description |
|---|---|
yamidoo('open') |
Open the chat window. |
yamidoo('close') |
Close the chat window. |
yamidoo('toggle') |
Toggle open/closed. |
yamidoo('show') |
Show the launcher bubble. |
yamidoo('hide') |
Hide the widget entirely. |
yamidoo('reset') |
Start a fresh chat / new session. |
yamidoo('logout') |
Clear the identified user. |
yamidoo('ask', question) |
Open the widget and send question. |
yamidoo('identify', traits) |
Attach { name, email, ...metadata } to the user. |
yamidoo('on', event, cb) |
Subscribe to an event. |
yamidoo('once', event, cb) |
Subscribe for a single event. |
yamidoo('off', event, cb?) |
Unsubscribe (omit cb to remove all). |
Events
Section titled “Events”Subscribe with yamidoo('on', event, callback):
| Event | Fires when… |
|---|---|
open |
The widget opens. |
close |
The widget closes. |
message |
A message is sent or received. |
handoff |
A conversation is handed to a human. |
HTML triggers
Section titled “HTML triggers”Any element with a data-yamidoo attribute drives the widget on click — no
JavaScript required:
<button data-yamidoo="open">Chat with us</button>Supported values: open, close, toggle.