Skip to content

Bytedesk/bytedesk-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

197 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

bytedesk-web

Online customer service SDK, supporting multiple frameworks:

admin

basic settings

chat

user info

userinfo

goods info

goodsInfo

order info

orderInfo

unread count

unread

doc feedback

unread

ไธญๆ–‡ๆ–‡ๆกฃ

Installation Steps

Development Environment

# Required Node.js version for Angular 21 / Vite 8
nvm use 22.12.0

# This repo uses pnpm instead of yarn
pnpm install

Install Dependencies

npm install bytedesk-web
# or
yarn add bytedesk-web

Import Component

import { BytedeskReact } from 'bytedesk-web/react';
import type { BytedeskConfig } from 'bytedesk-web/react';
# or
# import type { BytedeskConfig } from 'bytedesk-web';

Configure Parameters

const config: BytedeskConfig = {
  chatPath: '/chat', // default: /chat, thread history: /chat/thread
  placement: 'bottom-right',
  marginBottom: 20,
  marginSide: 20,
  bubbleConfig: {
    show: true,
    icon: '๐Ÿ‘‹',
    title: 'Need help?',
    subtitle: 'Click to chat'
  },
  buttonConfig: {
    show: true,
    width: 60,
    height: 60,
    // icon: '๐Ÿ‘‹',
    // text: '้œ€่ฆๅธฎๅŠฉๅ—๏ผŸ',
  },
  chatConfig: {
    org: 'df_org_uid',  // Replace with your organization ID
    t: "2",
    sid: 'df_rt_uid'      // Replace with your SID
  }
};

Thread History Page (/chat/thread)

Set chatPath to /chat/thread to make icon click and showChat() open the visitor thread history page.

const config: BytedeskConfig = {
  htmlUrl: 'https://cdn.weiyuai.cn/chat',
  chatPath: '/chat/thread',
  chatConfig: {
    org: 'df_org_uid',
    t: '1',
    sid: 'df_wg_uid',
    visitorUid: 'visitor_001',
    nickname: 'Visitor',
    avatar: 'https://weiyuai.cn/assets/images/avatar/02.jpg'
  }
};

Direct URL integration (same query params as /chat):

https://cdn.weiyuai.cn/chat/thread?org=df_org_uid&t=1&sid=df_wg_uid&visitorUid=visitor_001&nickname=Visitor&avatar=https%3A%2F%2Fweiyuai.cn%2Fassets%2Fimages%2Favatar%2F02.jpg&lang=en&mode=light

Use Component

const App = () => {
  const handleInit = () => {
    console.log('BytedeskReact initialized');
  };

  return (
    <div>
      <BytedeskReact {...config} onInit={handleInit} />
      <button onClick={() => (window as any).bytedesk?.showChat()}>
        Open Chat
      </button>
    </div>
  );
};

Available Methods

# show/hide button
(window as any).bytedesk?.showButton();
(window as any).bytedesk?.hideButton();

# show/hide bubble
(window as any).bytedesk?.showBubble();
(window as any).bytedesk?.hideBubble();

# show/hide chat window
(window as any).bytedesk?.showChat();
(window as any).bytedesk?.hideChat();

# show/hide invite dialog
(window as any).bytedesk?.showInviteDialog();
(window as any).bytedesk?.hideInviteDialog();

# get unread message count
(window as any).bytedesk?.getUnreadMessageCount()
# clear unread messages
(window as any).bytedesk?.clearUnreadMessages()

Run Examples

pnpm install
pnpm demo:react    # Run React demo
pnpm demo:vue      # Run Vue demo
pnpm demo:svelte   # Run Svelte demo
pnpm demo:vanilla  # Run Vanilla JS demo
pnpm demo:angular  # Run Angular demo
pnpm demo:nextjs   # Run Next.js demo

# JavaScript demo requires build first
pnpm build
pnpm demo:javascript

CDN

# https://cdn.jsdelivr.net/npm/bytedesk-web@1.4.9/dist/
https://cdn.jsdelivr.net/npm/bytedesk-web@1.4.9/dist/bytedesk-web.js
https://cdn.jsdelivr.net/npm/bytedesk-web@1.4.9/dist/bytedesk-web.umd.js

Server

Open Source Demo + SDK

Project Description Forks Stars
iOS iOS GitHub forks GitHub Repo stars
Android Android GitHub forks GitHub Repo stars
Flutter Flutter GitHub forks GitHub Repo stars
UniApp Uniapp GitHub forks GitHub Repo stars
Web Vue/React/Angular/Next.js/JQuery/... GitHub forks GitHub Repo stars
Wordpress Wordpress GitHub forks GitHub Repo stars
Woocommerce woocommerce GitHub forks GitHub Repo stars
Magento Magento GitHub forks GitHub Repo stars
Prestashop Prestashop GitHub forks GitHub Repo stars
Shopify Shopify GitHub forks GitHub Repo stars
Opencart Opencart GitHub forks GitHub Repo stars
Laravel Laravel GitHub forks GitHub Repo stars
Django Django GitHub forks GitHub Repo stars

About

bytedesk customer service web chat widget, support vue/react/nextjs/angular/svelte/vanilla/javascript/typescrpt...

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors