Embed SDK
Use our Embed SDK to interact with TeamAI chatbots embedded on your website.
Overview
Our Embed SDK lets you interact with TeamAI chatbots embedded on your web pages. It provides methods to update context and retrieve current context, giving you full control over your embedded chatbots.
If you embedded your chatbot before September 29, 2024, you may need to update the embed code on your website. The new embed code now includes the Embed SDK automatically.
To use the Embed SDK, ensure that you have the correct assistant ID and the appropriate plan.
Methods
Initialize Embed SDK
The SDK automatically initializes when the chatbot is embedded on your page. You don’t need to call an explicit init function.
Get Chatbot Instance
Retrieves an instance of the chatbot for interaction.
The unique identifier for your chatbot instance.
This method returns a chatbot instance that you can use to interact with your embedded chatbot.
Wait for Chatbot Ready State
Update Chatbot Context
Updates the context for your chatbot.
The new context data to update the chatbot with.
This method allows you to update the context for the chatbot dynamically. You can use these context variables in your assistant’s instructions like so: {{userEmail}}
.
Get Chatbot Context
Retrieves the current context of the chatbot.
This method returns the current context of the chatbot.
Example: Updating Context
In this example, we’re setting up the chatbot and updating the context with the user’s email and name.
Example: Updating Context
This example demonstrates how to set up the chatbot, log its readiness, and update its context programmatically.
Debug Mode
To enable debug mode in TeamAI, add ?teamAIDebug=true
to your app’s URL.
For example, if you’ve embedded your TeamAI instance in your app hosted at https://example.com, you can activate debug mode by changing the URL to:
After adding this parameter, refresh the page and open your browser’s developer console (usually by pressing F12 or right-clicking and selecting “Inspect” then navigating to the “Console” tab).
Was this page helpful?