# Web SDK Reference

### .authenticate(consumerToken: string)

This is required before using the other SDK functions and API requests. For details on getting the consumer token, see [Installing Konnect](/kolla/getting-started/installing-konnect.md).&#x20;

### .openMarketplace()

This will launch the Integration Marketplace in a modal on your website.

### .closeMarketplace()

This will close the Integration Marketplace modal on your website.

### .openConnector(connectorID: string)

This will launch the integration marketplace directly to a connector details page instead of starting at the marketplace list page.

### .authConnector(connectorID: string, redirectURL:string\[optional])

This will trigger the authentication process for the given connector immediately without showing the embedded marketplace. This is for OAuth connectors only.

If you pass the optional redirectURL, after authentication is finished it will redirect to that URL. If this isn't set it will redirect to the URL that it was on when the function was called.

### .subscribe(eventName: string, handler: Function) <a href="#subscribe" id="subscribe"></a>

Use this function to subscribe to events. These events are scoped only to the current session for the current user/consumer.&#x20;

| Event Type         | Usage .subscribe("\[event\_title]", fn) |
| ------------------ | --------------------------------------- |
| Link Created       | "onLinkCreated"                         |
| Link Disabled      | "onLinkDisabled"                        |
| Marketplace Opened | "onMarketplaceOpened"                   |
| Marketplace Closed | "onMarketplaceClosed"                   |

### .getConsumer() <a href="#get-consumer" id="get-consumer"></a>

This gets the consumer information from the consumer token and also returns all the linked accounts for the authenticated consumer.

```javascript
kolla.getConsumer();

// Response
{
	authenticated: true,
	user_id: "xyz", // The user ID you specified when generating the consumer_token
	user_email: "email@email.com",
	organization_name: "My Customers Org", // Optionally set when generating token
	organization_id: "23242422asfkjalsk", // Optionally set when generating token
	connectors: { // List of all linked accounts
		"slack-1": {
			status: "ACTIVE"
		},
		"hubspot-2": {
			status: "NEEDS_REAUTH"
		}
	}
}
```

### .getConnectors()

Get a list of all your connectors with logos and background color. Use this endpoint to create your own connector list page.

{% tabs %}
{% tab title="Web SDK" %}

```javascript
kolla.getConnectors();

// Response
{
    connectors: [
        {
            type: 'salesforce',
            display_name: 'Salesforce',
            connector_id: 'salesforce-1',
            background_color: '#057ACF',
            icon: 'https://cdn.getkolla.com/public/connectors/salesforce.svg'
        },
        {
            type: 'hubspot',
            display_name: 'Hubspot',
            connector_id: 'hubspot-2',
            background_color: '#F67600',
            icon: 'https://cdn.getkolla.com/public/connectors/hubspot.svg'
        },
        {
            type: 'slack',
            display_name: 'Slack',
            connector_id: 'slack',
            background_color: '#4A154B',
            icon: 'https://cdn.getkolla.com/public/connectors/slack.svg'
        }
    ]
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getkolla.com/kolla/developer-resources/web-sdk-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
