> For the complete documentation index, see [llms.txt](https://docs.dibales.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dibales.ai/n8n/whatsapp-nodes.md).

# Whatsapp Nodes

<figure><img src="/files/MIqPEZztljjRcFaubcj0" alt=""><figcaption></figcaption></figure>

Node ini menghubungkan N8N langsung ke akun WhatsApp yang sudah terhubung di dibales.ai. **WhatsApp Trigger** menangkap event masuk sebagai pemicu workflow, sementara **WhatsApp** (action node) berfungsi mengirim pesan.

**Pastikan kamu sudah:**

* Menginstall package `n8n-nodes-dibales-ai` di instance N8N kamu
* Menghubungkan akun WhatsApp ke dashboard dibales.ai [Integrasi Akun Whatsapp](/whatsapp/integrasi-akun-whatsapp.md)

## Node 1: WhatsApp Trigger

Memulai workflow setiap kali ada event masuk dari akun WhatsApp yang terhubung.

<figure><img src="/files/PoN30ZA66xn7w1CfP6DK" alt=""><figcaption></figcaption></figure>

#### Parameter

<figure><img src="/files/UfBiLFWNwz5WJc42UQ10" alt=""><figcaption></figcaption></figure>

| Parameter                             | Keterangan                                                                                                                                                                                              |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Webhook URLs**                      | URL endpoint yang didaftarkan ke dashboard dibales.ai. Tersedia dua mode: **Test URL** untuk pengujian saat workflow belum aktif, dan **Production URL** untuk workflow yang sudah aktif dan dipublish. |
| **Signature Verification (Opsional)** | String *webhook secret* yang disalin dari halaman Webhooks di dashboard dibales.ai. Digunakan untuk memverifikasi bahwa kiriman event benar-benar dari sistem dibales.ai.                               |

#### Setup

1. **Tambahkan node WhatsApp Trigger ke workflow kamu** Cari `dibales.ai - WhatsApp` di panel node N8N, pilih sebagai trigger.
2. **Salin Webhook URL** Buka node, expand bagian **Webhook URLs**, klik tab **Test URL & Production URL**, lalu *copy* URL-nya.
3. **Buka dashboard dibales.ai,** pilih agent yang ingin dihubungkan → halaman [**Webhooks**](https://cs.pake.ai/agent/integrations/webhooks) → klik **Tambah Webhook**.
4. **Paste** url webhook dari N8N untuk **Test URL**, dan ulangi dengan klik Tambah Webhook untuk **Production URL**

<figure><img src="/files/2vZfKUoA6FfrjvFIts2G" alt=""><figcaption></figcaption></figure>

**OPTIONAL**

{% hint style="info" %}
**Signature Verification (Webhook Secret)** berfungsi untuk mengamankan URL webhook agar tidak bisa diakses tanpa secret key tersebut. Silakan aktifkan jika diperlukan.
{% endhint %}

1. **Salin Webhook Secret** Setelah webhook dibuat, salin nilai **Secret** yang tampil di dashboard.

<figure><img src="/files/prB4HdQxAEaQO8tOGfNn" alt=""><figcaption></figcaption></figure>

2. **Paste Secret ke node** Kembali ke N8N, buka node Instagram Trigger, paste secret ke field **Webhook Secret**, lalu simpan workflow.

<figure><img src="/files/vk8yxJr6Gq09K10hJbH3" alt=""><figcaption></figcaption></figure>

✅ **Selesai!** Workflow akan aktif menerima event dari WhatsApp. Setiap event yang masuk akan muncul sebagai satu execution di tab **Executions**.

#### Output Ports

Node ini memiliki **8 output port**. Setiap port aktif untuk tipe event yang berbeda, sehingga kamu bisa membuat routing langsung dari satu trigger ke flow yang berbeda.

| Port                        | Event                                                          | Keterangan                                                                      |
| --------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **0. Message Received**     | Pesan masuk dari kontak                                        | Teks, gambar, video, audio, file, lokasi, atau kontak yang dikirim ke akun kamu |
| **1. Message Echo**         | Pesan yang dikirim dari akun kamu sendiri                      | Berguna untuk logging atau monitoring pesan keluar                              |
| **2. Reaction**             | Kontak menambahkan atau menghapus reaksi emoji pada pesan      | Field `data.reaction.action` berisi `added` atau `removed`                      |
| **4. Read Receipt**         | Pesan yang kamu kirim sudah dibaca oleh kontak                 |                                                                                 |
| **5. Account Connected**    | Akun WhatsApp berhasil terhubung ke sistem dibales.ai          | Berguna untuk notifikasi atau reset state                                       |
| **6. Account Disconnected** | Akun WhatsApp terputus dari sistem dibales.ai, butuh reconnect | Berguna untuk alerting otomatis                                                 |
| **7. Other**                | Event lain yang tidak masuk kategori di atas                   | Bisa dipakai untuk debugging atau menangkap event baru                          |

> 💡 Sambungkan hanya port yang kamu butuhkan. Port yang tidak terhubung tidak akan mempengaruhi performa workflow.

#### Struktur Data Trigger

Payload WhatsApp menggunakan key `data` (berbeda dengan Instagram dan TikTok yang menggunakan `raw`). Gunakan ekspresi berikut untuk mengakses field dari event di node selanjutnya:

**Field tersedia di semua event:**

| Field           | Ekspresi N8N              |
| --------------- | ------------------------- |
| Tipe event      | `{{ $json.event_type }}`  |
| Timestamp event | `{{ $json.occurred_at }}` |

**Untuk event pesan (`Message Received` dan `Message Echo`):**

| Field                  | Ekspresi N8N                          |
| ---------------------- | ------------------------------------- |
| Nomor telepon pengirim | `{{ $json.data.message.from.phone }}` |
| Nama kontak            | `{{ $json.data.message.from.name }}`  |
| WhatsApp ID pengirim   | `{{ $json.data.message.from.wa_id }}` |
| Tipe pesan             | `{{ $json.data.message.type }}`       |
| Isi teks               | `{{ $json.data.message.text }}`       |
| ID pesan               | `{{ $json.data.message.id }}`         |

> 💡 Untuk balas pesan masuk, gunakan `{{ $json.data.message.from.wa_id }}` sebagai **Chat ID** di node WhatsApp Send.

## Node 2: WhatsApp

Action node untuk mengirim pesan dan melakukan lookup kontak melalui akun WhatsApp di dibales.ai.

<figure><img src="/files/qDfoV3DK99kuggxJUPGb" alt=""><figcaption></figcaption></figure>

### Credential

Di field **Credential**, pilih credential dengan tipe **dibales.ai account**. Jika belum ada, buat credential baru dan isi dengan API Key yang tersedia di dashboard dibales.ai.

<figure><img src="/files/fPOUWpBVIamijkwCQW6H" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/OkmxkQNHcSmtXhtW75uI" alt=""><figcaption></figcaption></figure>

**Ambil API Key dari dashboard dibales.ai**

<figure><img src="/files/bbuPXTMVJoRUwtDtVTVj" alt=""><figcaption></figcaption></figure>

***

### Resource: Message

#### **Operation: Send**

<figure><img src="/files/uVge46fKlj2pNX7hY9Ty" alt=""><figcaption></figcaption></figure>

Kirim pesan ke kontak personal atau grup WhatsApp.

**Parameter utama yang selalu ada:**

| Parameter   | Keterangan                                                                            |
| ----------- | ------------------------------------------------------------------------------------- |
| **Chat ID** | ID chat tujuan. Format personal: `628xxxxxxxxxx@c.us`. Format grup: ID grup WhatsApp. |
| **Type**    | Pilih tipe pesan yang akan dikirim (lihat daftar di bawah).                           |

***

**Type: Text**

| Parameter                | Keterangan                                                                                                                                       |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Text**                 | Isi teks pesan. Mendukung format WhatsApp: `*bold*`, `_italic_`, `~strikethrough~`                                                               |
| **Disable Link Preview** | Toggle. Aktifkan untuk mencegah preview link muncul di bawah pesan. Default: OFF                                                                 |
| **Simulate Typing**      | Toggle. Aktifkan agar sistem menampilkan indikator "sedang mengetik" sesaat sebelum pesan terkirim. Memberikan kesan lebih natural. Default: OFF |
| **Reply To Message ID**  | (Opsional) Isi dengan `message_id` atau `platform_message_id` dari pesan sebelumnya untuk membuat reply berantai.                                |

***

**Type: Image / Video / Audio / File**

| Parameter | Keterangan                                                                           |
| --------- | ------------------------------------------------------------------------------------ |
| **URL**   | URL publik dari file media yang akan dikirim. File harus bisa diakses secara publik. |

***

**Type: Location**

| Parameter     | Keterangan                                  |
| ------------- | ------------------------------------------- |
| **Latitude**  | Koordinat lintang lokasi. Contoh: `-6.2088` |
| **Longitude** | Koordinat bujur lokasi. Contoh: `106.8456`  |

💡 Tambahkan **Name** dan **Address** lokasi lewat **Additional Fields** untuk tampilan yang lebih informatif di WhatsApp.

***

**Type: Contact (vCard)**

| Parameter | Keterangan                                                                      |
| --------- | ------------------------------------------------------------------------------- |
| **vCard** | String format vCard. Minimal berisi `FN` (full name) dan `TEL` (nomor telepon). |

Contoh vCard minimal:

```
BEGIN:VCARD
VERSION:3.0
FN:Nama Kontak
TEL:+628xxxxxxxxxx
END:VCARD
```

***

**Type: Poll**

| Parameter    | Keterangan                                                                               |
| ------------ | ---------------------------------------------------------------------------------------- |
| **Question** | Pertanyaan polling yang akan ditampilkan                                                 |
| **Options**  | Daftar pilihan jawaban. Klik **Add Option** untuk menambah pilihan baru. Minimal 2 opsi. |

***

#### **Operation: React**

Tambahkan reaksi emoji ke pesan yang sudah terkirim.

| Parameter                 | Keterangan                                                                                                  |
| ------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **Platform Message ID**   | ID pesan di WhatsApp yang akan diberi reaksi. Ambil dari output send node sebelumnya: `platform_message_id` |
| **Recipient Platform ID** | ID kontak penerima                                                                                          |
| **Reaction**              | Pilih emoji reaksi dari dropdown                                                                            |

***

#### **Operation: Mark Seen**

Tandai pesan masuk sebagai sudah dibaca. Tidak ada parameter tambahan selain Chat ID dan Message ID.

***

### Resource: Contact

Operasi untuk lookup dan verifikasi informasi kontak WhatsApp. Berguna untuk memvalidasi nomor sebelum mengirim pesan, atau untuk mendapatkan identifier yang dibutuhkan oleh sistem.

| Operation            | Fungsi                                         | Parameter Utama                                      |
| -------------------- | ---------------------------------------------- | ---------------------------------------------------- |
| **Check Phone**      | Cek apakah nomor telepon terdaftar di WhatsApp | `Phone`: nomor format E.164, contoh `+628xxxxxxxxxx` |
| **Get LID by Phone** | Ambil WhatsApp LID dari nomor telepon          | `Phone`: nomor format E.164                          |
| **Get Phone by LID** | Ambil nomor telepon dari WhatsApp LID          | `LID`: WhatsApp LID kontak                           |
| **Get Detail**       | Ambil informasi detail profil kontak           | Identifier kontak                                    |

> 💡 **LID (Linked ID)** adalah identifier internal WhatsApp yang digunakan di beberapa endpoint API. Jika kamu mendapatkan LID dari trigger event, gunakan **Get Phone by LID** untuk mendapatkan nomor teleponnya.

***

#### Output Data

Semua operation di **Resource: Message > Send** mengembalikan output dengan struktur yang konsisten:

| Field                 | Tipe              | Keterangan                                                                 |
| --------------------- | ----------------- | -------------------------------------------------------------------------- |
| `message_id`          | String            | ID pesan di sistem dibales.ai                                              |
| `platform_message_id` | String            | ID pesan asli di WhatsApp. Gunakan ini untuk operation React atau Reply To |
| `sent_at`             | String (ISO 8601) | Timestamp saat pesan terkirim                                              |

Akses field ini di node berikutnya dengan ekspresi: `{{ $json.message_id }}`, `{{ $json.platform_message_id }}`, dst.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dibales.ai/n8n/whatsapp-nodes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
