Skip to content

About

Capacitor and Ionic SDK for Gleap, an Intercom alternative with AI customer support, live chat, in-app bug reporting and customer feedback.

Topics

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Gleap Capacitor and Ionic SDK

Add AI-native customer support, live chat, in-app bug reporting, a help center and surveys to your Capacitor and Ionic apps with Gleap. Gleap is an Intercom alternative for software teams that connects customer conversations and feedback with product development.

This plugin supports Capacitor 7 and later (iOS via Swift Package Manager or CocoaPods). See the instructions below for earlier Capacitor versions.

Thanks to Stephan Nagel (congrapp) for his work on the Gleap Capacitor plugin.

SDK documentation · Website · Plans and pricing

Install

npm install capacitor-gleap-plugin
npx cap sync

iOS

The plugin needs Capacitor 7 or later and an iOS deployment target of 15.0 or higher. On iOS it is a Swift package (Package.swift) and pulls the native Gleap iOS SDK from GitHub; it still ships a podspec for apps that use CocoaPods.

Swift Package Manager (recommended). New apps: npx cap add ios --packagemanager SPM. Existing CocoaPods apps can move with npx cap spm-migration-assistant once all their plugins support SPM (see Capacitor: Swift Package Manager). Set the app target's iOS deployment target to 15.0 in Xcode, then run npx cap sync ios again so CapApp-SPM/Package.swift declares iOS 15 as well (the plugin's package requires it).

CocoaPods. Set platform :ios, '15.0' in ios/App/Podfile and run npx cap sync ios. CocoaPods trunk becomes read-only on December 2, 2026, so Gleap iOS SDK versions released after that date are not on trunk. For those, pod install fails with None of your spec sources contain Gleap (= X.Y.Z); add the SDK from GitHub to your app target in the Podfile, with the version the plugin requires (s.dependency 'Gleap', 'X.Y.Z' in node_modules/capacitor-gleap-plugin/CapacitorGleapPlugin.podspec):

target 'App' do
  capacitor_pods
  # Add your Pods here
  pod 'Gleap', :git => 'https://github.com/GleapSDK/Gleap-iOS-SDK.git', :tag => '19.5.0'
end

Swift Package Manager is the recommended setup: after December 2, 2026 new Gleap iOS SDK versions are only released through GitHub and Swift Package Manager.

Initialize

import { Gleap } from "capacitor-gleap-plugin";

await Gleap.initialize({ projectId: "YOUR_PROJECT_ID" });

Find the Project ID in the Gleap dashboard under Settings → Project → General. It was formerly called "API key" / "SDK key": existing values keep working, and the deprecated initialize({ API_KEY: "..." }) still takes the same value.

setUserJwtProvider can be called before or after initialize.

Capacitor 6

Please install the plugin version from our capacitor-v6 brunch with npm install GleapSDK/Capacitor-SDK#capacitor-v6 --save if you are using capacitor 6.

Capacitor 5

Please install the plugin version from our capacitor-v5 brunch with npm install GleapSDK/Capacitor-SDK#capacitor-v5 --save if you are using capacitor 5.

Capacitor 4 or earlier

Please install the plugin version from our capacitor-v4 brunch with npm install GleapSDK/Capacitor-SDK#capacitor-v4 --save if you are using capacitor 4 or earlier.

Data regions

Gleap projects live in a data region. The SDK talks to the EU region by default. If your project is hosted in the US region, set the region before calling initialize:

import { Gleap } from "capacitor-gleap-plugin";

await Gleap.setRegion({ region: "us" });
await Gleap.initialize({ projectId: "YOUR_PROJECT_ID" });

setRegion sets the API, websocket and realtime hosts at once (supported regions: "eu" and "us"). The static widget hosts (frame, banner, modal) are global and are not changed by the region.

For self-hosted or custom setups you can override single hosts with setApiUrl({ url }), setWSApiUrl({ url }), setRealtimeHost({ host }), setFrameUrl({ url }), setBannerUrl({ url }) and setModalUrl({ url }). All of them must be called before initialize; a manual setter called after setRegion overrides that single host.

Env data

With every ticket the SDK sends env data (device, OS, screen size, locale, URL, …), shown under the Env data tab in Gleap. Leave out individual keys or stop collecting env data entirely:

await Gleap.setEnvDataPropsToIgnore({ propsToIgnore: ["deviceName", "batteryLevel"] });
await Gleap.setDisableEnvData({ disableEnvData: true });

Both can be called at any time and apply to the next ticket. Each setEnvDataPropsToIgnore call replaces the previous list, an empty array resets it. setDisableEnvData({ disableEnvData: false }) turns the collection back on.

Dark mode

Switch the widget between dark and light mode. auto follows the device appearance (on web: the page theme); if your app has its own theme toggle, pass light or dark explicitly and call it again whenever the theme changes:

await Gleap.setColorScheme({ colorScheme: "auto" });
await Gleap.setColorScheme({ colorScheme: isDarkTheme ? "dark" : "light", darkBackgroundColor: "#121212" });

