Chatwoot 是做什麼的?
概述
Chatwoot 是一個開放原始碼的客戶支援平台。它是可自行託管的 Intercom 替代方案,提供即時聊天、共享收件匣、多渠道支援(網站、電子郵件、WhatsApp、Telegram、Twitter)以及聊天機器人。自行託管時完全免費。
使用說明
步驟 1:Docker 部署
# docker-compose.yml — 自行託管的 Chatwoot
services:
chatwoot:
image: chatwoot/chatwoot:latest
depends_on: [postgres, redis]
ports: ["3000:3000"]
environment:
RAILS_ENV: production
SECRET_KEY_BASE: your-secret-key-base
FRONTEND_URL: https://chat.example.com
POSTGRES_HOST: postgres
POSTGRES_USERNAME: chatwoot
POSTGRES_PASSWORD: chatwoot
REDIS_URL: redis://redis:6379
MAILER_SENDER_EMAIL: [email protected]
SMTP_ADDRESS: smtp.gmail.com
SMTP_PORT: 587
SMTP_USERNAME: [email protected]
SMTP_PASSWORD: app-password
command: bundle exec rails s -p 3000 -b 0.0.0.0
sidekiq:
image: chatwoot/chatwoot:latest
depends_on: [postgres, redis]
environment: *chatwoot-env
command: bundle exec sidekiq
postgres:
image: postgres:15
environment:
POSTGRES_DB: chatwoot
POSTGRES_USER: chatwoot
POSTGRES_PASSWORD: chatwoot
volumes: [pgdata:/var/lib/postgresql/data]
redis:
image: redis:7-alpine
volumes: [redisdata:/data]
volumes:
pgdata:
redisdata:
步驟 2:新增聊天小工具
<!-- 新增至您的網站 -->
<script>
(function(d,t) {
var BASE_URL="https://chat.example.com";
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=BASE_URL+"/packs/js/sdk.js";
g.defer = true;
g.async = true;
s.parentNode.insertBefore(g,s);
g.onload=function(){
window.chatwootSDK.run({
websiteToken: 'YOUR_WEBSITE_TOKEN',
baseUrl: BASE_URL
})
}
})(document,"script");
</script>
步驟 3:API 整合
// lib/chatwoot.ts — 透過 API 建立聯絡人和對話
const CHATWOOT_URL = 'https://chat.example.com'
const CHATWOOT_TOKEN = process.env.CHATWOOT_API_TOKEN!
// 當使用者註冊時建立聯絡人
await fetch(`${CHATWOOT_URL}/api/v1/accounts/1/contacts`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
api_access_token: CHATWOOT_TOKEN,
},
body: JSON.stringify({
name: 'John Doe',
email: '[email protected]',
custom_attributes: { plan: 'pro', mrr: 49 },
}),
})
使用準則
- 自行託管:完全免費,無限制的客服人員和對話數量。
- 雲端版:每個客服人員每月 $19 起。
- 支援 WhatsApp Business、Telegram、Twitter、電子郵件和網站頻道,全部整合在一個收件匣中。
- 使用 Webhook 將對話同步至您的 CRM 或工單系統。