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.
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.
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.
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.
Always remove event listeners when they are no longer needed to prevent memory leaks and unexpected behavior.
Best Practices
- Initialize the SDK as early as possible in your application lifecycle.
- Keep sensitive information out of visitor and session data.
For more detailed information and advanced usage, please refer to our API Reference documentation.