---
title: "Konektor Slack"
description: "Panduan integrasi Slack lengkap untuk mengirim notifikasi, menyinkronkan data channel, dan memicu otomatisasi Brevo dari event Slack melalui Tajo."
url: https://tajo.io/in/docs/connectors/custom/slack/
markdown: https://tajo.io/in/docs/connectors/custom/slack.md
lang: id-ID
robots: noindex
---

Ajukan akses awal

Masukkan nama depan dan alamat email kerja Anda. Kami akan mengirim tautan untuk mengonfirmasi permintaan akses Tajo.

# Konektor Slack

Status konektor: Direncanakan Belum dibangun. Tajo belum menjalankan konektor ini.

| Field sumber | Field tujuan | Nilai contoh |
| --- | --- | --- |
| `record.id` | `source_id` | `record_1042` |
| `record.updated_at` | `updated_at` | `2026-10-18T08:00:00Z` |
| `record.value` | `value` | `sample_value` |

Hubungkan workspace Slack Anda ke Brevo melalui Tajo untuk notifikasi pemasaran real-time, peringatan tim atas event pelanggan, dan otomatisasi alur kerja yang dipicu oleh interaksi di Slack.

## Ikhtisar

| Properti | Nilai |
| --- | --- |
| **Platform** | Slack |
| **Kategori** | Integrasi custom |
| **Kompleksitas penyiapan** | Mudah |
| **Integrasi resmi** | Tidak |
| **Data tersinkron** | Pengguna, channel, pesan, event |
| **URL dasar API** | `https://slack.com/api` |

## Fitur

- **Peringatan pemasaran** - Kirim notifikasi real-time untuk event kampanye, pelanggan email baru, dan pencapaian pendapatan
- **Notifikasi event pelanggan** - Beri tahu tim tentang aksi pelanggan bernilai tinggi dari Brevo
- **Pemicu alur kerja** - Gunakan interaksi Slack (klik tombol, pengiriman formulir) untuk memicu otomatisasi Brevo
- **Perutean berbasis channel** - Arahkan notifikasi ke channel tertentu berdasarkan jenis event atau segmen pelanggan
- **Sinkronisasi pengguna** - Petakan pengguna workspace Slack ke kontak Brevo untuk komunikasi internal
- **Pesan interaktif** - Kirim pesan kaya dengan tombol dan aksi untuk alur kerja tim
- **Pesan terjadwal** - Jadwalkan notifikasi untuk ringkasan pemasaran harian atau mingguan
- **Dukungan thread** - Kelompokkan notifikasi terkait dalam thread agar komunikasi tetap rapi

## Prasyarat

Sebelum memulai, pastikan Anda memiliki:

