npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cti-chat-widget

v1.2.2

Published

Professional & fully customizable chat widget for n8n workflows. Works with React, Angular, Vue, and any web application.

Readme

n8n Chat Widget

Professional & fully customizable chat widget for n8n workflows. Works with React, Angular, Vue, and any web application.

Features

  • Framework Agnostic - Works with React, Angular, Vue, plain HTML, Wix, WordPress, Shopify, and more
  • Shadow DOM - Complete style isolation, no CSS conflicts
  • Fully Customizable - Colors, fonts, sizes, positions, branding
  • Persistent History - Conversations saved in browser storage
  • Mobile Responsive - Works beautifully on all devices
  • TypeScript Support - Full type definitions included
  • Lightweight - Small bundle size, no dependencies

Installation

NPM

npm install cti-chat-widget

CDN / Script Tag

<script src="https://cdn.jsdelivr.net/npm/cti-chat-widget/dist/chat-widget.js"></script>

Quick Start

Script Tag (HTML, Wix, WordPress, etc.)

<script src="https://cdn.jsdelivr.net/npm/cti-chat-widget/dist/chat-widget.js"></script>
<script>
  ChatWidget.init({
    apiUrl: 'https://your-n8n.com/webhook/chat',
    title: 'AI Assistant',
    primaryColor: '#6366f1'
  });
</script>

React

import { useEffect } from 'react';
import ChatWidget from 'cti-chat-widget';

function App() {
  useEffect(() => {
    ChatWidget.init({
      apiUrl: 'https://your-n8n.com/webhook/chat',
      title: 'AI Assistant'
    });

    return () => ChatWidget.destroy();
  }, []);

  return <div>Your App</div>;
}

Angular

import { Component, OnInit, OnDestroy } from '@angular/core';
import ChatWidget from 'cti-chat-widget';

@Component({
  selector: 'app-root',
  template: '<router-outlet></router-outlet>'
})
export class AppComponent implements OnInit, OnDestroy {
  ngOnInit() {
    ChatWidget.init({
      apiUrl: 'https://your-n8n.com/webhook/chat'
    });
  }

  ngOnDestroy() {
    ChatWidget.destroy();
  }
}

Vue

<script>
import ChatWidget from 'cti-chat-widget';

export default {
  mounted() {
    ChatWidget.init({
      apiUrl: 'https://your-n8n.com/webhook/chat'
    });
  },
  beforeDestroy() {
    ChatWidget.destroy();
  }
};
</script>

Configuration Options

ChatWidget.init({
  // Required
  apiUrl: 'https://your-n8n.com/webhook/chat',

  // Branding
  title: 'AI Assistant',
  subtitle: 'Powered by n8n',
  botName: 'Assistant',
  botAvatar: '🤖', // Emoji or image URL
  welcomeMessage: 'Hello! How can I help you?',
  showPoweredBy: true,
  poweredByText: 'Powered by CTI',

  // Appearance
  theme: 'light', // 'light' or 'dark'
  primaryColor: '#6366f1',
  backgroundColor: '#ffffff',
  textColor: '#1f2937',
  position: 'bottom-right', // 'bottom-right' or 'bottom-left'
  width: 380,
  height: 600,
  borderRadius: 16,

  // Button
  buttonSize: 60,
  buttonIcon: '💬', // Emoji or SVG
  buttonOffset: { x: 24, y: 24 },

  // Initial Prompts
  initialPrompts: [
    'What can you help me with?',
    'Tell me about your features'
  ],

  // Behavior
  startOpen: false,
  persistHistory: true,
  showTimestamps: true,
  showBotAvatar: true,
  placeholder: 'Type a message...',

  // Callbacks
  onOpen: () => console.log('Chat opened'),
  onClose: () => console.log('Chat closed'),
  onMessageSent: (msg) => console.log('Sent:', msg),
  onMessageReceived: (msg) => console.log('Received:', msg),
  onError: (err) => console.error('Error:', err)
});

API Methods

// Open the chat panel
ChatWidget.open();

// Close the chat panel
ChatWidget.close();

// Toggle open/close
ChatWidget.toggle();

// Send a message programmatically
ChatWidget.sendMessage('Hello!');

// Clear conversation history
ChatWidget.clearHistory();

// Remove the widget
ChatWidget.destroy();

// Set user information
ChatWidget.setUser({
  id: 'user-123',
  name: 'John Doe',
  email: '[email protected]'
});

n8n Webhook Payload

The widget sends messages in this format:

{
  "metadata": {
    "clientCurrentDateTime": "Wed Jan 15 2025 10:30:00 GMT+0000",
    "clientCurrentTimezone": "America/New_York",
    "clientQueryParams": {},
    "clientUserAgent": "Mozilla/5.0...",
    "userId": "user_123",
    "userName": "John Doe",
    "userEmail": "[email protected]"
  },
  "action": "sendMessage",
  "sessionId": "uuid-session-id",
  "chatInput": "User's message"
}

Expected response format (any of these):

{ "output": "Bot response" }
{ "reply": "Bot response" }
{ "text": "Bot response" }
{ "message": "Bot response" }

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Mobile browsers

License

MIT

Author

CTI