Slack
Slack provider は digital worker を Slack workspace に統合します。次をサポートします:
- ダイレクトメッセージ(DM)
- channel message
- app mention
- interactive component(button、menu)
- Block Kit rich messaging
- slash command
- thread reply
- Slack workspace
- Slack app を作成できる admin 権限
セットアップ
Section titled “セットアップ”-
Slack App を作成する
api.slack.com/apps にアクセスし、“Create New App” をクリックします:
- “From scratch” を選ぶ
- app 名を入力する(例: “My Support Bot”)
- workspace を選ぶ
-
Bot Token Scope を設定する
OAuth & Permissions → Scopes → Bot Token Scopes に移動します:
必須 scope:
chat:write- メッセージを送信するim:history- DM 履歴を読むim:write- DM を開くusers:read- user 情報を読む
任意 scope:
channels:history- channel message を読むchannels:read- channel を一覧するfiles:read- file を読むfiles:write- file を upload する
-
Event Subscriptions を有効にする
Event Subscriptions に移動します:
- Events を有効にする
- Request URL を設定する:
https://your-domain.com/webhook/slack/{tenant}/{team}
bot event を購読します:
message.im- DM messagemessage.channels- channel messageapp_mention- @mention
-
Interactivity を有効にする
Interactivity & Shortcuts に移動します:
- Interactivity を有効にする
- Request URL を設定する:
https://your-domain.com/webhook/slack/{tenant}/{team}/interactive
-
App を workspace にインストールする
Install App → Install to Workspace に移動します。
Bot User OAuth Token(
xoxb-で始まる)をコピーします。 -
App 認証情報を取得する
Basic Information から次を取得します:
- App ID
- Configuration Token(manifest 自動更新用)
-
provider を設定する
answers.json {"messaging-slack": {"enabled": true,"public_base_url": "https://your-domain.ngrok-free.app","api_base_url": "https://slack.com/api","bot_token": "xoxb-xxx-xxx-xxx","slack_app_id": "A07XXXXXX","slack_configuration_token": "xoxe.xoxp-xxx"}} -
セットアップを実行する
Terminal window gtc setup --answers answers.json ./my-bundle
設定オプション
Section titled “設定オプション”| Option | Required | Description |
|---|---|---|
enabled | Yes | provider を有効/無効にする |
public_base_url | Yes | webhook 用の公開 URL |
bot_token | Yes | Bot User OAuth Token(xoxb-...) |
slack_app_id | Yes | Basic Information にある App ID |
slack_configuration_token | No | manifest の自動更新用 |
api_base_url | No | Slack API URL(デフォルト: https://slack.com/api) |
テキストメッセージ
Section titled “テキストメッセージ”- id: reply type: reply config: message: "Hello! How can I help you?"Markdown Formatting
Section titled “Markdown Formatting”Slack は mrkdwn format を使います:
- id: formatted type: reply config: message: | *Bold* _Italic_ `code` >Blockquote • Bullet pointBlock Kit メッセージ
Section titled “Block Kit メッセージ”rich layout には Slack の Block Kit を使います:
- id: rich_message type: reply config: blocks: - type: section text: type: mrkdwn text: "*Welcome!*\nHow can I assist you today?" - type: divider - type: actions elements: - type: button text: type: plain_text text: "Get Help" action_id: "help_clicked" value: "help" - type: button text: type: plain_text text: "View Status" action_id: "status_clicked" value: "status"Interactive Buttons
Section titled “Interactive Buttons”- id: ask_action type: reply config: message: "What would you like to do?" blocks: - type: actions elements: - type: button text: type: plain_text text: "Create Ticket" style: primary action_id: "create_ticket" - type: button text: type: plain_text text: "Cancel" style: danger action_id: "cancel"Select Menus
Section titled “Select Menus”- id: select_option type: reply config: blocks: - type: section text: type: mrkdwn text: "Select a category:" accessory: type: static_select action_id: "category_select" options: - text: type: plain_text text: "Technical Support" value: "technical" - text: type: plain_text text: "Billing" value: "billing" - text: type: plain_text text: "General" value: "general"Thread Reply
Section titled “Thread Reply”thread に返信します:
- id: thread_reply type: reply config: message: "This replies in the thread" thread_ts: "{{original_message.thread_ts}}"File Upload
Section titled “File Upload”- id: upload_file type: reply config: files: - url: "https://example.com/report.pdf" filename: "report.pdf" title: "Monthly Report"Ephemeral Message
Section titled “Ephemeral Message”1人の user にだけ見えるメッセージです:
- id: ephemeral type: reply config: message: "Only you can see this" ephemeral: true user: "{{user_id}}"Interaction の処理
Section titled “Interaction の処理”Button Clicks
Section titled “Button Clicks”name: handle_interactionversion: "1.0"
nodes: - id: route_action type: branch config: conditions: - expression: "action_id == 'help_clicked'" next: show_help - expression: "action_id == 'create_ticket'" next: create_ticket default: unknown_action
- id: show_help type: reply config: message: "Here's how I can help..."
triggers: - type: block_action target: route_actionSelect Menu の変更
Section titled “Select Menu の変更”- id: handle_select type: branch config: conditions: - expression: "selected_value == 'technical'" next: technical_flow - expression: "selected_value == 'billing'" next: billing_flowSlash Commands
Section titled “Slash Commands”- app 設定の Slash Commands に移動する
- command を作成する(例:
/support) - Request URL を webhook に設定する
flow では次のように処理します:
name: slash_commandversion: "1.0"
nodes: - id: handle_command type: reply config: message: "Support bot at your service!" response_type: in_channel # or "ephemeral"
triggers: - type: slash_command command: "/support" target: handle_commandChannel 設定
Section titled “Channel 設定”単一 channel
Section titled “単一 channel”tenants: demo: teams: support: channels: slack: provider: messaging-slack config: channel_id: "C1234567890"複数 channel
Section titled “複数 channel”tenants: demo: teams: support: channels: slack-general: provider: messaging-slack config: channel_id: "C1234567890" slack-vip: provider: messaging-slack config: channel_id: "C0987654321"トラブルシューティング
Section titled “トラブルシューティング”App がメッセージを受信しない
Section titled “App がメッセージを受信しない”-
Event Subscriptions を確認する:
- Request URL が正しいことを確認する
- event が有効になっていることを確認する
- bot が正しい event を購読していることを確認する
-
Bot の権限を確認する:
- scope を追加した後は app を再インストールする
- bot が channel に参加していることを確認する
-
Webhook をテストする:
Terminal window curl https://your-domain.com/webhook/slack/demo/default
“not_authed” Error
Section titled ““not_authed” Error”bot token が無効か期限切れです。OAuth & Permissions から新しい token を取得してください。
“channel_not_found” Error
Section titled ““channel_not_found” Error”- channel ID が正しいことを確認する
- bot が channel に追加されていることを確認する
- channel が archived されていないことを確認する
Rate Limiting
Section titled “Rate Limiting”Slack の rate limit は method ごとに異なります。適切に処理してください:
- id: reply type: reply config: message: "Response" retry_on_rate_limit: true max_retries: 3セキュリティ
Section titled “セキュリティ”Greentic は次を自動検証します:
- Request timestamp
- signing secret を使った signature
- token verification
次のステップ
Section titled “次のステップ”- Block Kit Builder - rich message を設計する
- Teams Provider - Teams integration を追加する
- Flows Guide - 複雑な workflow を構築する