Quick Start Guide
Get your TekstiAI Widget up and running in 5 minutes!
Prerequisites
Before you begin, you'll need:
- A TekstiAI account with a valid
widget_id - Authentication credentials based on your widget's configuration:
- A JWT token (if configured for JWT authentication), OR
- A transport function implementation (if configured for proxy mode)
See Authentication for detailed information about both methods.
Installation
Include the widget script in your HTML using a script tag:
<script src="https://cdn.teksti.ai/widget/tekstiai-embed-widget-v2.1.0.js"></script>
info
The widget is distributed as a JavaScript file that you'll need to host on your own server or CDN. Contact your TekstiAI account manager for access to the widget files.
Basic Setup
Step 1: Add the Widget Element
Add the custom element to your HTML where you want the widget to appear:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My App with TekstiAI</title>
</head>
<body>
<!-- Your content -->
<!-- TekstiAI Widget -->
<tekstiai-widget></tekstiai-widget>
<!-- Widget script -->
<script src="https://cdn.teksti.ai/widget/tekstiai-embed-widget-v2.1.0.js"></script>
</body>
</html>
Step 2: Initialize the Widget
Add a script to initialize the widget with your configuration:
<script>
// Wait for the widget to load
document.addEventListener("DOMContentLoaded", function () {
window.TekstiAI("boot", {
container: "tekstiai-widget",
widget_id: "your-widget-id-here",
token: "your-jwt-token-here",
});
});
</script>
Step 3: Style the Container (Optional)
Control the widget's size and position with CSS:
<style>
tekstiai-widget {
display: block;
width: 400px;
height: 600px;
border-radius: 16px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
/* For mobile */
@media (max-width: 768px) {
tekstiai-widget {
width: 100%;
height: 100vh;
border-radius: 0;
}
}
</style>
Complete Example
Here's a complete, working example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TekstiAI Widget Demo</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, sans-serif;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
tekstiai-widget {
display: block;
width: 400px;
height: 600px;
border-radius: 16px;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
@media (max-width: 768px) {
body {
padding: 0;
}
tekstiai-widget {
width: 100%;
height: 100vh;
border-radius: 0;
}
}
</style>
</head>
<body>
<tekstiai-widget></tekstiai-widget>
<script src="https://cdn.teksti.ai/widget/tekstiai-embed-widget-v2.1.0.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
window.TekstiAI("boot", {
widget_id: "your-widget-id-here",
token: "your-jwt-token-here",
});
});
</script>
</body>
</html>
Next Steps
Now that you have the basic widget running:
- Secure Your Integration - Learn about authentication options for production
- Customize the Experience - Explore advanced configuration
Common Issues
Widget Doesn't Appear
Make sure:
- The script is loaded before calling
window.TekstiAI() - The
containervalue matches your element:tekstiai-widget - Your
widget_idis correct
Authentication Errors
Verify:
- Your JWT token is valid and not expired
- Your widget ID matches your TekstiAI account
- Network requests aren't blocked by CORS or ad blockers