Ainda estamos construindo coisas aqui! Você pode notar algumas arestas ásperas enquanto trabalhamos em melhorias. Ajude-nos a melhorar relatando bugs aqui.

Guia Rápido

Incorpore o widget e obtenha um token de widget do servidor.

Visão Geral do Widget

O aplicativo widget está hospedado em widget.companin.tech e fornece uma maneira fácil de incorporar um assistente de IA em seu site. Para começar, você precisará criar um assistente e um aplicativo OAuth.

The widget is a lightweight, self-contained application that runs in an isolated iframe on your website. This architecture ensures that the widget won't conflict with your existing CSS or JavaScript, while maintaining excellent performance and security.

⚡ Quick Deployment

Most developers have the widget running on their site within 10 minutes. The setup process involves just three steps: creating credentials, configuring appearance, and adding a single script tag to your HTML.

1. Criar um Assistente

Primeiro, crie um assistente de IA em seu painel de controle:

Your assistant is the AI brain behind the widget. It processes user messages, maintains conversation context, and generates intelligent responses. Each assistant can be customized with specific instructions, personality traits, and knowledge bases to match your use case.

  1. Vá ao seu painel de controle e navegue para a página "Data Sources"
  2. Clique no botão "Add" na seção Assistants
  3. Preencha os detalhes do assistente (nome, descrição, tom, etc.)
  4. Salve o assistente e anote o ID

Tip: Give your assistant clear, specific instructions about its role and limitations. For example: "You are a helpful customer support assistant for a SaaS product. You can answer questions about features, pricing, and account management. For technical issues, direct users to create a support ticket."

2. Criar um Aplicativo OAuth

Crie um aplicativo OAuth para autenticar seu widget:

  1. Vá para a página "OAuth" em seu painel de controle
  2. Clique em "Create Application"
  3. Preencha o nome e a descrição do aplicativo
  4. Copie o client_id do aplicativo criado

3. Incorporar o Widget via Iframe

A forma mais simples de integrar o widget é incorporá-lo diretamente usando um iframe. Este método não requer inicialização JavaScript e funciona imediatamente.

HTML5embed.html
<iframe  src="https://widget.companin.tech/embed/session?clientId=YOUR_CLIENT_ID&assistantId=YOUR_ASSISTANT_ID&configId=YOUR_CONFIG_ID&locale=en"  style="border: none; position: fixed; bottom: 20px; right: 20px; z-index: 999999; background-color: transparent; width: auto; height: auto; border-radius: 8px;"  title="AI Assistant Widget"></iframe>

Substitua YOUR_CLIENT_ID e YOUR_ASSISTANT_ID pelos seus valores reais. O parâmetro locale pode ser definido para corresponder ao idioma do seu site.

Avançado: Inicialização JavaScript

The recommended integration method is using our JavaScript widget loader, which provides automatic sizing, configuration management, and responsive behavior.

Script Integration

Add the following script tag to your HTML page:

HTML5index.html
<script  src="https://widget.companin.tech/widget.js"  data-client-id="YOUR_CLIENT_ID"  data-assistant-id="YOUR_ASSISTANT_ID"  data-config-id="YOUR_CONFIG_ID"  data-locale="en"  data-dev="false"></script>

Script Attributes

Each attribute serves a specific purpose in configuring your widget:

  • data-client-id: Your OAuth client ID - This authenticates your application with our API. Think of it as your app's password.
  • data-assistant-id: The UUID of your assistant - This identifies which AI assistant handles the conversations.
  • data-config-id: The UUID of your widget configuration - This determines how your widget looks and behaves (colors, size, position, etc.).
  • data-locale: Language code (e.g., "en", "es", "fr") - Sets the widget's display language. The assistant will still respond in any language users write in.
  • data-dev: Set to "true" for development mode (localhost) - Use this when testing locally. Remove or set to "false" for production.

The widget will automatically:

  • Fetch the configuration from the config ID
  • Size itself according to the widget dimensions in the config
  • Position the collapsed button based on the config settings
  • Start open or closed based on the config's start_open setting

Notas

  • The widget automatically manages its own sizing based on your configuration settings
  • The collapsed button position can be customized through the widget configuration
  • The widget respects the start_open setting from your configuration
  • All styling (colors, fonts, dimensions) is controlled through the widget configuration
  • The widget uses postMessage communication for responsive behavior
  • Development mode can be enabled with data-dev="true" for localhost testing