setColorScheme only takes effect when "Adapt to dark / light mode" is enabled in the Gleap dashboard; it then overrides the dashboard's color scheme. Before the first call the dashboard setting applies. In dark mode the widget uses the dark mode colors, logo, header image and composer glow set in the Gleap dashboard; without dark colors it keeps its normal colors. lightBackgroundColor / darkBackgroundColor override the background in light / dark mode. Can be called before or after initialize.

Inline banners

On Android and iOS, inline banners (the banner style set in the Gleap dashboard) are drawn natively at the top of the screen, over the WebView, and cover the status bar. To push your page down below them instead of covering it, like inline banners on the web, pad the page by the banner's height. It arrives as the banner-height-changed event, in CSS pixels from the top edge (0 when no inline banner is shown; floating banners stay at 0):

const applyBannerHeight = (height: number) =>
  document.documentElement.style.setProperty("--gleap-banner-height", `${height}px`);

await Gleap.setEventCallback((message) => {
  if (message?.name === "banner-height-changed") {
    applyBannerHeight(message.data);
  }
});
await Gleap.initialize({ projectId: "YOUR_PROJECT_ID" });
applyBannerHeight((await Gleap.getBannerHeight()).height);
body {
  /* The banner covers the status bar, so it replaces the top safe-area inset while shown. */
  padding-top: max(var(--gleap-banner-height, 0px), env(safe-area-inset-top));
  transition: padding-top 0.25s ease-out;
}

Without this, nothing changes: banners overlay the app as before. On the web the Gleap web SDK pushes the page down itself.

Customer identity (JWT)

Sign your users in with an identity token: a short HS256 JWT your backend signs with an identity key from Settings → Security → Customer identity → Identity keys (put the key id in the kid header; the secret never leaves your server). The userId claim is required. Optional claims: email, name, company ({ id, name }), plan, and provider ids such as stripeCustomerId. Set exp to at most one hour. Everything in the token lands on the contact as signed data the app cannot change. Pass the token to the SDK with setUserJwt after login and on every app start of a logged-in user; no separate identify call is needed, and setUserJwt keeps the token in memory only. The optional setUserJwtProvider returns a fresh token: it renews the session when the token expires and, from 19.5.0, also restores the signed session after an app restart. Call clearIdentity on logout. setAuthTokens hands Kai your own API tokens for this user. See Customer identity and Capacitor SDK: user identity.

Pass an object: Gleap.setUserJwt({ token }), not Gleap.setUserJwt(token). Like every method of this plugin, it takes one options object. The provider is the exception: it returns the bare token string (or null).

import { Gleap } from "capacitor-gleap-plugin";

// After login and on every app start of a logged-in user (token from your backend)
await Gleap.setUserJwt({ token });

// Optional: return a fresh token when the current one has expired or is about to
Gleap.setUserJwtProvider(async () => {
  const response = await fetch("https://api.example.com/gleap-token", {
    headers: { Authorization: `Bearer ${accessToken}` },
  });
  const { token } = await response.json();
  return token;
});

// Optional: shorten the signed session (milliseconds)
await Gleap.setSessionDuration({ milliseconds: 24 * 60 * 60 * 1000 });

// Optional: tokens API tools may use to call your backend as this user (null removes one)
await Gleap.setAuthTokens({ tokens: { backend: accessToken } });

// On logout
await Gleap.clearIdentity();

The provider runs in JavaScript: when the native SDK needs a fresh token it sends the userJwtExpired event, and the plugin calls your provider and hands the token back; the native SDK then sends the identify again with it.

setSessionDuration(ms) shortens the signed session; the project's maximum applies.

identify({ userId, ... }) without a token creates an unsigned contact. Older integrations that pass a user hash to identify keep working; see Upgrade to identity tokens.

Protected conversation files

With "Protect new files" (Settings → Security → Conversation files, see Authenticated conversation files), conversation files can only be opened by agents and by the verified customer the conversation belongs to. Sign the customer in with an identity token (Gleap.setUserJwt) on every app start.

Email replies link attachments to your customer application URL with a gleapFile query parameter. If that URL opens your app (universal link / App Link), pass it to Gleap; the conversation opens once the customer is signed in:

import { App } from "@capacitor/app";

const launch = await App.getLaunchUrl();
if (launch?.url) {
  await Gleap.openProtectedFileFromUrl({ url: launch.url });
}
App.addListener("appUrlOpen", ({ url }) => {
  Gleap.openProtectedFileFromUrl({ url });
});

openProtectedFileFromUrl resolves { opened: false } when the URL has no valid gleapFile parameter. On web the JavaScript SDK opens ?gleapFile= links on page load by itself.

API

initialize(...)

initialize(options: GleapInitializeOptions) => Promise<{ initialized: boolean; }>

Initialize Gleap with your Project ID: initialize({ projectId: "YOUR_PROJECT_ID" }). Find it in the Gleap dashboard under Settings → Project → General. It was formerly called "API key" / "SDK key": existing values keep working, and the deprecated { API_KEY } still takes the same value.

