### Gleap SDK Start Product Tour
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Initiates a product tour to guide users through features.
```APIDOC
## Gleap SDK Start Product Tour
### Description
Starts an interactive product tour to guide users through specific features or workflows.
### Method
`Gleap.startProductTour(tourId: string)`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```javascript
Gleap.startProductTour('feature-tour-intro');
```
### Response
None
```
--------------------------------
### Gleap.initialize
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Initializes the Gleap SDK with a provided SDK key. This method must be called once before any other Gleap API methods. It handles the setup of the SDK, including starting the session manager, downloading configurations, injecting UI elements, and preparing the DOM.
```APIDOC
## Gleap.initialize(sdkKey, disablePing?)
### Description
Initializes the Gleap SDK with your SDK token. This is a mandatory step before using any other Gleap APIs. It sets up the core SDK functionalities, injects UI elements, and prepares the environment for Gleap's features.
### Method
`static initialize(sdkKey: string, disablePing?: boolean): void`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **sdkKey** (string) - Required - SDK token from Gleap dashboard
- **disablePing** (boolean) - Optional - Disable periodic session ping (defaults to false)
### Request Example
```javascript
Gleap.initialize('YOUR-SDK-TOKEN');
// Optional: Listen for initialization complete
Gleap.on('initialized', () => {
console.log('Gleap ready for use');
});
```
### Response
#### Success Response
This method does not return a value (`void`).
#### Response Example
None
```
--------------------------------
### Gleap SDK Start Bot
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Starts an interactive bot session.
```APIDOC
## Gleap SDK Start Bot
### Description
Starts a bot interaction session.
### Method
`Gleap.startBot()`
### Parameters
None
### Request Example
```javascript
Gleap.startBot();
```
### Response
None
```
--------------------------------
### Gleap SDK Start Agent
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Initiates a session with a live agent.
```APIDOC
## Gleap SDK Start Agent
### Description
Initiates a chat session with a live support agent.
### Method
`Gleap.startAgent()`
### Parameters
None
### Request Example
```javascript
Gleap.startAgent();
```
### Response
None
```
--------------------------------
### Gleap SDK Start Checklist
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Initiates a product checklist or onboarding tour.
```APIDOC
## Gleap SDK Start Checklist
### Description
Starts a predefined product checklist or onboarding tour for users.
### Method
`Gleap.startChecklist(checklistId: string)`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```javascript
Gleap.startChecklist('onboarding-checklist-1');
```
### Response
None
```
--------------------------------
### Start Feedback Flow with Gleap SDK
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Initiates a predefined feedback flow. Use this to guide users through specific feedback collection processes.
```javascript
Gleap.startFeedbackFlow('bug-report-form');
```
--------------------------------
### startProductTour
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Starts a product tour identified by the provided tour ID. This method is useful for guiding users through new features or workflows.
```APIDOC
## startProductTour(tourId)
### Description
Starts a product tour identified by the provided tour ID.
### Method
`static`
### Parameters
#### Path Parameters
- **tourId** (string) - Required - The unique identifier for the product tour to start.
### Request Example
```javascript
Gleap.startProductTour('new-feature-tour-2024');
```
```
--------------------------------
### Listen for Tour Started Event
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/events.md
Use this to execute code when a product tour begins. It can be triggered by starting a tour programmatically, via server-side initiation, or through a URL parameter.
```javascript
Gleap.on('tour-started', (tourId) => {
console.log('Tour started:', tourId);
});
```
--------------------------------
### Product Tours
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Methods for starting product tours.
```APIDOC
## startProductTour(tourId)
### Description
Starts a product tour identified by a tour ID.
### Method
static
### Parameters
- **tourId** (string) - Required - The ID of the product tour.
```
--------------------------------
### Start a Product Tour
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Use this method to initiate a specific product tour by its ID. Ensure the tour ID is valid.
```javascript
Gleap.startProductTour('new-feature-tour-2024');
```
--------------------------------
### Product Tours
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/INDEX.md
Method to start a product tour.
```APIDOC
## Product Tours
### `Gleap.startProductTour(tourId)`
**Description**: Start a product tour identified by `tourId`.
```
--------------------------------
### Install Gleap JS SDK via npm
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/README.md
Install the Gleap package using npm. This is the first step to integrating Gleap into your application.
```bash
npm install gleap --save
```
--------------------------------
### Initialize and Configure Custom Endpoints for On-Premises
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/configuration.md
Example of initializing the Gleap SDK and setting custom API and WebSocket endpoints for an on-premises deployment.
```javascript
Gleap.initialize('sdk-token');
Gleap.setApiUrl('https://gleap.company.com/api');
Gleap.setWSApiUrl('wss://gleap.company.com/ws');
```
--------------------------------
### Gleap SDK Start Network Logger
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Starts the network request logger.
```APIDOC
## Gleap SDK Start Network Logger
### Description
Activates the network request logger to capture outgoing HTTP requests.
### Method
`Gleap.startNetworkLogger()`
### Parameters
None
### Request Example
```javascript
Gleap.startNetworkLogger();
```
### Response
None
```
--------------------------------
### Product Tours
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Starts a product tour for the user.
```APIDOC
## startProductTour
### Description
Starts a product tour for the user.
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **tourId** (string) - Required - The ID of the product tour to start.
### Request Example
```javascript
Gleap.startProductTour('tour-ghi');
```
### Response
#### Success Response (200)
None
#### Response Example
None
```
--------------------------------
### Start a Feedback Form
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Initiates a feedback form with an optional back button. Use this to guide users through specific feedback flows defined in the Gleap dashboard.
```javascript
Gleap.startFeedbackFlow('bug-report-form');
Gleap.startFeedbackFlow('feature-request', true);
```
--------------------------------
### Gleap SDK Start Conversation
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Initiates a conversation with a bot or agent.
```APIDOC
## Gleap SDK Start Conversation
### Description
Initiates a conversation, potentially with a bot or agent.
### Method
`Gleap.startConversation()`
### Parameters
None
### Request Example
```javascript
Gleap.startConversation();
```
### Response
None
```
--------------------------------
### React Integration Example
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/GleapAgentChat.md
Demonstrates how to integrate Gleap Agent Chat into a React component, managing chat state and handling user messages.
```javascript
import { useState, useEffect } from 'react';
import Gleap from 'gleap';
function ChatComponent() {
const [messages, setMessages] = useState([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const [chat, setChat] = useState(null);
useEffect(() => {
const instance = Gleap.createAgentChat({
agentId: 'support-agent',
context: { userId: currentUser.id },
onChange: (state) => {
setMessages(state.messages);
setLoading(state.isExecuting);
},
onError: (err) => {
setError(err?.message || 'Chat error');
}
});
setChat(instance);
return () => instance.destroy();
}, []);
const handleSendMessage = async (text) => {
setError(null);
await chat.sendMessage(text);
};
return (
);
}
```
--------------------------------
### Vue Integration Example
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/GleapAgentChat.md
Demonstrates how to integrate Gleap Agent Chat into a Vue.js application using the Composition API.
```javascript
import { reactive, onBeforeUnmount } from 'vue';
import Gleap from 'gleap';
export default {
setup() {
const state = reactive({
messages: [],
isExecuting: false,
error: null,
conversationId: null,
chat: null
});
const chat = Gleap.createAgentChat({
agentId: 'support-agent',
onChange: (newState) => {
state.messages = newState.messages;
state.isExecuting = newState.isExecuting;
state.error = newState.error;
state.conversationId = newState.conversationId;
}
});
state.chat = chat;
const sendMessage = async (text) => {
await chat.sendMessage(text);
};
onBeforeUnmount(() => {
chat.destroy();
});
return { state, sendMessage };
}
};
```
--------------------------------
### startFeedbackFlow
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Starts a feedback form, with an option to display a back button for navigation.
```APIDOC
## startFeedbackFlow(feedbackFlow, showBackButton?)
### Description
Start a feedback form with optional back navigation.
### Method Signature
```javascript
static startFeedbackFlow(
feedbackFlow: string,
showBackButton?: boolean
): void
```
### Parameters
#### Path Parameters
* **feedbackFlow** (string) - Required - Feedback form ID from Gleap dashboard
* **showBackButton** (boolean) - Optional - Show back button in form (defaults to false)
### Request Example
```javascript
Gleap.startFeedbackFlow('bug-report-form');
Gleap.startFeedbackFlow('feature-request', true);
```
```
--------------------------------
### Checklist Management
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Starts or opens a checklist for the user.
```APIDOC
## startChecklist
### Description
Starts or opens a checklist for the user.
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **checklistId** (string) - Optional - The ID of the checklist to start.
### Request Example
```javascript
Gleap.startChecklist('checklist-789');
```
### Response
#### Success Response (200)
None
#### Response Example
None
```
```APIDOC
## openChecklist
### Description
Opens an existing checklist for the user.
### Method
GET (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **checklistId** (string) - Required - The ID of the checklist to open.
### Request Example
```javascript
Gleap.openChecklist('checklist-abc');
```
### Response
#### Success Response (200)
None
#### Response Example
None
```
--------------------------------
### TypeScript Configuration Interface and Usage
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/configuration.md
Defines the GleapConfig interface for strongly-typed configuration and shows a basic usage example.
```typescript
interface GleapConfig {
sdkKey: string;
apiUrl?: string;
wsApiUrl?: string;
frameUrl?: string;
environment?: 'dev' | 'staging' | 'prod';
useCookies?: boolean;
disableLocalStorage?: boolean;
disablePageTracking?: boolean;
disableInAppNotifications?: boolean;
offlineMode?: boolean;
language?: string;
replayOptions?: ReplayOptions;
styles?: StylesConfig;
customData?: Record;
tags?: string[];
appVersion?: string;
appBuild?: string;
}
// Usage
const config: GleapConfig = {
sdkKey: 'token',
environment: 'prod',
useCookies: true
};
Gleap.initialize(config.sdkKey);
// Apply config...
```
--------------------------------
### Listen for Feedback Flow Start
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/events.md
Fired when a feedback flow (form) is initiated. Use this to log or perform actions when a feedback flow begins.
```javascript
Gleap.on('flow-started', () => {
console.log('Feedback flow started');
});
```
--------------------------------
### Gleap SDK Start Feedback Flow
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Initiates a specific feedback form flow using its unique ID.
```APIDOC
## Gleap SDK Start Feedback Flow
### Description
Starts a predefined feedback form flow identified by its ID.
### Method
`Gleap.startFeedbackFlow(flowId: string)`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```javascript
Gleap.startFeedbackFlow('feedback-form-id');
```
### Response
None
```
--------------------------------
### Resume Conversation Example
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/GleapAgentChat.md
Shows how to save and resume a Gleap Agent Chat conversation using a conversation ID.
```javascript
// Save conversation ID after first message
let savedConversationId = null;
const chat = Gleap.createAgentChat({
agentId: 'support-agent',
onConversationCreated: (conversationId) => {
savedConversationId = conversationId;
localStorage.setItem('agent_conv_id', conversationId);
}
});
await chat.sendMessage('Hello');
// Later, create a new instance and resume
const resumedChat = Gleap.createAgentChat({
agentId: 'support-agent',
conversationId: savedConversationId
});
await resumedChat.sendMessage('How is my issue?');
// Messages include full history
```
--------------------------------
### AgentStartOptions Type Definition
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/types.md
Defines the options for starting an agent conversation. Used with Gleap.startAgent().
```typescript
{
context?: any;
initialQuestion?: string;
initialMessage?: string;
}
```
--------------------------------
### Start Network Logger
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Enable automatic logging of network requests. Call this method to begin capturing network activity.
```javascript
Gleap.startNetworkLogger();
```
--------------------------------
### startConversation
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Starts a new chat conversation. Optionally, a back button can be displayed.
```APIDOC
## startConversation(showBackButton?)
### Description
Starts a new chat conversation. Optionally, a back button can be displayed.
### Method
static startConversation
### Parameters
#### Query Parameters
- **showBackButton** (boolean) - Optional - Indicates whether to show the back button.
### Request Example
```javascript
Gleap.startConversation(true);
```
```
--------------------------------
### startAgent
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Starts an agent conversation in the AI chatbar, allowing users to interact with a specific agent. You can provide initial context, a question, or a greeting message.
```APIDOC
## startAgent(agentId, options?)
### Description
Start an agent conversation in the AI chatbar.
### Method
`static`
### Parameters
#### Path Parameters
- **agentId** (string) - Required - Agent ID to converse with
#### Query Parameters
- **options.context** (any) - Optional - Additional context for agent
- **options.initialQuestion** (string) - Optional - Customer question to answer
- **options.initialMessage** (string) - Optional - Agent greeting message
### Request Example
```javascript
Gleap.startAgent('my-support-agent', {
context: { page: '/dashboard', userId: '123' },
initialQuestion: 'How do I reset my password?',
initialMessage: 'Hi! I can help with that.'
});
```
```
--------------------------------
### startBot
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Starts a conversation with a specific bot, identified by its ID. A back button can optionally be shown.
```APIDOC
## startBot(botId, showBackButton?)
### Description
Starts a conversation with a specific bot, identified by its ID. A back button can optionally be shown.
### Method
static startBot
### Parameters
#### Path Parameters
- **botId** (string) - Required - Bot ID from Gleap dashboard
#### Query Parameters
- **showBackButton** (boolean) - Optional - Show back button
### Request Example
```javascript
Gleap.startBot('support-bot-123');
```
```
--------------------------------
### Cancel Streaming Example
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/GleapAgentChat.md
Demonstrates how to cancel an ongoing streaming response from the agent and retrieve the partial response.
```javascript
let isCancelled = false;
const handleCancel = () => {
isCancelled = true;
chat.cancelStream();
};
await chat.sendMessage('Tell me a very long story...');
if (isCancelled) {
const state = chat.getState();
console.log('Partial response:', state.messages.at(-1).content);
}
```
--------------------------------
### GleapAgentChat Constructor Example
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/GleapAgentChat.md
Initialize GleapAgentChat with agent ID, context, and callback functions for state changes, errors, and conversation creation. This is useful for setting up a new chat session or resuming an existing one.
```javascript
const chat = new GleapAgentChat({
agentId: 'support-bot-123',
context: {
accountId: 'acc-456',
currentPage: '/dashboard'
},
onChange: (state) => {
updateUI(state.messages, state.isExecuting);
},
onError: (error) => {
showErrorAlert(error.message);
},
onConversationCreated: (convId) => {
saveConversationId(convId);
}
});
```
--------------------------------
### Start an Agent Conversation
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Initiates a conversation with a specified agent. You can provide additional context, an initial question, or a greeting message.
```javascript
Gleap.startAgent('my-support-agent', {
context: { page: '/dashboard', userId: '123' },
initialQuestion: 'How do I reset my password?',
initialMessage: 'Hi! I can help with that.'
});
```
--------------------------------
### Listen for Gleap SDK Events
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Subscribes to various SDK events to react to specific occurrences. Examples include initialization, agent replies, and tool executions.
```javascript
Gleap.on('initialized', () => console.log('Ready'));
Gleap.on('agent-reply-received', (data) => console.log(data.response));
Gleap.on('agent-tool-executed', ({ name, result }) => console.log(name, result));
```
--------------------------------
### Start Classic Feedback Form
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Displays a standard feedback form identified by its ID. An optional parameter can be used to show a back button.
```javascript
Gleap.startClassicForm('classic-bug-form', true);
```
--------------------------------
### Listen to Gleap SDK Events
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/INDEX.md
Subscribe to various SDK events to trigger actions based on Gleap's lifecycle and user interactions. Examples include initialization, widget opening, and receiving agent replies.
```javascript
Gleap.on('initialized', () => {
console.log('Gleap is ready');
});
Gleap.on('open', () => {
console.log('Widget opened');
});
Gleap.on('agent-reply-received', (data) => {
console.log('Agent responded:', data);
});
```
--------------------------------
### Start Network Logger
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/configuration.md
Enable automatic logging of network requests and responses. You can also set the maximum number of requests to store, exclude specific URLs, and ignore sensitive properties in logs.
```javascript
// Enable automatic request/response logging
Gleap.startNetworkLogger();
```
```javascript
// Limit network logs to the last N requests
Gleap.setMaxNetworkRequests(50);
```
```javascript
// Exclude URLs from logging
Gleap.setNetworkLogsBlacklist([
'https://analytics.google.com',
'https://api.segment.com',
'https://cdn.cloudflare.com'
]);
```
```javascript
// Ignore specific properties in all logs
Gleap.setNetworkLogPropsToIgnore([
'authorization',
'x-api-key',
'cookie',
'x-auth-token'
]);
```
```javascript
// Manually attach network logs from external source
const logs = JSON.stringify([
{ method: 'GET', url: '/api/users', status: 200 }
]);
Gleap.attachNetworkLogs(logs);
```
--------------------------------
### Sync Conversation State with Gleap Events
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/events.md
Manage and synchronize conversation state by listening for 'agent-conversation-created' and 'close' events. This example stores the current and last conversation IDs in local storage.
```javascript
let currentConversation = null;
Gleap.on('agent-conversation-created', (conversationId) => {
currentConversation = conversationId;
localStorage.setItem('gleap_conv', conversationId);
});
Gleap.on('close', () => {
if (currentConversation) {
localStorage.setItem('gleap_last_conv', currentConversation);
}
});
```
--------------------------------
### Initialize Gleap SDK
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/demo/appwidget.html
Initialize the Gleap SDK with your application's credentials. Ensure these are correctly entered to establish a connection.
```javascript
Gleap.initialize( "TRiC1FmOEt2N6KCUiLIetFHyyGyxfXYV", "6477c829-9ac4-4aea-9f8b-a8132526090a", "89f304ee71e5eaf1463fbca1c9e058f0ad199e8238f3194719920e986a9fde9f" );
```
--------------------------------
### Start Bot Conversation
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Starts a conversation with a specific bot.
```APIDOC
## startBot
### Description
Starts a conversation with a specific bot.
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **botId** (string) - Required - The ID of the bot to start the conversation with.
### Request Example
```javascript
Gleap.startBot('bot-456');
```
### Response
#### Success Response (200)
None (operation is asynchronous)
#### Response Example
None
```
--------------------------------
### Complete Gleap SDK Initialization
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/configuration.md
Initialize the Gleap SDK with a token, configure custom endpoints, set environment, manage session persistence, enable monitoring, configure replay, customize UI, set language, disable features, set app metadata, and identify the user. Listen for the 'initialized' event.
```javascript
import Gleap from 'gleap';
// Initialize with SDK token
Gleap.initialize('sdk-abc123xyz');
// Configure endpoints for custom deployment
Gleap.setApiUrl('https://gleap.company.com/api');
Gleap.setWSApiUrl('wss://gleap.company.com/ws');
// Set environment
Gleap.setEnvironment('prod');
// Configure session persistence
Gleap.setUseCookies(true);
// Enable monitoring
Gleap.startNetworkLogger();
Gleap.setMaxNetworkRequests(100);
Gleap.setNetworkLogsBlacklist([
'https://analytics.google.com',
'https://sentry.io'
]);
// Configure replay
Gleap.setReplayOptions({
maskAllInputs: true,
recordAfter: 'DOMContentLoaded'
});
// Customize UI
Gleap.setStyles({
primaryColor: '#007AFF',
headerColor: '#003D82',
buttonColor: '#FF9500',
backgroundColor: '#FFFFFF'
});
// Set language
Gleap.setLanguage('en');
// Disable features if needed
Gleap.setDisablePageTracking(false);
Gleap.enableShortcuts(true);
// Set app metadata
Gleap.setAppVersionCode('1.0.0');
Gleap.setAppBuildNumber('123');
// Identify user when available
Gleap.identify('user-123', {
name: 'John Doe',
email: 'john@example.com',
companyId: 'acme-inc',
plan: 'enterprise'
});
// Listen for ready
Gleap.on('initialized', () => {
console.log('Gleap is ready');
});
```
--------------------------------
### AgentStartOptions
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/types.md
Options for initiating an agent conversation, including context, initial question, and greeting message.
```APIDOC
## AgentStartOptions
### Description
Options for starting agent conversation.
### Structure
```typescript
{
context?: any;
initialQuestion?: string;
initialMessage?: string;
}
```
### Fields
- **context** (any) - Additional context
- **initialQuestion** (string) - Customer question
- **initialMessage** (string) - Agent greeting
### Usage
- `Gleap.startAgent(agentId, options?)`
```
--------------------------------
### Initialize Gleap SDK and Identify User
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/INDEX.md
Initialize the SDK with your token and identify the current user with their details. This is typically done once when your application loads.
```javascript
Gleap.initialize('YOUR-SDK-TOKEN');
Gleap.identify('user123', {
name: 'John Doe',
email: 'john@example.com',
phone: '+1234567890',
plan: 'premium',
customData: { company: 'Acme Inc' }
});
```
--------------------------------
### Agent Conversations
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Starts a conversation with an agent.
```APIDOC
## startAgent
### Description
Starts a conversation with an agent.
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **options** (AgentStartOptions) - Optional - Configuration options for starting the agent conversation.
### Request Example
```javascript
Gleap.startAgent({ initialMessage: 'Hello there!' });
```
### Response
#### Success Response (200)
None (operation is asynchronous)
#### Response Example
None
```
--------------------------------
### Gleap SDK Initialization Order
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/configuration.md
Follow this recommended order for initializing the Gleap SDK and its various features.
```javascript
import Gleap from 'gleap';
Gleap.initialize('sdk-token');
```
```javascript
Gleap.setApiUrl(...);
Gleap.setWSApiUrl(...);
```
```javascript
Gleap.setEnvironment('prod');
Gleap.setUseCookies(true);
```
```javascript
Gleap.startNetworkLogger();
Gleap.setReplayOptions(...);
```
```javascript
Gleap.setStyles(...);
Gleap.setLanguage('en');
```
```javascript
Gleap.identify('user-id', {...});
```
```javascript
Gleap.on('initialized', ...);
```
--------------------------------
### Initialization
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Methods for initializing, destroying, and managing the Gleap SDK instance.
```APIDOC
## initialize(sdkKey, disablePing?)
### Description
Initializes the Gleap SDK with a provided SDK key. Optionally disables pinging.
### Method
static
### Parameters
- **sdkKey** (string) - Required - The SDK key for initialization.
- **disablePing** (boolean) - Optional - If true, disables pinging.
## destroy()
### Description
Destroys the Gleap SDK instance.
### Method
static
## getInstance()
### Description
Retrieves the singleton instance of the Gleap SDK.
### Method
static
## isOpened()
### Description
Checks if the Gleap SDK is currently opened.
### Method
static
### Returns
(boolean) - True if the SDK is opened, false otherwise.
```
--------------------------------
### Basic Conversations
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Starts a basic conversation with a bot.
```APIDOC
## startConversation
### Description
Starts a basic conversation with a bot.
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **botId** (string) - Optional - The ID of the bot to start the conversation with.
### Request Example
```javascript
Gleap.startConversation({ botId: 'bot-123' });
```
### Response
#### Success Response (200)
None (operation is asynchronous)
#### Response Example
None
```
--------------------------------
### open()
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Shows the main Gleap feedback widget/dashboard by setting the mode to 'widget' and displaying the iframe.
```APIDOC
## open()
### Description
Shows the main Gleap feedback widget/dashboard.
### Method
static open(): void
### Example
```javascript
Gleap.open();
```
```
--------------------------------
### SDK Documentation Structure
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/FILE-MANIFEST.md
Illustrates the hierarchical structure of the SDK documentation, showing how different files link to each other for comprehensive API reference.
```text
README.md (entry point)
├→ INDEX.md (overview)
├→ api-reference/Gleap.md (main API)
├→ api-reference/GleapAgentChat.md (headless chat)
├→ types.md (type definitions)
├→ configuration.md (setup)
└→ events.md (event system)
INDEX.md
├→ Configuration (session, endpoints, monitoring)
├→ Types (CustomerData, AgentChatOptions, etc.)
└→ Events (all 12 event types documented)
Gleap.md
├→ References GleapAgentChat for createAgentChat()
├→ Links to types.md for parameter definitions
├→ References events.md for event details
└→ Links to configuration.md for setup
GleapAgentChat.md
├→ References types.md for AgentChatState, etc.
├→ Links to events.md for onChange behavior
└→ Shows integration with Gleap.createAgentChat()
types.md
├→ Lists where each type is used (in Gleap.md)
├→ References configuration.md for options types
└→ Links to events.md for event payloads
configuration.md
├→ References Gleap.md for each configuration method
├→ Uses types.md for option signatures
└→ Links to events.md for feature-related events
events.md
├→ References Gleap.md for event registration
├→ Uses types.md for event payload definitions
└→ Links to configuration.md for setup
```
--------------------------------
### Network Logging
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Starts network request logging for debugging purposes.
```APIDOC
## startNetworkLogger
### Description
Starts network request logging for debugging purposes.
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```javascript
Gleap.startNetworkLogger();
```
### Response
#### Success Response (200)
None
#### Response Example
None
```
--------------------------------
### openHelpCenter
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Opens the main help center interface. An optional boolean parameter can be passed to control the visibility of the back button.
```APIDOC
## openHelpCenter(showBackButton?)
### Description
Opens the help center. The `showBackButton` parameter controls the visibility of the back button.
### Method Signature
`static openHelpCenter(showBackButton?: boolean): void`
### Parameters
* **showBackButton** (boolean) - Optional - If true, displays a back button in the help center interface.
### Example
```javascript
Gleap.openHelpCenter(true);
```
```
--------------------------------
### Configuration: Environment
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Sets the SDK environment (e.g., 'production', 'staging').
```APIDOC
## setEnvironment
### Description
Sets the SDK environment (e.g., 'production', 'staging').
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **environment** (string) - Required - The environment name.
### Request Example
```javascript
Gleap.setEnvironment('staging');
```
### Response
#### Success Response (200)
None
#### Response Example
None
```
--------------------------------
### Listen for SDK Initialization
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/events.md
Fired when the SDK has completed initialization and is ready for use. This is the appropriate time to call other Gleap APIs.
```javascript
Gleap.on('initialized', () => {
console.log('SDK is ready');
// Safe to call all APIs now
});
```
--------------------------------
### Initialization & Core Lifecycle
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/INDEX.md
Methods for initializing, managing, and destroying the Gleap SDK instance, as well as controlling the widget's visibility.
```APIDOC
## Initialization & Core Lifecycle
### `Gleap.initialize(sdkKey, disablePing?)`
**Description**: Initialize the SDK with your unique SDK key.
### `Gleap.destroy()`
**Description**: Tear down the SDK and clean up resources.
### `Gleap.getInstance()`
**Description**: Get the singleton instance of the Gleap SDK.
### `Gleap.isOpened()`
**Description**: Check if the Gleap widget is currently open.
### `Gleap.open()`
**Description**: Show the feedback widget.
### `Gleap.close(resetRoutes?)`
**Description**: Hide all dialogs and reset navigation if `resetRoutes` is true.
### `Gleap.hide()`
**Description**: Hide any currently open dialogs.
```
--------------------------------
### Gleap SDK Open Help Center
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Opens the Gleap Help Center interface.
```APIDOC
## Gleap SDK Open Help Center
### Description
Opens the integrated Gleap Help Center for users to find answers.
### Method
`Gleap.openHelpCenter()`
### Parameters
None
### Request Example
```javascript
Gleap.openHelpCenter();
```
### Response
None
```
--------------------------------
### Clear Agent Conversation State
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Removes any cached conversation state for agents. This is useful for starting fresh conversations.
```javascript
Gleap.clearAgentConversation();
```
--------------------------------
### Start a New Chat Conversation
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Initiates a new chat conversation with Gleap. Optionally displays a back button.
```javascript
Gleap.startConversation(true);
```
--------------------------------
### Gleap SDK Initialization
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/README.md
Basic initialization of the Gleap SDK using your unique SDK token.
```APIDOC
## Gleap SDK Initialization
### Description
Initializes the Gleap SDK with the provided SDK token.
### Method
`Gleap.initialize(sdkToken: string)`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```javascript
import Gleap from 'gleap';
Gleap.initialize('YOUR-SDK-TOKEN');
```
### Response
None
```
--------------------------------
### Quick Actions
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/GENERATION-REPORT.txt
Sets quick actions for the AI chatbar.
```APIDOC
## setAiChatbarQuickActions
### Description
Sets quick actions for the AI chatbar.
### Method
POST (or equivalent SDK method call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **actions** (array) - Required - An array of quick action objects.
### Request Example
```javascript
Gleap.setAiChatbarQuickActions([{ label: 'View FAQ', action: 'openHelpCenter' }]);
```
### Response
#### Success Response (200)
None
#### Response Example
None
```
--------------------------------
### Open Gleap Help Center
Source: https://github.com/gleapsdk/javascript-sdk/blob/master/_autodocs/api-reference/Gleap.md
Opens the main help center interface. Use this to provide users with access to your entire knowledge base. The `showBackButton` parameter controls the visibility of a back button.
```javascript
Gleap.openHelpCenter(true);
```