Skip to content

GleapSDK/Capacitor-SDK

Repository files navigation

Capacitor Gleap Plugin

Gleap SDK for Capacitor is the easiest way to integrate Gleap into your Ionic apps! Achieve better app quality with comprehensive in-app bug reporting & customer feedback for your web-apps and websites. Many thanks to Stephan Nagel (congrapp) for his work on the Gleap capacitor plugin.

This plugin supports capacitor 6. See the instructions below for earlier capacitor versions.

Install

npm install capacitor-gleap-plugin
npx cap sync

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.

API

initialize(...)

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

Initialize Gleap with an API key

Param Type
options { API_KEY: string; }

Returns: Promise<{ initialized: boolean; }>

Since: 7.0.0


identify(...)

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

Set user identity

Param Type
options { userId: string; userHash?: string; name?: string; email?: string; phone?: string; companyId?: string; companyName?: string; sla?: number; plan?: string; value?: number; customData?: Object; }

Returns: Promise<{ identify: boolean; }>

Since: 7.0.0


updateContact(...)

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

Update user properties

Param Type
options { name?: string; email?: string; phone?: string; companyId?: string; sla?: number; companyName?: string; plan?: string; value?: number; customData?: Object; }

Returns: Promise<{ identify: boolean; }>

Since: 13.2.1


clearIdentity()

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

Clear user identity

Returns: Promise<{ clearIdentity: boolean; }>

Since: 7.0.0


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


setAiTools(...)

setAiTools(options: { tools: { name: string; description: string; response: string; executionType: "auto" | "button"; parameters: { name: string; description: string; type: "string" | "number" | "boolean"; required: boolean; enums?: string[]; }[]; }[]; }) => Promise<{ aiToolsSet: boolean; }>

Sets the AI tools to use

Param Type
options { tools: { name: string; description: string; response: string; executionType: 'auto' | 'button'; parameters: { name: string; description: string; type: 'string' | 'number' | 'boolean'; required: boolean; enums?: string[]; }[]; }[]; }

Returns: Promise<{ aiToolsSet: boolean; }>

Since: 13.5.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


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


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


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


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


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


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

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


Interfaces

Object

Provides functionality common to all JavaScript objects.

Prop Type Description
constructor Function The initial value of Object.prototype.constructor is the standard built-in Object constructor.
Method Signature Description
toString () => string Returns a string representation of an object.
toLocaleString () => string Returns a date converted to a string using the current locale.
valueOf () => Object Returns the primitive value of the specified object.
hasOwnProperty (v: PropertyKey) => boolean Determines whether an object has a property with the specified name.
isPrototypeOf (v: Object) => boolean Determines whether an object exists in another object's prototype chain.
propertyIsEnumerable (v: PropertyKey) => boolean Determines whether a specified property is enumerable.

Function

Creates a new function.

Prop Type
prototype any
length number
arguments any
caller Function
Method Signature Description
apply (this: Function, thisArg: any, argArray?: any) => any Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
call (this: Function, thisArg: any, ...argArray: any[]) => any Calls a method of an object, substituting another object for the current object.
bind (this: Function, thisArg: any, ...argArray: any[]) => any For a given function, creates a bound function that has the same body as the original function. The this object of the bound function is associated with the specified object, and has the specified initial parameters.
toString () => string Returns a string representation of a function.

GleapEventMessage

Prop Type
name string
data any

Boolean

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

Type Aliases

PropertyKey

string | number | symbol

GleapEventCallback

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

CallbackID

string