๐Ÿค– Chatbot
โš™๏ธ Customization
Widget

YourGPT Chatbot SDK Documentation

Overview

This document provides a comprehensive guide on how to use the YourGPTChatbot SDK. The SDK offers a set of functions to interact with the chatbot, allowing you to customize its behavior and integrate it seamlessly into your application.

๐Ÿ“

The YourGPTChatbot SDK is designed to be easy to use and highly customizable. Make sure to initialize the SDK before using any of its functions.

Functions

on(event, callback)

This function allows you to listen to events from the chatbot.

javascript
๐Ÿ“

Common events include "init", "chatbotPopup", "messageReceived", and "chatClosed". Refer to the Events section for a complete list.

execute(command)

This function allows you to execute commands on the chatbot.

javascript
๐Ÿ“

Use execute() to programmatically control the chatbot's behavior, such as opening or closing the chat window.

set(key, value)

This function allows you to set data for the visitor or the session.

javascript
๐Ÿ“

Use the "visitor:data" prefix for persistent user data and "session:data" for temporary session information.

off(event, callback)

This function allows you to stop listening to events from the chatbot.

javascript
๐Ÿ“

Always remove event listeners when they are no longer needed to prevent memory leaks and unexpected behavior.

Best Practices

  1. Initialize the SDK as early as possible in your application lifecycle.
  2. Keep sensitive information out of visitor and session data.

For more detailed information and advanced usage, please refer to our API Reference documentation.