Param Type
options GleapInitializeOptions

Returns: Promise<{ initialized: boolean; }>

Since: 7.0.0


setRegion(...)

setRegion(options: { region: 'eu' | 'us'; }) => Promise<{ region: string; }>

Set the data region of your Gleap project ("eu" is the default). Sets the API, websocket and realtime hosts at once. Must be called before initialize. A manual setter (setApiUrl, setWSApiUrl, setRealtimeHost) called afterwards overrides that single host.

Param Type
options { region: 'eu' | 'us'; }

Returns: Promise<{ region: string; }>

Since: 18.0.0


setApiUrl(...)

setApiUrl(options: { url: string; }) => Promise<{ url: string; }>

Set a custom API url. Must be called before initialize.

Param Type
options { url: string; }

Returns: Promise<{ url: string; }>

Since: 18.0.0


setWSApiUrl(...)

setWSApiUrl(options: { url: string; }) => Promise<{ url: string; }>

Set a custom websocket API url. Must be called before initialize.

Param Type
options { url: string; }

Returns: Promise<{ url: string; }>

Since: 18.0.0


setRealtimeHost(...)

setRealtimeHost(options: { host: string; }) => Promise<{ host: string; }>

Set a custom realtime host (hostname only, without protocol or path). Must be called before initialize.

Param Type
options { host: string; }

Returns: Promise<{ host: string; }>

Since: 18.0.0


setFrameUrl(...)

setFrameUrl(options: { url: string; }) => Promise<{ url: string; }>

Set a custom widget frame url. Must be called before initialize.

Param Type
options { url: string; }

Returns: Promise<{ url: string; }>

Since: 18.0.0


setBannerUrl(...)

setBannerUrl(options: { url: string; }) => Promise<{ url: string; }>

Set a custom banner url. Must be called before initialize.

Param Type
options { url: string; }

Returns: Promise<{ url: string; }>

Since: 18.0.0


setModalUrl(...)

setModalUrl(options: { url: string; }) => Promise<{ url: string; }>

Set a custom modal url. Must be called before initialize.

Param Type
options { url: string; }

Returns: Promise<{ url: string; }>

Since: 18.0.0


identify(...)

identify(options: { userId: string; userHash?: string; name?: string; email?: string; phone?: string; companyId?: string; companyName?: string; avatar?: string; sla?: number; plan?: string; value?: number; customData?: Record<string, any>; }) => Promise<{ identify: boolean; }>

