Slack
Ringkasan
Section titled “Ringkasan”Provider Slack mengintegrasikan digital worker Anda dengan workspace Slack. Provider ini mendukung:
- Direct message (DM)
- Pesan channel
- Mention app
- Komponen interaktif (tombol, menu)
- Pesan kaya Block Kit
- Slash command
- Balasan thread
Prasyarat
Section titled “Prasyarat”- Sebuah workspace Slack
- Akses admin untuk membuat app Slack
Penyiapan
Section titled “Penyiapan”-
Buat App Slack
Buka api.slack.com/apps dan klik “Create New App”:
- Pilih “From scratch”
- Masukkan nama app (misalnya, “My Support Bot”)
- Pilih workspace Anda
-
Konfigurasikan Bot Token Scopes
Buka OAuth & Permissions → Scopes → Bot Token Scopes:
Scope yang diperlukan:
chat:write- Mengirim pesanim:history- Membaca riwayat DMim:write- Membuka DMusers:read- Membaca info pengguna
Scope opsional:
channels:history- Membaca pesan channelchannels:read- Menampilkan daftar channelfiles:read- Membaca filefiles:write- Mengunggah file
-
Aktifkan Event Subscriptions
Buka Event Subscriptions:
- Aktifkan Events
- Atur Request URL:
https://your-domain.com/webhook/slack/{tenant}/{team}
Subscribe ke event bot:
message.im- Pesan DMmessage.channels- Pesan channelapp_mention- @mention
-
Aktifkan Interactivity
Buka Interactivity & Shortcuts:
- Aktifkan Interactivity
- Atur Request URL:
https://your-domain.com/webhook/slack/{tenant}/{team}/interactive
-
Install App ke Workspace
Buka Install App → Install to Workspace
Salin Bot User OAuth Token (diawali dengan
xoxb-) -
Dapatkan Kredensial App
Dari Basic Information:
- App ID
- Configuration Token (untuk pembaruan manifest)
-
Konfigurasikan 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"}} -
Jalankan Setup
Terminal window gtc setup --answers answers.json ./my-bundle
Opsi Konfigurasi
Section titled “Opsi Konfigurasi”| Opsi | Wajib | Deskripsi |
|---|---|---|
enabled | Ya | Aktifkan/nonaktifkan provider |
public_base_url | Ya | URL publik untuk webhook |
bot_token | Ya | Bot User OAuth Token (xoxb-...) |
slack_app_id | Ya | App ID dari Basic Information |
slack_configuration_token | Tidak | Untuk pembaruan manifest otomatis |
api_base_url | Tidak | URL API Slack (default: https://slack.com/api) |
Pesan Teks
Section titled “Pesan Teks”- id: reply type: reply config: message: "Hello! How can I help you?"Pemformatan Markdown
Section titled “Pemformatan Markdown”Slack menggunakan format mrkdwn:
- id: formatted type: reply config: message: | *Bold* _Italic_ `code` >Blockquote • Bullet pointPesan Block Kit
Section titled “Pesan Block Kit”Gunakan Block Kit milik Slack untuk layout kaya:
- 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"Tombol Interaktif
Section titled “Tombol Interaktif”- 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"Menu Pilihan
Section titled “Menu Pilihan”- 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"Balasan Thread
Section titled “Balasan Thread”Balas dalam thread:
- id: thread_reply type: reply config: message: "This replies in the thread" thread_ts: "{{original_message.thread_ts}}"Unggah File
Section titled “Unggah File”- id: upload_file type: reply config: files: - url: "https://example.com/report.pdf" filename: "report.pdf" title: "Monthly Report"Pesan Ephemeral
Section titled “Pesan Ephemeral”Pesan yang hanya terlihat oleh satu pengguna:
- id: ephemeral type: reply config: message: "Only you can see this" ephemeral: true user: "{{user_id}}"Menangani Interaksi
Section titled “Menangani Interaksi”Klik Tombol
Section titled “Klik Tombol”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_actionPerubahan Select Menu
Section titled “Perubahan 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”- Buka Slash Commands di pengaturan app Anda
- Buat command (misalnya,
/support) - Atur Request URL ke webhook Anda
Tangani di flow Anda:
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_commandKonfigurasi Channel
Section titled “Konfigurasi Channel”Channel Tunggal
Section titled “Channel Tunggal”tenants: demo: teams: support: channels: slack: provider: messaging-slack config: channel_id: "C1234567890"Banyak Channel
Section titled “Banyak Channel”tenants: demo: teams: support: channels: slack-general: provider: messaging-slack config: channel_id: "C1234567890" slack-vip: provider: messaging-slack config: channel_id: "C0987654321"Troubleshooting
Section titled “Troubleshooting”App Tidak Menerima Pesan
Section titled “App Tidak Menerima Pesan”-
Verifikasi Event Subscriptions:
- Periksa apakah Request URL benar
- Pastikan event diaktifkan
- Verifikasi bot berlangganan ke event yang benar
-
Periksa Izin Bot:
- Install ulang app setelah menambahkan scope
- Pastikan bot ada di channel
-
Uji Webhook:
Terminal window curl https://your-domain.com/webhook/slack/demo/default
Error “not_authed”
Section titled “Error “not_authed””Bot token Anda tidak valid atau sudah kedaluwarsa. Ambil token baru dari OAuth & Permissions.
Error “channel_not_found”
Section titled “Error “channel_not_found””- Verifikasi channel ID sudah benar
- Pastikan bot ditambahkan ke channel
- Periksa apakah channel tidak diarsipkan
Rate Limiting
Section titled “Rate Limiting”Rate limit Slack bervariasi per metode. Tangani dengan baik:
- id: reply type: reply config: message: "Response" retry_on_rate_limit: true max_retries: 3Keamanan
Section titled “Keamanan”Greentic secara otomatis memvalidasi:
- Timestamp request
- Signature menggunakan signing secret
- Verifikasi token
Langkah Berikutnya
Section titled “Langkah Berikutnya”- Block Kit Builder - Rancang pesan kaya
- Provider Teams - Tambahkan integrasi Teams