Web SDK Reference

Below are the public functions exposed on the Kolla Web SDK, Kolla.js. They are accessible at `window.kolla`.

.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.

.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)

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

Event TypeUsage .subscribe("[event_title]", fn)

Link Created

"onLinkCreated"

Link Disabled

"onLinkDisabled"

Marketplace Opened

"onMarketplaceOpened"

Marketplace Closed

"onMarketplaceClosed"

.getConsumer()

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

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.

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'
        }
    ]
}

Last updated