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

# Helper Methods

> Programmatically control the chat widget with simple JavaScript methods. These methods let you dynamically control the chat widget's behavior from anywhere in your application. They are available under the global `window.chatnode` object.

<Note>
  Make sure to load the [popup chat
  script](/developer-guides/javascript-sdk/quick-start) before calling these
  methods.
</Note>

## `open()`

Opens the chat widget and brings it into view.\
Useful if you want to programmatically start a conversation (e.g., after a user clicks a `Need help?` button).

```javascript theme={null}
window.chatnode.open();
```

## `close()`

Closes the chat widget without clearing its history.
This is helpful if you want to temporarily hide the chat while keeping the session intact.

```javascript theme={null}
window.chatnode.close();
```

## `closePopups()`

Closes any active popup messages without affecting the main chat window.

```javascript theme={null}
window.chatnode.closePopups();
```

## `reset()`

Resets the chat session completely.
This clears the chat history, context, and state—essentially starting a new conversation from scratch.

```javascript theme={null}
window.chatnode.reset();
```

## `setUserInfo()`

Updates the chat widget with the current user's information from your app.

```javascript theme={null}
window.chatnode.setUserInfo({
  name: "John Doe",
  email: "john@example.com",
  phone: "+1-202-555-0173",
  info: "Premium subscriber",
  stripe_accounts: [
    {
      id: "cus_123456789",
      name: "Business Name",
      email: "billing@example.com",
    },
  ],
});
```

### Parameters

* **`name`** (optional)
  The user's display name.

* **`email`** (optional)
  The user's email address.

* **`phone`** (optional)
  The user's phone number.

* **`info`** (optional)
  Additional context or metadata about the user (e.g., role, plan, notes).

* **`stripe_accounts`** (optional)
  An optional list of connected Stripe customer accounts.
  Each entry should include:

  * `id` (string, required): Stripe customer ID (e.g., `cus_xxxxx`).
  * `name` (optional): Account name.
  * `email` (optional): Account-specific email.
