Gateway › Slack
Slack
Tổng quan
Workspace là group, channel là topic. Kết nối qua Socket Mode nên không cần URL public.
Tạo app từ manifest
display_information:
name: agent-hub
features:
bot_user: { display_name: agent-hub, always_online: true }
slash_commands: [/agent, /ask, /scope, /project, /user]
oauth_config:
scopes:
bot: [app_mentions:read, channels:history, channels:read, groups:history,
groups:read, im:history, im:write, mpim:history, chat:write,
reactions:write, users:read, files:read, commands]
settings:
event_subscriptions:
bot_events: [message.channels, message.groups, message.im, message.mpim,
team_join, user_change, member_joined_channel]
interactivity: { is_enabled: true }
socket_mode_enabled: true
| Trường | Ý nghĩa |
|---|---|
socket_mode_enabled | Event tới qua websocket của chính bot. |
interactivity | Nút bấm (scope picker, duyệt) tới được bot. |
im:write | Mở DM với một người (login link, trả lời riêng). |
reactions:write | Dấu 👀 khi tin đã giao cho agent. |
team_join / user_change | Đăng ký thành viên mới, xoá người bị vô hiệu hoá. |
member_joined_channel | Bot được thêm vào channel → hiện scope picker. |
Thiết lập credentials
- Install App để lấy Bot User OAuth Token (
xoxb-). - Basic Information → App-Level Tokens → scope
connections:writeđể lấy App-Level Token (xapp-).
Trên trang Integrations của web app → Gateways → Create trên dòng slack: Bot token (xoxb-…), App token (xapp-…), Owner user id, rồi Enable. Thiếu App token thì Socket Mode không kết nối được. Credentials được agent-hub lưu lại, không phải .env.
Nếu muốn một lane mặc định cho các tin không rõ đích, mở Settings ở dòng Slack trên trang Integrations (thẻ Gateways) và đặt Fallback target là slack:<team_id>:<channel_id>.
Sử dụng
Lệnh bắt đầu bằng ! (ví dụ !agent status) — Slack tự bỏ các lệnh / không đăng ký; xem Lệnh trong chat.
| Bạn muốn | Gõ |
|---|---|
| Chạy lệnh trong tin thường | !agent status — Slack nuốt tin bắt đầu bằng /, nên dùng ! |
| Gửi cho một agent | !dev sửa lỗi hoặc @dev … |
| Trả lời agent | Viết trong thread của tin agent |
| Chuyển cho agent khác | !b <text> trong thread của agent A |
| Đăng nhập web | !start login trong DM với bot |
Mời bot vào từng channel bằng /invite @agent-hub. Slash command chỉ chạy ở gốc channel; trong thread dùng dạng !….