Skip to main content
This package allows you to track server-side customer events.

Installation

Usage

Import the GleapAdmin package.

Initialize the SDK

It is required to initialize the GleapAdmin SDK before sending events or other requests.
The secret api token can be found within your project settings -> API.

Track an event

The userId should match the userId you are using to identify your users. The event data (last param) is optional.

Identify an user

The userId should match the userId you are using to identify your users. All key-value pairs in the user properties part are optional. The optional company object associates the user with a company. Only company.id is required — it is your own identifier for the company. The optional company.name is a fallback label and never overwrites a name you set authoritatively via updateCompany (see below).

Companies

Create, update, read and delete companies from your backend. Use these to set authoritative company attributes (plan, value, SLA, address and custom data) that are shown in the dashboard and used for company-level SLAs. Attributes set here are never overwritten by the fallback data sent from your client apps.

Create or update a company

The first argument is your own company id. It is immutable and cannot be changed afterwards. updateCompany creates the company on first use and updates it on subsequent calls. It returns the saved company, or null if the request failed.

Get a company

Returns the company, or null if it does not exist.

Delete a company

Permanently deletes the company. Its members (contacts) and their conversations are not deleted. Returns true on success.

Rate limit

Please note that the identify and track APIs enforce a rate limit of 1500 requests / 60 seconds per API token. If you exceed the limit, requests are rejected with 429 Too Many Requests and the token is blocked for a short period before requests are accepted again.