> For the complete documentation index, see [llms.txt](https://docs.userlane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.userlane.com/developer-reference/implement-a-command-to-open-the-assistant.md).

# Implement a command to open the Assistant

Trigger the Assistant from a custom button or toggle using the openAssistant command.

## About opening the Assistant

A user normally opens the Assistant by clicking the Assistant icon in one corner of the screen. The `openAssistant` command opens it from a different trigger instead. This is useful where the Assistant icon is hidden, or where the application already has its own help control.

Two common cases:

* Open the Assistant when a user clicks a specific element, for example a Help or Interactive Support button in the application.
* Open the Assistant when a user activates a toggle.

Hiding the Assistant and opening it from a custom control are usually combined. See [Hide Userlane on specific pages](/developer-reference/hide-userlane-on-specific-pages.md).

## Requirements

* The Userlane snippet is implemented in the application. See [How Userlane is deployed](/deployment/rollout/how-userlane-is-deployed.md).
* A developer has added the `openAssistant` command to the button or toggle.

## Implement the command

Add the command to the element that should open the Assistant. When the element is clicked, the Assistant opens in the same way as clicking the Assistant icon.

```javascript
// open the Assistant
Userlane('openAssistant');
```

The command opens the Assistant immediately.

## Relevant articles

{% content-ref url="/pages/MIL8YAGDDCv85i0MnyuQ" %}
[Hide Userlane on specific pages](/developer-reference/hide-userlane-on-specific-pages.md)
{% endcontent-ref %}

{% content-ref url="/pages/JaoydeD5UPCYFS9NuupA" %}
[Quick reference of commands](/developer-reference/quick-reference-of-commands.md)
{% endcontent-ref %}

{% content-ref url="/pages/fsyxQCU0NHHxdU55aS9u" %}
[How Userlane is deployed](/deployment/rollout/how-userlane-is-deployed.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.userlane.com/developer-reference/implement-a-command-to-open-the-assistant.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
