> For the complete documentation index, see [llms.txt](https://developers.luckyorange.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.luckyorange.com/libraries/browser/chat.md).

# Chat

## Trigger Chat Programmatically&#x20;

By default, chat is only opened when a visitor clicks on the chat launcher displayed on your site. If you would like a button or another element on your site to control the chat state, you can take advantage of the messenger API.&#x20;

Utilizing the `LO.messenger` API, you can control the state by calling `open()` or `close()` .

```javascript
function openChat () {
    LO.messenger.open()
}

function closeChat () {
    LO.messenger.close()
}
```

{% hint style="warning" %}
The `LO.messenger` API is only available once chat has been set up for your site.
{% endhint %}

The chat launcher can also be completely hidden, should you desire to control the chat state exclusively through an element on your site. You can find this and other chat launcher settings in the Lucky Orange app under the **Chat Settings** tab, located within your site's **Settings** section.&#x20;
