> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yourhomie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Übersicht

> Control the embedded Homie chat widget from your website using the global browser API `window.homieBot`.

<Note>
  This page documents the **client-side Browser API** exposed by the embed script. For server-side REST endpoints, see
  your API Reference.
</Note>

## Overview

Once the Homie embed script is loaded, a global object `window.homieBot` becomes available.
Use it to open/close the widget, check its state, send messages programmatically, and read the chat history.

## Requirements

1. The script must be embedded on your page.
2. `chatbotId` and `domain` must be set.
3. `storeId` is optional and can be passed when needed.

```html theme={null}
<script
  src="https://chat.yourhomie.ai/embed.min.js"
  chatbotId="YOUR-CHATBOT-ID"
  domain="https://chat.yourhomie.ai"
  storeId="your-store-id"
  defer
></script>
```

<Warning>
  The object <code>window\.homieBot</code> is only available **after** the script has loaded. Listen for the
  <code>homiebot:api-ready</code> event to be notified when the API is ready, or use the <code>waitForHomie()</code> fallback in the examples section.
</Warning>

## TL;DR

| Method                            | Purpose                               |
| --------------------------------- | ------------------------------------- |
| `open()`                          | Open the chat                         |
| `close()`                         | Close the chat                        |
| `toggle()`                        | Toggle open/closed                    |
| `isOpen()`                        | Read current state                    |
| `sendMessage(input, options?)`    | Inject a message (with retry/timeout) |
| `getHistory()`                    | Read the current history              |
| `updateMessageMetadata(metadata)` | Add metadata to the next user message |
