
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@glossaai/chat-sdk
Advanced tools
Glossa AI Chat SDK for web applications - Support for Angular, React, Vue, PHP (Laravel, Symfony, CodeIgniter), and Vanilla JavaScript
JavaScript/TypeScript SDK for embedding Glossa AI chat widgets in your web applications. Supports React, Vue, Angular, PHP (Laravel, Symfony, CodeIgniter), and Vanilla JavaScript.
⚠️ IMPORTANT: This is a Paid Service
To use the Glossa Chat SDK, you must first purchase a bot subscription through the Glossa website to obtain your uniquebotCode. The SDK requires an active subscription and valid bot credentials to function.
Before installing the SDK, you need:
botCode from the Glossa customer panelnpm install @glossaai/chat-sdk
yarn add @glossaai/chat-sdk
<script src="https://unpkg.com/@glossaai/chat-sdk/dist/@glossaai/chat-sdk.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@glossaai/chat-sdk/dist/@glossaai/chat-sdk.css">
<script src="https://unpkg.com/@glossaai/chat-sdk/dist/glossa-chat-sdk.umd.js"></script>
<script>
window.GlossaChat.init({
botCode: 'your-bot-code',
chatServiceUrl: 'https://panel.glossaai.ir'
});
</script>
import { useEffect } from 'react';
import '@glossaai/chat-sdk/styles';
declare global {
interface Window {
GlossaChat: any;
}
}
function App() {
useEffect(() => {
import('@glossaai/chat-sdk').then(() => {
window.GlossaChat?.initReact({
botCode: 'your-bot-code',
chatServiceUrl: 'https://panel.glossaai.ir'
});
});
return () => {
if (window.GlossaChat?.isOpen) {
window.GlossaChat.closeChat();
}
};
}, []);
return <div>Your App</div>;
}
<template>
<div>Your App</div>
</template>
<script>
import '@glossaai/chat-sdk/styles';
export default {
mounted() {
import('@glossaai/chat-sdk').then(() => {
window.GlossaChat?.initVue({
botCode: 'your-bot-code',
chatServiceUrl: 'https://panel.glossaai.ir'
});
});
},
beforeUnmount() {
if (window.GlossaChat?.isOpen) {
window.GlossaChat.closeChat();
}
}
};
</script>
import { Component, OnInit, OnDestroy } from '@angular/core';
import '@glossaai/chat-sdk/styles';
declare global {
interface Window {
GlossaChat: any;
GlossaAngularService: any;
}
}
@Component({
selector: 'app-root',
standalone: true,
template: '<router-outlet />' // SDK automatically adds the widget
})
export class AppComponent implements OnInit, OnDestroy {
ngOnInit() {
// SDK automatically adds the widget to document.body
import('@glossaai/chat-sdk').then(() => {
window.GlossaChat?.initAngular({
botCode: 'your-bot-code', // Required: 11-character bot code
chatServiceUrl: 'https://panel.glossaai.ir' // Optional: defaults to this
});
});
}
ngOnDestroy() {
if (window.GlossaChat?.isOpen) {
window.GlossaChat.closeChat();
}
}
}
import { Component, OnInit, OnDestroy } from '@angular/core';
import '@glossaai/chat-sdk/styles';
declare global {
interface Window {
GlossaChat: any;
GlossaAngularService: any;
}
}
@Component({
selector: 'app-root',
template: '<router-outlet></router-outlet>'
})
export class AppComponent implements OnInit, OnDestroy {
ngOnInit() {
import('@glossaai/chat-sdk').then(() => {
window.GlossaChat?.initAngular({
botCode: 'your-bot-code',
chatServiceUrl: 'https://panel.glossaai.ir'
});
});
}
ngOnDestroy() {
if (window.GlossaChat?.isOpen) {
window.GlossaChat.closeChat();
}
}
}
Important: The SDK automatically adds the chat widget to the corner of the page. No special template is needed for the widget.
<!-- resources/views/layouts/app.blade.php -->
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/@glossaai/chat-sdk/src/styles/chat-widget.css">
</head>
<body>
@yield('content')
<script src="https://unpkg.com/@glossaai/chat-sdk/dist/glossa-chat-sdk.umd.js"></script>
<script>
window.GlossaChat.init({
botCode: '{{ config("chat.bot_code") }}',
chatServiceUrl: '{{ config("chat.service_url") }}'
// primaryColor and other bot settings are loaded from API automatically
}).then(function(result) {
if (result.success) {
console.log('Chat SDK initialized');
}
});
</script>
</body>
</html>
{
// Required
botCode: string; // Your bot code (11 characters, obtained from Glossa panel)
// Optional
chatServiceUrl?: string; // Chat service URL (default: 'https://panel.glossaai.ir')
// Note: The following settings are loaded from bot API automatically:
// - primaryColor: Bot's primary color (from bot settings in panel)
// - position: Widget position (from bot settings)
// - welcomeMessage: Welcome message (from bot settings)
// - showAvatar: Show/hide avatar (from bot settings)
// - avatarUrl: Bot avatar URL (from bot settings)
// - name: Bot name (from bot settings)
}
Important: Your botCode must be valid and associated with an active subscription. Invalid or expired bot codes will result in initialization errors.
// Initialize (use framework-specific method)
await window.GlossaChat.initAngular(config); // Angular
await window.GlossaChat.initReact(config); // React
await window.GlossaChat.initVue(config); // Vue
await window.GlossaChat.init(config); // Vanilla JS
// Control chat
window.GlossaChat.openChat();
window.GlossaChat.closeChat();
window.GlossaChat.toggleChat();
// Send message
window.GlossaChat.sendMessage('Hello!');
// Get info
const sessionId = window.GlossaChat.getSessionId();
const isInit = window.GlossaChat.isInitialized;
const isOpen = window.GlossaChat.isOpen;
Monitor chat state through properties:
if (window.GlossaChat.isInitialized) {
console.log('SDK is ready');
}
if (window.GlossaChat.isOpen) {
console.log('Chat is open');
}
The SDK includes all styles and fonts bundled. Simply import the styles:
// ✅ Recommended: Import styles (includes fonts automatically)
import '@glossaai/chat-sdk/styles';
// ✅ Alternative: Import CSS file directly
import '@glossaai/chat-sdk/styles.css';
Important:
You can override default styles:
/* Override default styles */
.glossa-chat-container {
/* Your custom styles */
}
.glossa-chat-button {
background-color: your-color !important;
}
.glossa-chat-panel {
/* Custom chat panel styles */
}
The SDK uses Vazirmatn font for Persian/Arabic text support. Fonts are:
Check the /examples directory for complete examples:
npm install
# Production build (both UMD and ESM)
npm run build
# Development build
npm run build:dev
# Watch mode
npm run dev
npm test
npm run lint
This SDK works with the Glossa Chat Service and integrates with the full Glossa AI Platform.
Set the chatServiceUrl to your chat service endpoint:
{
chatServiceUrl: 'https://panel.glossaai.ir' // Production (default)
// or
chatServiceUrl: 'http://localhost:3001' // Development
}
The Glossa platform consists of:
Critical: You must configure allowed domains in your bot settings:
https://example.com (no trailing slash)*) is not allowed for securityRequests from domains not in your allowed list will be blocked by CORS policy.
The SDK includes built-in TypeScript type definitions. No manual type declarations needed!
When you install the SDK, TypeScript automatically recognizes the types:
// ✅ Just import - types are automatically available
import GlossaChatSDK from '@glossaai/chat-sdk';
const sdk = new GlossaChatSDK();
// ✅ Full autocomplete and type checking
await sdk.init({ botCode: 'your-bot-code' });
The SDK provides complete type definitions for:
import GlossaChatSDK, { SDKConfig, InitResult } from '@glossaai/chat-sdk';
const config: SDKConfig = {
botCode: 'your-bot-code',
chatServiceUrl: 'https://panel.glossaai.ir'
};
const sdk = new GlossaChatSDK();
const result: InitResult = await sdk.init(config);
if (result.success) {
console.log('SDK initialized:', result.message);
} else {
console.error('Initialization failed:', result.error);
}
If you're using the global window.GlossaChat instance, you can optionally extend the Window interface:
declare global {
interface Window {
GlossaChat: InstanceType<typeof import('@glossaai/chat-sdk').default>;
GlossaAngularService?: any;
GlossaReactHook?: any;
GlossaVuePlugin?: any;
}
}
Note: This is optional. The SDK's built-in types work automatically when importing the module.
botCode is correct (11 characters)console.log(window.GlossaChat)Most common issue! If you see:
Access to fetch has been blocked by CORS policy
Solutions:
https://example.com not https://example.com/)https://panel.glossaai.ir)WhatsApp Integration:
Telegram/Bale/Eitaa:
MIT License - see LICENSE file for details
Glossa AI Platform provides comprehensive multi-platform support:
Glossa Chat SDK is a paid service with the following features:
Visit glossaai.ir for:
See CHANGELOG.md for complete version history.
You can configure the SDK without writing any JavaScript code. The SDK will automatically detect and initialize using one of these methods:
<script
src="https://unpkg.com/@glossaai/chat-sdk/dist/glossa-chat-sdk.umd.js"
data-bot-code="your-bot-code"
data-chat-service-url="https://panel.glossaai.ir">
</script>
<!-- Note: Bot settings (primaryColor, welcomeMessage, etc.) are loaded from API -->
<head>
<meta name="glossa-bot-code" content="your-bot-code">
<meta name="glossa-chat-service-url" content="https://panel.glossaai.ir">
<!-- Note: primaryColor and other bot settings come from API, not from meta tags -->
</head>
<script>
window.GLOSSA_CONFIG = {
botCode: 'your-bot-code',
chatServiceUrl: 'https://panel.glossaai.ir'
// Note: primaryColor is loaded from bot API, not from this config
};
</script>
<script src="...glossa-chat-sdk.umd.js"></script>
Important Notes:
init() manually.primaryColor, welcomeMessage, position, avatarUrl, etc. are automatically loaded from the bot API based on the botCode. You don't need to configure them manually.botCode and chatServiceUrl can be configured. All other settings come from your bot configuration in the Glossa panel.FAQs
Glossa AI Chat SDK for web applications - Support for Angular, React, Vue, PHP (Laravel, Symfony, CodeIgniter), and Vanilla JavaScript
The npm package @glossaai/chat-sdk receives a total of 40 weekly downloads. As such, @glossaai/chat-sdk popularity was classified as not popular.
We found that @glossaai/chat-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.