1. Workspace Slack dengan akses admin
2. Aplikasi Slack yang dibuat di [api.slack.com/apps](https://api.slack.com/apps)
3. Bot token dengan scope yang diperlukan
4. Akun Brevo dengan akses API
5. Akun Tajo

## Autentikasi

### Bot token (disarankan)

Pasang aplikasi Slack ke workspace Anda dan gunakan bot token untuk akses API.

1. Buat aplikasi di [api.slack.com/apps](https://api.slack.com/apps)
2. Tambahkan scope OAuth yang diperlukan pada “OAuth & Permissions”
3. Pasang aplikasi ke workspace
4. Salin Bot User OAuth Token (`xoxb-...`)

```bash
curl -X POST "https://slack.com/api/chat.postMessage" \
  -H "Authorization: Bearer xoxb-YOUR-BOT-TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"channel": "C01234567", "text": "Hello from Tajo!"}'
```

### OAuth 2.0

Untuk mendistribusikan integrasi Slack Anda ke banyak workspace:

```bash
# Authorization URL
https://slack.com/oauth/v2/authorize?
  client_id={client_id}&
  scope=chat:write,channels:read,users:read&
  redirect_uri={redirect_uri}

# Token exchange
curl -X POST "https://slack.com/api/oauth.v2.access" \
  -d "client_id={client_id}" \
  -d "client_secret={client_secret}" \
  -d "code={auth_code}"
```

#### Scope bot yang diperlukan

```
chat:write           # Send messages
channels:read        # List channels
channels:history     # Read channel messages
users:read           # List workspace users
users:read.email     # Read user email addresses
reactions:write      # Add reactions to messages
files:write          # Upload files
```

Akses email pengguna

Scope `users:read.email` diperlukan untuk mencocokkan pengguna Slack dengan kontak Brevo. Tanpa scope tersebut, pemetaan pengguna hanya terbatas pada nama tampilan.

## Konfigurasi

### Penyiapan dasar

```yaml
connectors:
  slack:
    enabled: true
    bot_token: "${SLACK_BOT_TOKEN}"
    signing_secret: "${SLACK_SIGNING_SECRET}"

    # Notification channels
    channels:
      marketing: "C01234567"
      sales: "C01234568"
      support: "C01234569"
      alerts: "C01234570"

    # Event routing
    notifications:
      new_subscriber:
        channel: marketing
        template: subscriber_alert
      high_value_order:
        channel: sales
        template: order_alert
      support_ticket:
        channel: support
        template: ticket_alert
```

### Pemetaan field

Petakan data pengguna Slack ke atribut kontak Brevo:

#### Pemetaan bawaan

| Parameter | Type | Description |
| --- | --- | --- |
| `profile.email` required | string | Email pengguna (pengenal unik untuk pencocokan di Brevo) |
| `real_name` optional | string | Nama lengkap, dipecah menjadi FIRSTNAME/LASTNAME |
| `profile.phone` optional | string | Dipetakan ke atribut SMS |
| `profile.title` optional | string | Jabatan |
| `tz` optional | string | Zona waktu pengguna |
| `is_admin` optional | boolean | Status admin workspace |
| `team_id` optional | string | ID tim workspace |
| `status_text` optional | string | Status kustom pengguna |

## Metode API

### Perpesanan

| Metode | Endpoint | Deskripsi |
| --- | --- | --- |
| `POST` | `chat.postMessage` | Mengirim pesan ke sebuah channel |
| `POST` | `chat.update` | Memperbarui pesan yang sudah ada |
| `POST` | `chat.delete` | Menghapus sebuah pesan |
| `POST` | `chat.scheduleMessage` | Menjadwalkan sebuah pesan |
| `POST` | `chat.postEphemeral` | Mengirim pesan ephemeral ke pengguna |

### Channel

| Metode | Endpoint | Deskripsi |
| --- | --- | --- |
| `GET` | `conversations.list` | Menampilkan daftar channel |
| `GET` | `conversations.info` | Mengambil info channel |
| `GET` | `conversations.members` | Menampilkan daftar anggota channel |
| `GET` | `conversations.history` | Mengambil pesan dalam channel |

### Pengguna

| Metode | Endpoint | Deskripsi |
| --- | --- | --- |
| `GET` | `users.list` | Menampilkan daftar pengguna workspace |
| `GET` | `users.info` | Mengambil info pengguna |
| `GET` | `users.lookupByEmail` | Mencari pengguna berdasarkan email |
| `GET` | `users.conversations` | Menampilkan daftar channel pengguna |

### Interaksi

| Metode | Endpoint | Deskripsi |
| --- | --- | --- |
| `POST` | `views.open` | Membuka tampilan modal |
| `POST` | `views.update` | Memperbarui tampilan modal |
| `POST` | `reactions.add` | Menambahkan reaksi emoji |

## Event

### Notifikasi Brevo ke Slack

| Event | Pemicu | Aksi Slack |
| --- | --- | --- |
| `new_subscriber` | Kontak dibuat di Brevo | Kirim ke #marketing |
| `campaign_sent` | Kampanye email terkirim | Kirim ringkasan ke #marketing |
| `order_placed` | Pesanan bernilai tinggi terdeteksi | Kirim ke #sales beserta detailnya |
| `cart_abandoned` | Keranjang ditinggalkan selama 30 menit | Kirim ke #sales untuk tindak lanjut |
| `ticket_created` | Tiket dukungan dibuka | Kirim ke #support |
| `unsubscribed` | Kontak berhenti berlangganan | Kirim peringatan ke #marketing |

### Pemicu Slack ke Brevo

| Event Slack | Pemicu | Aksi Brevo |
| --- | --- | --- |
| `message_action` | Pintasan pesan kustom | Tambahkan kontak ke list atau picu otomatisasi |
| `block_actions` | Klik tombol dalam pesan | Perbarui atribut kontak atau kirim email |
| `view_submission` | Formulir modal dikirim | Buat kontak atau picu alur kerja |

## Contoh kode

### Inisialisasi konektor

```javascript
import { TajoClient } from '@tajo/sdk';

const tajo = new TajoClient({
  apiKey: process.env.TAJO_API_KEY,
  brevoApiKey: process.env.BREVO_API_KEY
});

// Connect Slack
await tajo.connectors.connect('slack', {
  botToken: process.env.SLACK_BOT_TOKEN,
  signingSecret: process.env.SLACK_SIGNING_SECRET
});
```

### Kirim notifikasi pemasaran

```javascript
// Send a notification when a high-value order is placed
await tajo.slack.notify({
  channel: 'sales',
  event: 'order_placed',
  data: {
    customerEmail: 'customer@example.com',
    orderValue: '$1,250.00',
    products: ['Premium Widget', 'Pro Service'],
    isFirstOrder: true
  },
  template: {
    blocks: [
      {
        type: 'header',
        text: { type: 'plain_text', text: 'New High-Value Order' }
      },
      {
        type: 'section',
        fields: [
          { type: 'mrkdwn', text: '*Customer:*\ncustomer@example.com' },
          { type: 'mrkdwn', text: '*Amount:*\n$1,250.00' }
        ]
      },
      {
        type: 'actions',
        elements: [
          {
            type: 'button',
            text: { type: 'plain_text', text: 'View in Brevo' },
            url: 'https://app.brevo.com/contacts'
          }
        ]
      }
    ]
  }
});
```

### Tangani interaksi Slack

```javascript
import crypto from 'crypto';

app.post('/slack/interactions', async (req, res) => {
  // Verify Slack request signature
  const timestamp = req.headers['x-slack-request-timestamp'];
  const signature = req.headers['x-slack-signature'];
  const sigBasestring = `v0:${timestamp}:${req.rawBody}`;
  const mySignature = 'v0=' + crypto
    .createHmac('sha256', process.env.SLACK_SIGNING_SECRET)
    .update(sigBasestring)
    .digest('hex');

  if (signature !== mySignature) {
    return res.status(401).send('Unauthorized');
  }

  const payload = JSON.parse(req.body.payload);

  // Handle button actions
  if (payload.type === 'block_actions') {
    await tajo.connectors.handleWebhook('slack', {
      type: 'interaction',
      action: payload.actions[0].action_id,
      userId: payload.user.id,
      payload
    });
  }

  res.status(200).send();
});
```

## Batas rate

Batas rate API Slack memakai sistem berjenjang:

| Tier | Batas | Metode umum |
| --- | --- | --- |
| Tier 1 | 1 permintaan/menit | `chat.delete`, `conversations.kick` |
| Tier 2 | 20 permintaan/menit | `conversations.history`, `users.info` |
| Tier 3 | 50 permintaan/menit | `conversations.list`, `users.list` |
| Tier 4 | 100 permintaan/menit | `chat.postMessage` |
| Khusus | Bervariasi | `chat.postMessage` ke channel yang sama: 1/detik |

Batas tambahan:

- **Web API**: batas burst dengan throttle jangka pendek
- **Events API**: pengiriman ulang hingga 3 percobaan
- **Incoming Webhooks**: 1 pesan/detik per URL webhook
- **Block Kit**: maksimum 50 block per pesan

Laju pengiriman ke channel

Pengiriman ke channel yang sama dibatasi sekitar 1 pesan per detik. Kelompokkan notifikasi atau gunakan thread agar tidak terkena rate limit.

## Pemecahan masalah

### Masalah umum

| Masalah | Penyebab | Solusi |
| --- | --- | --- |
| `not_authed` | Bot token tidak valid | Pasang ulang aplikasi dan salin bot token yang baru |
| `channel_not_found` | Bot belum ada di channel | Undang bot ke channel tujuan |
| `missing_scope` | Scope yang diperlukan belum diberikan | Tambahkan scope lalu pasang ulang aplikasi |
| Event tidak diterima | Langganan event belum disetel | Konfigurasikan URL Event Subscriptions |
| Interaksi timeout | Respons lebih dari 3 detik | Balas 200 seketika, proses secara asinkron |

### Mode debug

Aktifkan logging verbose:

```yaml
connectors:
  slack:
    debug: true
    log_level: verbose
    log_events: true
```

### Uji koneksi

```bash
tajo connectors test slack
# ✓ Bot token valid
# ✓ Workspace accessible
# ✓ Channels readable
# ✓ Message posting enabled
# ✓ Event subscriptions active
```

## Praktik terbaik

1. **Gunakan Block Kit** - Bangun pesan interaktif yang kaya dengan framework Block Kit milik Slack
2. **Balas dengan cepat** - Konfirmasi interaksi dalam 3 detik, lalu proses secara asinkron
3. **Kelompokkan pesan dalam thread** - Satukan notifikasi terkait dalam thread untuk menekan noise
4. **Rutekan per channel** - Kirim jenis event yang berbeda ke channel tim yang sesuai
5. **Sertakan tombol aksi** - Tambahkan tombol “View in Brevo” agar data pelanggan cepat diakses
6. **Terapkan unfurling** - Tampilkan pratinjau kaya untuk tautan Brevo yang dibagikan di Slack

## Keamanan

- **Bot token** - Token akses ber-scope OAuth dengan izin yang granular
- **Penandatanganan permintaan** - Verifikasi tanda tangan HMAC SHA-256 untuk permintaan masuk
- **OAuth 2.0** - Standar industri untuk otorisasi distribusi lintas workspace
- **Enkripsi TLS** - Seluruh komunikasi API terenkripsi melalui HTTPS
- **Rotasi token** - Rotasi token otomatis untuk keamanan yang lebih baik

## Sumber daya terkait

- [Dokumentasi API Slack](https://api.slack.com/methods)
- [Slack Block Kit Builder](https://app.slack.com/block-kit-builder)
- [Slack Events API](https://api.slack.com/events-api)
- [Konektor Brevo](https://tajo.io/in/docs/connectors/marketing/brevo)
- [Skill Customer Sync](https://tajo.io/in/docs/skills/data-sync/customer-sync)
