---
title: "Open the widget from your page"
description: "Open, close or prefill the chat bubble from your own buttons with the small JavaScript API the widget script exposes."
canonical: "https://lookio.app/docs/guides/widget/javascript-api"
updated: "2026-11-08"
---

# Open the widget from your page

When the widget script is on the page, `window.Lookio` is available:

```js
Lookio.open();     // opens the chat
Lookio.close();
Lookio.toggle();
Lookio.ask("How do returns work?"); // opens the chat and asks
```

For example, your own help button, and a link that asks a question for the visitor:

```html
<button onclick="Lookio.open()">Ask our assistant</button>
<a href="#" onclick="Lookio.ask('How do I issue a credit note?'); return false">How do credit notes work?</a>
```

`window` receives the events `lookio:open` and `lookio:close`:

```js
window.addEventListener("lookio:open", () => console.log("chat opened"));
```

> **Note**
>
> These functions control the chat bubble. An in-page chat is always open.
