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_enabledEvent tới qua websocket của chính bot.
interactivityNút bấm (scope picker, duyệt) tới được bot.
im:writeMở DM với một người (login link, trả lời riêng).
reactions:writeDấ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_channelBot được thêm vào channel → hiện scope picker.

Thiết lập credentials

  1. Install App để lấy Bot User OAuth Token (xoxb-).
  2. 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ốnGõ
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 agentViế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 !….