Identifies the user with contact data only: without an identity token this is an unsigned contact. To sign the user in, pass an identity token with setUserJwt; no separate identify call is needed then. Older integrations that pass a userHash keep working; see Upgrade to identity tokens (https://docs.gleap.ai/en/articles/16752008-upgrade-to-identity-tokens).

Param Type
options { userId: string; userHash?: string; name?: string; email?: string; phone?: string; companyId?: string; companyName?: string; avatar?: string; sla?: number; plan?: string; value?: number; customData?: Record<string, any>; }

Returns: Promise<{ identify: boolean; }>

Since: 7.0.0


updateContact(...)

updateContact(options: { name?: string; email?: string; phone?: string; companyId?: string; companyName?: string; avatar?: string; sla?: number; plan?: string; value?: number; customData?: Record<string, any>; }) => Promise<{ identify: boolean; }>

Update user properties

Param Type
options { name?: string; email?: string; phone?: string; companyId?: string; companyName?: string; avatar?: string; sla?: number; plan?: string; value?: number; customData?: Record<string, any>; }

Returns: Promise<{ identify: boolean; }>

Since: 13.2.1


clearIdentity()

clearIdentity() => Promise<{ clearIdentity: boolean; }>

Clear user identity: the contact, its identity token and auth tokens. Call it on logout. The JWT provider stays set.

Returns: Promise<{ clearIdentity: boolean; }>

Since: 7.0.0


setUserJwt(...)

setUserJwt(options: { token: string; }) => Promise<void>

Identifies the user with an identity token: an HS256 JWT your backend signs with an identity key (Settings → Security → Customer identity → Identity keys). The token is the whole identify: its userId (or user_id) claim names the user and every other claim lands on the contact as signed data; no other contact field is sent, and no separate identify call is needed. Call it after login and on every app start of a logged-in user, and clearIdentity on logout. Kept in memory only and sent again when it says something new (another claim or key). A token that is not a JWT, has no user id or is over 4096 characters is refused with a log line and nothing is sent. Takes an object: { token }, not the bare string. Resolves once the native (or JavaScript) SDK has the token. See Customer identity (https://docs.gleap.ai/en/articles/709-customer-identity).

Param Type
options { token: string; }

setSessionDuration(...)

setSessionDuration(options: { milliseconds: number; }) => Promise<void>

Shortens how long a signed session stays signed, in milliseconds. Sent with every identify; the project's maximum (Settings > Security) applies when yours is longer. Call it before setUserJwt (on web, before initialize, because the JavaScript SDK takes it as an initialize option). 0 or less goes back to the project's maximum.

Param Type
options { milliseconds: number; }

setUserJwtProvider(...)

setUserJwtProvider(provider: GleapUserJwtProvider | null) => Promise<void>

Sets the function that fetches a fresh identity token from your backend. Gleap calls it when the server answers that the token expired (and retries once with the new token), and before it renews the file access or sends the identify again when the token expires within 5 minutes. One call at a time; a call without an answer within 10 seconds counts as failed, and after a failure Gleap waits 30 seconds before it asks again. Return null (or throw) when fetching failed. With the native SDKs 19.5.0 (and the Gleap JavaScript SDK 19.6.0 on web) it also restores the signed session after an app restart (on web, a page reload). clearIdentity keeps the provider; pass null to remove it. The provider runs in JavaScript: the plugin answers the userJwtExpired event for you.

Param Type
provider GleapUserJwtProvider | null

setAuthTokens(...)

setAuthTokens(options: { tokens: Record<string, string | null>; }) => Promise<void>

Stores per-user tokens on the signed contact that your API tools may send to your backend on this user's behalf ({{session.authTokens.&lt;name&gt;}}). Each call replaces the named tokens; a null value removes one. Names start with a letter and use letters, digits, _ and - (at most 40 characters). Needs a signed identity (setUserJwt). Kept in memory only and sent again after the next signed identify on a new session.

Param Type
options { tokens: Record<string, string | null>; }

addListener('userJwtExpired', ...)

addListener(eventName: 'userJwtExpired', listenerFunc: (data: { requestId: string; }) => void) => Promise<PluginListenerHandle>

Called when the native (or JavaScript) SDK needs a fresh identity token. setUserJwtProvider listens for you and answers it for you.

Param Type
eventName 'userJwtExpired'
listenerFunc (data: { requestId: string; }) => void

Returns: Promise<PluginListenerHandle>


getIdentity()

getIdentity() => Promise<{ identity: { userId: string; name?: string; email?: string; phone?: string; value?: number; }; }>

Get the current user identity

Returns: Promise<{ identity: { userId: string; name?: string; email?: string; phone?: string; value?: number; }; }>

Since: 8.1.0


isUserIdentified()

isUserIdentified() => Promise<{ isUserIdentified: boolean; }>

User identified status.

Returns: Promise<{ isUserIdentified: boolean; }>

Since: 8.1.0


log(...)

log(options: { message: string; logLevel?: "ERROR" | "WARNING" | "INFO"; }) => Promise<{ logged: boolean; }>

Submit a custom log message with the given level

Param Type
options { message: string; logLevel?: 'ERROR' | 'WARNING' | 'INFO'; }

Returns: Promise<{ logged: boolean; }>

Since: 7.0.0


showSurvey(...)

showSurvey(options: { surveyId: string; format?: "survey" | "survey_full"; }) => Promise<{ opened: boolean; }>

Manually show a survey.

Param Type
options { surveyId: string; format?: 'survey' | 'survey_full'; }

Returns: Promise<{ opened: boolean; }>

Since: 8.5.1


attachCustomData(...)

attachCustomData(options: { data: any; }) => Promise<{ attachedCustomData: boolean; }>

Add custom data

Param Type
options { data: any; }

Returns: Promise<{ attachedCustomData: boolean; }>

Since: 7.0.0


setTags(...)

setTags(options: { tags: string[]; }) => Promise<{ tagsSet: boolean; }>

Set tags

Param Type
options { tags: string[]; }

Returns: Promise<{ tagsSet: boolean; }>

Since: 8.6.0


setNetworkLogsBlacklist(...)

setNetworkLogsBlacklist(options: { blacklist: string[]; }) => Promise<{ blacklistSet: boolean; }>

Set network logs blacklist

Param Type
options { blacklist: string[]; }

Returns: Promise<{ blacklistSet: boolean; }>

Since: 13.2.1


setNetworkLogPropsToIgnore(...)

setNetworkLogPropsToIgnore(options: { propsToIgnore: string[]; }) => Promise<{ propsToIgnoreSet: boolean; }>

Set network logs props to ignore

Param Type
options { propsToIgnore: string[]; }

Returns: Promise<{ propsToIgnoreSet: boolean; }>

Since: 13.2.1


attachNetworkLogs(...)

attachNetworkLogs(options: { logs: GleapNetworkLogEntry[]; }) => Promise<{ networkLogsAttached: boolean; }>

Hands the network requests made inside the app's WebView (fetch and XMLHttpRequest) to the native SDK, so they show up in the network logs of tickets. The plugin calls this for you on iOS and Android; each call replaces the previously attached WebView network logs. No-op on web, where the JavaScript SDK records requests itself.

Param Type
options { logs: GleapNetworkLogEntry[]; }

Returns: Promise<{ networkLogsAttached: boolean; }>

Since: 19.0.0


attachConsoleLogs(...)

attachConsoleLogs(options: { logs: GleapConsoleLogEntry[]; }) => Promise<{ consoleLogsAttached: boolean; }>

Hands the console output of the app's WebView (console.log/info/warn/error/debug, uncaught errors and unhandled promise rejections) to the native SDK, so it shows up in the console logs of tickets. The plugin calls this for you on iOS and Android; each call replaces the previously attached WebView console logs. No-op on web, where the JavaScript SDK records the console itself.

Param Type
options { logs: GleapConsoleLogEntry[]; }

Returns: Promise<{ consoleLogsAttached: boolean; }>

Since: 19.0.0


logsFlushed(...)

logsFlushed(options: { flushId: string; }) => Promise<void>

Answers a flushLogs event once the WebView console and network logs the plugin buffers were handed to the native SDK, so it collects the logs for a capture request with them. The plugin calls this for you on iOS and Android. No-op on web.

Param Type
options { flushId: string; }

Since: 19.1.0


setEnvDataPropsToIgnore(...)

setEnvDataPropsToIgnore(options: { propsToIgnore: string[]; }) => Promise<{ envDataPropsToIgnoreSet: boolean; }>

Set env data props to ignore. The given env data keys (exact and case-sensitive, e.g. "deviceName" or "currentUrl") are removed before a ticket or conversation is sent. Each call replaces the previous list, an empty list resets it. Can be called before or after initialize.

Param Type
options { propsToIgnore: string[]; }

Returns: Promise<{ envDataPropsToIgnoreSet: boolean; }>

Since: 18.1.0


registerAgentTool(...)

registerAgentTool(options: { name: string; }) => Promise<void>

Registers a Frontend tool defined on your AI agent in the Gleap dashboard. Prefer the registerAgentTool(name, handler) helper exported by this package — it wires the agentToolExecution event and result round-trip for you.

Param Type
options { name: string; }

Since: 15.0.0


sendAgentToolResult(...)

sendAgentToolResult(options: { executionId: string; result: string; }) => Promise<void>

Resolves a pending agent tool execution with the handler's result. Used by the registerAgentTool(name, handler) helper.

Param Type
options { executionId: string; result: string; }

Since: 15.0.0


addListener('agentToolExecution', ...)

addListener(eventName: 'agentToolExecution', listenerFunc: (data: { executionId: string; name: string; params: any; }) => void) => Promise<PluginListenerHandle>

Called when a registered agent tool should execute.

Param Type
eventName 'agentToolExecution'
listenerFunc (data: { executionId: string; name: string; params: any; }) => void

Returns: Promise<PluginListenerHandle>

Since: 15.0.0


addListener('logConfigLoaded', ...)

addListener(eventName: 'logConfigLoaded', listenerFunc: (config: GleapLogConfig) => void) => Promise<PluginListenerHandle>

Called on iOS and Android when the project config is loaded, with the network log settings the plugin's WebView log capture needs (network logs are only recorded when they are enabled for your project).

Param Type
eventName 'logConfigLoaded'
listenerFunc (config: GleapLogConfig) => void

Returns: Promise<PluginListenerHandle>

Since: 19.0.0


addListener('flushLogs', ...)

addListener(eventName: 'flushLogs', listenerFunc: (data: { flushId: string; }) => void) => Promise<PluginListenerHandle>

Called on iOS and Android right before the native SDK collects the logs for a capture request: the plugin's WebView log capture hands over what it buffers (it pushes at most every 500 ms otherwise) and answers with logsFlushed. The native SDK waits at most 500 ms for the answer. The plugin listens for you.

Param Type
eventName 'flushLogs'
listenerFunc (data: { flushId: string; }) => void

Returns: Promise<PluginListenerHandle>

Since: 19.1.0


setTicketAttribute(...)

setTicketAttribute(options: { key: string; value: string; }) => Promise<{ setTicketAttribute: boolean; }>

Sets the value of a ticket attribute

Param Type
options { key: string; value: string; }

Returns: Promise<{ setTicketAttribute: boolean; }>

Since: 13.5.0


unsetTicketAttribute(...)

unsetTicketAttribute(options: { key: string; }) => Promise<{ unsetTicketAttribute: boolean; }>

Unset a ticket attribute

Param Type
options { key: string; }

Returns: Promise<{ unsetTicketAttribute: boolean; }>

Since: 14.1.0


clearTicketAttributes()

clearTicketAttributes() => Promise<{ clearTicketAttributes: boolean; }>

Clear all ticket attributes

Returns: Promise<{ clearTicketAttributes: boolean; }>

Since: 14.1.0


setCustomData(...)

setCustomData(options: { key: string; value: string; }) => Promise<{ setCustomData: boolean; }>

Set custom data

Param Type
options { key: string; value: string; }

Returns: Promise<{ setCustomData: boolean; }>

Since: 7.0.0


removeCustomData(...)

removeCustomData(options: { key: string; }) => Promise<{ removedCustomData: boolean; }>

Remove custom data by key

Param Type
options { key: string; }

Returns: Promise<{ removedCustomData: boolean; }>

Since: 7.0.0


clearCustomData()

clearCustomData() => Promise<{ clearedCustomData: boolean; }>

Clear custom data

Returns: Promise<{ clearedCustomData: boolean; }>

Since: 7.0.0


trackEvent(...)

trackEvent(options: { name: string; data?: any; }) => Promise<{ loggedEvent: boolean; }>

Log event to Gleap

Param Type
options { name: string; data?: any; }

Returns: Promise<{ loggedEvent: boolean; }>

Since: 8.0.0


trackPage(...)

trackPage(options: { pageName: string; }) => Promise<{ trackedPage: boolean; }>

Track a page view

Param Type
options { pageName: string; }

Returns: Promise<{ trackedPage: boolean; }>

Since: 8.4.1


setEventCallback(...)

setEventCallback(callback: GleapEventCallback) => Promise<CallbackID>
Param Type
callback GleapEventCallback

Returns: Promise<string>

Since: 7.0.0


sendSilentCrashReport(...)

sendSilentCrashReport(options: { description: string; severity?: "LOW" | "MEDIUM" | "HIGH"; dataExclusion?: { customData: Boolean; metaData: Boolean; attachments: Boolean; consoleLog: Boolean; networkLogs: Boolean; customEventLog: Boolean; screenshot: Boolean; replays: Boolean; }; }) => Promise<{ sentSilentBugReport: boolean; }>

Log event to Gleap

Param Type
options { description: string; severity?: 'LOW' | 'MEDIUM' | 'HIGH'; dataExclusion?: { customData: Boolean; metaData: Boolean; attachments: Boolean; consoleLog: Boolean; networkLogs: Boolean; customEventLog: Boolean; screenshot: Boolean; replays: Boolean; }; }

Returns: Promise<{ sentSilentBugReport: boolean; }>

Since: 7.0.0


preFillForm(...)

preFillForm(options: { data: any; }) => Promise<{ preFilledForm: boolean; }>

Prefills the widget's form data

Param Type
options { data: any; }

Returns: Promise<{ preFilledForm: boolean; }>

Since: 7.0.0


addAttachment(...)

addAttachment(options: { base64data: string; name: string; }) => Promise<{ attachmentAdded: boolean; }>

Add attachment as bas64 string

Param Type
options { base64data: string; name: string; }

Returns: Promise<{ attachmentAdded: boolean; }>

Since: 7.0.0


removeAllAttachments()

removeAllAttachments() => Promise<{ allAttachmentsRemoved: boolean; }>

All attachments removed

Returns: Promise<{ allAttachmentsRemoved: boolean; }>

Since: 7.0.0


open()

open() => Promise<{ openedWidget: boolean; }>

Open widget

Returns: Promise<{ openedWidget: boolean; }>

Since: 7.0.0


openChecklists(...)

openChecklists(options: { showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Open checklists

Param Type
options { showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 19.0.0


openChecklist(...)

openChecklist(options: { checklistId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Open checklist

Param Type
options { checklistId: string; showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 19.0.0


startChecklist(...)

startChecklist(options: { outboundId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Start checklist

Param Type
options { outboundId: string; showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 19.0.0


openNews(...)

openNews(options: { showBackButton?: boolean; }) => Promise<{ openedNews: boolean; }>

Open news

Param Type
options { showBackButton?: boolean; }

Returns: Promise<{ openedNews: boolean; }>

Since: 8.4.0


openNewsArticle(...)

openNewsArticle(options: { articleId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Open news article

Param Type
options { articleId: string; showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 8.4.0


openHelpCenter(...)

openHelpCenter(options: { showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Open help center

Param Type
options { showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 8.4.0


openHelpCenterArticle(...)

openHelpCenterArticle(options: { articleId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Open help center article

Param Type
options { articleId: string; showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 8.4.0


askAI(...)

askAI(options: { question: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Ask the AI a question

Param Type
options { question: string; showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 15.0.0


openHelpCenterCollection(...)

openHelpCenterCollection(options: { collectionId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Open help center collection

Param Type
options { collectionId: string; showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 8.4.0


searchHelpCenter(...)

searchHelpCenter(options: { term: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>

Search help center

Param Type
options { term: string; showBackButton?: boolean; }

Returns: Promise<{ opened: boolean; }>

Since: 8.4.0


openFeatureRequests(...)

openFeatureRequests(options: { showBackButton?: boolean; }) => Promise<{ openedFeatureRequests: boolean; }>

Open feature requests

Param Type
options { showBackButton?: boolean; }

Returns: Promise<{ openedFeatureRequests: boolean; }>

Since: 8.4.0


close()

close() => Promise<{ closedWidget: boolean; }>

Close widget

Returns: Promise<{ closedWidget: boolean; }>

Since: 7.0.0


isOpened()

isOpened() => Promise<{ isOpened: boolean; }>

Check widget status code

Returns: Promise<{ isOpened: boolean; }>

Since: 7.0.0


getBannerHeight()

getBannerHeight() => Promise<{ height: number; }>

The space the shown inline banner takes at the top of the screen, in CSS pixels from the top edge (the banner covers the status bar), 0 when none is shown. Floating banners stay at 0. Changes arrive as the banner-height-changed event of setEventCallback (data: the height); pad your page by it to keep it below inline banners. Web: always 0, the web SDK pushes the page down itself.

Returns: Promise<{ height: number; }>

Since: 19.3.0


startFeedbackFlow(...)

startFeedbackFlow(options: { feedbackFlow?: string; showBackButton?: boolean; }) => Promise<{ startedFeedbackFlow: boolean; }>

Start feedback flow

Param Type
options { feedbackFlow?: string; showBackButton?: boolean; }

Returns: Promise<{ startedFeedbackFlow: boolean; }>

Since: 7.0.0


startClassicForm(...)

startClassicForm(options: { formId?: string; showBackButton?: boolean; }) => Promise<{ classicFormStarted: boolean; }>

Start a classic form

Param Type
options { formId?: string; showBackButton?: boolean; }

Returns: Promise<{ classicFormStarted: boolean; }>

Since: 13.1.0


startConversation(...)

startConversation(options: { showBackButton?: boolean; }) => Promise<{ conversationStarted: boolean; }>

Start a new conversation

Param Type
options { showBackButton?: boolean; }

Returns: Promise<{ conversationStarted: boolean; }>

Since: 13.1.0


openConversation(...)

openConversation(options: { showBackButton?: boolean; }) => Promise<{ conversationsOpened: boolean; }>

Opens the conversations tab.

Param Type
options { showBackButton?: boolean; }

Returns: Promise<{ conversationsOpened: boolean; }>

Since: 13.9.0


openConversations(...)

openConversations(options: { showBackButton?: boolean; }) => Promise<{ conversationsOpened: boolean; }>

Opens the conversations tab (same as openConversation).

Param Type
options { showBackButton?: boolean; }

Returns: Promise<{ conversationsOpened: boolean; }>

Since: 19.0.0


openProtectedFileFromUrl(...)

openProtectedFileFromUrl(options: { url: string; }) => Promise<{ opened: boolean; }>

Open the conversation of a protected file from an emailed link. With "Protect new files" on (Settings → Security → Conversation files), email replies link attachments to your customer application URL with a gleapFile query parameter. If that URL opens your app (for example as a universal link / App Link), pass it here, e.g. from App.addListener('appUrlOpen') or App.getLaunchUrl() of @capacitor/app. opened is true when the URL carries a Gleap file reference. The conversation opens once the customer is signed in with an identity token (setUserJwt); the link alone grants nothing. On web the JavaScript SDK handles ?gleapFile= automatically on page load, so this resolves { opened: false } there.

Param Type
options { url: string; }

Returns: Promise<{ opened: boolean; }>

Since: 19.0.1


startBot(...)

startBot(options: { botId?: string; showBackButton?: boolean; }) => Promise<{ startedBot: boolean; }>

Start bot

Param Type
options { botId?: string; showBackButton?: boolean; }

Returns: Promise<{ startedBot: boolean; }>

Since: 10.0.3


showFeedbackButton(...)

showFeedbackButton(options: { show?: boolean; }) => Promise<{ feedbackButtonShown: boolean; }>

Show or hide the feedback button.

Param Type
options { show?: boolean; }

Returns: Promise<{ feedbackButtonShown: boolean; }>

Since: 8.0.0


setDisableInAppNotifications(...)

setDisableInAppNotifications(options: { disableInAppNotifications?: boolean; }) => Promise<{ inAppNotificationsDisabled: boolean; }>

Disable in app notifications.

Param Type
options { disableInAppNotifications?: boolean; }

Returns: Promise<{ inAppNotificationsDisabled: boolean; }>

Since: 8.6.1


setDisableEnvData(...)

setDisableEnvData(options: { disableEnvData: boolean; }) => Promise<{ envDataDisabled: boolean; }>

Disable env data. While disabled (true), no env data (device, OS, screen size, locale, URL, ...) is collected and tickets are sent without it. Pass false to collect env data again. Can be called before or after initialize.

Param Type
options { disableEnvData: boolean; }

Returns: Promise<{ envDataDisabled: boolean; }>

Since: 18.1.0


setColorScheme(...)

setColorScheme(options: { colorScheme: 'auto' | 'light' | 'dark'; lightBackgroundColor?: string; darkBackgroundColor?: string; }) => Promise<{ colorScheme: string; }>

Set the color scheme of the widget. Overrides the color scheme configured in the Gleap dashboard. Only takes effect when "Adapt to dark / light mode" is enabled in the dashboard; otherwise the widget always keeps its normal colors. Before the first call the dashboard setting applies. "auto" follows the device appearance (dark/light mode) on iOS and Android, and the page theme on web. Apps with their own in-app theme toggle should pass "light" / "dark" explicitly and call it again whenever the theme changes. In dark mode the widget uses the dark mode colors, logo, header image and composer glow set in the Gleap dashboard; without dark colors it keeps its normal colors. lightBackgroundColor / darkBackgroundColor override the background. Can be called before or after initialize and applies live.

Param Type
options { colorScheme: 'auto' | 'light' | 'dark'; lightBackgroundColor?: string; darkBackgroundColor?: string; }

Returns: Promise<{ colorScheme: string; }>

Since: 19.0.0


setCaptureEnabled(...)

setCaptureEnabled(options: { enabled: boolean; }) => Promise<{ captureEnabled: boolean; }>

Enable or disable screenshots and screen recordings for capture requests: when a workflow, an AI agent or a teammate asks the user in the widget to show the issue, the widget steps aside, a small bar lets the user go to the right screen, and the SDK captures the app once they tap Capture (or records it between Start and Stop). Nothing is captured without that tap. While disabled, the widget only offers to upload a file. Enabled by default. Works on iOS, Android and web and can be called before or after initialize.

Param Type
options { enabled: boolean; }

Returns: Promise<{ captureEnabled: boolean; }>

Since: 19.1.0


setRemoteLogCollectionEnabled(...)

setRemoteLogCollectionEnabled(options: { enabled: boolean; }) => Promise<{ remoteLogCollectionEnabled: boolean; }>

Enable or disable sending the app's logs for capture requests: a workflow or an AI agent can ask for the logs while the app runs (no user action), and screenshots and recordings can bring the logs around them. The logs are what a bug report carries (console and network logs, custom data, env data, custom events; the replay only when it is asked for and enabled in the dashboard), and the existing settings still apply (e.g. setDisableEnvData). While disabled, log requests are answered as not supported and captures are sent without logs. Enabled by default. Works on iOS, Android and web and can be called before or after initialize.

Param Type
options { enabled: boolean; }

Returns: Promise<{ remoteLogCollectionEnabled: boolean; }>

Since: 19.1.0


setLanguage(...)

setLanguage(options: { languageCode: string; }) => Promise<{ setLanguage: string; }>

Set Language

Param Type
options { languageCode: string; }

Returns: Promise<{ setLanguage: string; }>

Since: 7.0.0


disableConsoleLogOverwrite()

disableConsoleLogOverwrite() => Promise<{ consoleLogDisabled: boolean; }>

Disable console log overwrite: stops recording the console output of the app's WebView (console methods are restored) and drops the WebView console logs recorded so far.

Returns: Promise<{ consoleLogDisabled: boolean; }>

Since: 7.0.0


enableDebugConsoleLog()

enableDebugConsoleLog() => Promise<{ debugConsoleLogEnabled: boolean; }>

Enable debug console log

Returns: Promise<{ debugConsoleLogEnabled: boolean; }>

Since: 7.0.0


setNotificationContainerOffset(...)

setNotificationContainerOffset(options: { x: number; y: number; }) => Promise<{ notificationContainerOffsetSet: boolean; }>

Set the notification container offset

Param Type
options { x: number; y: number; }

Returns: Promise<{ notificationContainerOffsetSet: boolean; }>

Since: 15.2.0


Interfaces

GleapInitializeOptions

Options for initialize: your Project ID as projectId (Gleap dashboard: Settings → Project → General). API_KEY is the former name of the same value and keeps working.

Prop Type Description
projectId string Your Project ID (formerly "SDK key" / "API key").
API_KEY string Former name of projectId (same value). Still accepted.

PluginListenerHandle

Prop Type
remove () => Promise<void>

GleapNetworkLogEntry

A network log entry (fetch / XMLHttpRequest) as the plugin hands it to the native SDK.

Prop Type Description
date string ISO-8601 UTC timestamp of the request start.
type string HTTP method, uppercase.
url string
duration number Milliseconds from the request start to the response headers (or the failure).
success boolean true when an HTTP response arrived (any status), false on a transport error, abort or timeout.
request { headers?: { [name: string]: string; }; payload?: string; }
response { status?: number; statusText?: string; headers?: { [name: string]: string; }; responseText?: string; errorText?: string; }

GleapConsoleLogEntry

A console log entry as the plugin hands it to the native SDK.

Prop Type Description
date string ISO-8601 UTC timestamp with milliseconds.
priority 'ERROR' | 'WARNING' | 'INFO'
log string

GleapLogConfig

The network log settings of your Gleap project, sent by the native SDK once its config is loaded.

Prop Type
enableNetworkLogs boolean
networkLogPropsToIgnore string[]
networkLogBlacklist string[]

GleapEventMessage

Prop Type
name string
data any

Boolean

Method Signature Description
valueOf () => boolean Returns the primitive value of the specified object.

Type Aliases

Record

Construct a type with a set of properties K of type T

{ [P in K]: T; }

GleapUserJwtProvider

Fetches a fresh identity token (JWT) from your backend; see setUserJwtProvider.

(): string | Promise<string | null> | null

GleapEventCallback

(message: GleapEventMessage | null, err?: any): void

CallbackID

string

About

Capacitor and Ionic SDK for Gleap, an Intercom alternative with AI customer support, live chat, in-app bug reporting and customer feedback.

Topics

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages