🎉 已開源 · v0.1.0-alpha-2 — 加入候補名單,正式版上線第一時間通知 加入候補 →
06 — 擴充

通訊軟體

Channel 是使用者派工給 Manager 的入口。官方 channel 會自動解析到對應的 GitHub repo。

# 瀏覽器版聊天介面(不用 bot token — 設一組登入帳密就好)
costaff channel add webchat

# Telegram bot — 會問 TELEGRAM_BOT_TOKEN
costaff channel add telegram

官方 Channel

這四個名稱會自動解析到對應的 GitHub repo,不用給 URL:

名稱需要什麼
webchat不依賴第三方服務。部署時 CLI 會問登入 email + 密碼(以及 JWT secret);之後瀏覽器開該 channel 的 port 就能聊。
telegram@BotFatherTELEGRAM_BOT_TOKEN
discord到 Discord developer portal 拿 DISCORD_BOT_TOKEN
lineLINE_CHANNEL_ACCESS_TOKEN + LINE_CHANNEL_SECRET

Host port 依加入順序從 1809018099 自動分配 — costaff channel list 會顯示各 channel 的 port 與健康狀態。如果 WebChat 是你加的第一個 channel,就落在 http://localhost:18090

逐步教學:每個 channel 怎麼設

WebChat(最簡單 — 全程本機)

  1. costaff channel add webchat
  2. 被問到時,設定一組登入 email + 密碼(這是你自己登入聊天頁用的,隨意設定)和一個 JWT secret(任意一長串隨機字串)。
  3. 瀏覽器開 costaff channel list 顯示的 port,登入,開聊。不依賴任何第三方帳號。

Telegram(約 5 分鐘 — 筆電就能跑,不需要公網 IP)

  1. 在 Telegram 裡開 @BotFather,送出 /newbot
  2. 先給 bot 一個顯示名稱,再給一個結尾是 bot 的 username(例如 my_costaff_bot)。
  3. BotFather 會回一個長得像 123456789:AAH… 的 token — 複製起來。
  4. costaff channel add telegram,被問到時貼上 token。
  5. 在 Telegram 打開你的 bot,送 /start 再隨便傳一句話。第一句話會建立待核准身份 — 見下方核准說明。

Telegram 走 long polling(是你的機器去連 Telegram,不是反過來),所以在家用路由器、防火牆後面都能跑,零網路設定。

Discord(約 10 分鐘)

  1. Discord Developer PortalNew Application
  2. Bot 分頁:點 Reset Token 並複製。
  3. 同一頁往下捲到 Privileged Gateway Intents打開 Message Content Intent — 不開的話 bot 連得上但永遠看不到你的訊息。這是 Discord 的第一大雷。
  4. OAuth2 → URL Generator:勾 bot scope,給 Send Messages + Read Message History 權限,打開產生的網址,把 bot 邀進你的伺服器。
  5. costaff channel add discord,貼上 token。

LINE(⚠ 需要公網 HTTPS)

跟 Telegram 不同,LINE 是用 webhook 送訊息 — LINE 的伺服器必須能從外面透過公網 HTTPS 打到你機器的 /callback。在家用路由器後面的筆電,代表你需要 tunnel(例如 Cloudflare Tunnel 或 ngrok)或有 TLS 的反向代理。如果只是想在本機試用 CoStaff,先用 WebChat 或 Telegram,等有伺服器再回來接 LINE。

  1. LINE Developers Console 建立 Provider 與 Messaging API channel。
  2. 複製 Channel access tokenChannel secret
  3. costaff channel add line,兩個都貼上。
  4. 回 LINE 後台把 webhook URL 設成 https://<你的公網網域>/callback(指向這個 channel 的 port)並啟用 webhook。
第一句話 → 需要核准

預設情況下,任何新的聊天帳號傳來第一句話會建立待核准身份,助理會回覆該帳號「has not been approved」。核准自己:costaff dashboardUsers → 核准新的那一列,再傳一次訊息即可。這道門檻是防止陌生人撿到你的 bot 就能免費用你的 AI — 建議保持開啟。

自訂 Channel

跟 Agent 一樣的 flag。例如 Slack 是第一方 repo,用 URL 加:

# Slack bot(Socket Mode — 需要 SLACK_BOT_TOKEN + SLACK_APP_TOKEN)
costaff channel add slack --github https://github.com/costaff-ai/costaff-channel-slack

costaff channel add my-channel --github https://github.com/you/my-channel
costaff channel add my-channel --local /path/to/my-channel

管理 Channel

指令作用
costaff channel list列出已註冊 channel 與 port、健康狀態。
costaff channel rebuild <name>Rebuild image 並重啟。
costaff channel remove <name>停掉、移除、unregister。
costaff channel tags <name>列出該 channel repo 可用的 release tag(pin 版本用)。

Pin 版本

Channel 跟 Agent 一樣支援 --tag / --no-pull。Production 上 pin 之後,下次 rebuild 會停在 pin 的 ref。

costaff channel add telegram --tag v0.1.0-alpha-2
costaff channel rebuild telegram --tag v0.2.0

完整說明見 CLI → 版本 pin

同一批 Agent,多個聊天平台

可以同時跑多個 channel。Telegram 訊息與 WebChat 訊息都會走到同一個 Manager 與同一批專家 Agent — 跨 channel 的使用者身份會被自動正規化。