Overview
Quick Start
- Add a new device from the Devices page
- Scan the QR code with your WhatsApp
- Start sending messages via API or the Send Message page
Add New Device
| Time | Device | Recipient | Message | Status |
|---|---|---|---|---|
| No messages yet | ||||
Webhook Settings
Register webhook URL dari n8n untuk menerima notifikasi pesan masuk WhatsApp.
Registered Webhooks
No webhooks registered yet
Cara Pakai dengan n8n
- Di n8n, tambahkan node Webhook
- Copy URL webhook dari n8n
- Paste URL di form di atas dan klik Add Webhook
- Setiap ada pesan WA masuk, n8n akan menerima trigger!
Data yang Diterima n8n:
{
"event": "message.incoming",
"from": "628123456789",
"from_name": "John Doe",
"message": "Halo!",
"message_type": "text"
}
Live Incoming Logs
No logs yet. Send a message to your WhatsApp.
API Documentation
Base URL: http://localhost/natochat_api
Authentication
All API endpoints require the following header:
Authorization: Bearer YOUR_API_KEY
Endpoints
/api/messages/send.php
Send a text message
{
"device_id": 1,
"phone": "628123456789",
"message": "Hello World!"
}
/api/devices/list.php
Get all devices
/api/devices/add.php
Add a new device
{
"name": "My WhatsApp"
}
/api/messages/history.php
Get message history (supports pagination: ?page=1&per_page=20)
Tutorial: Integrasi n8n AI Agent
Pelajari cara membuat AI Agent WhatsApp menggunakan n8n workflow automation.
1 Buat Workflow
- Buka n8n instance Anda (cloud/self-hosted)
- Klik Create New Workflow
- Import template atau buat manual
2 Setup Webhook
- Tambah node Webhook
- Set Method: POST
- Set Path: wa-incoming
- Daftarkan URL di menu Webhooks
3 Format Data
Tambah node Set:
chatInput = {{ $json.body.message }}
from = {{ $json.body.from }}
from_name = {{ $json.body.from_name }}
4 Setup AI Agent
- Tambah node AI Agent
- Tambah Chat Model (Groq/OpenAI)
- Tambah Simple Memory
- Set system prompt
5 Kirim Balasan
Tambah node HTTP Request:
{
"device_id": YOUR_DEVICE_ID,
"reply_jid": "..@lid",
"message": "{{ $json.output }}"
}
6 Setup Credentials
- Buka Settings → Credentials
- Tambah Header Auth
- Name:
Authorization - Value:
Bearer YOUR_API_KEY
Template Workflow n8n
Copy JSON di bawah ini dan import ke n8n Anda (Menu → Import from File → Paste JSON)
{
"nodes": [
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "chatInput",
"name": "chatInput",
"value": "={{ $json.body.message }}",
"type": "string"
},
{
"id": "from",
"name": "from",
"value": "={{ $json.body.from }}",
"type": "string"
},
{
"id": "from_name",
"name": "from_name",
"value": "={{ $json.body.from_name }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [304, -880],
"id": "f67c87f4-bfa9-4652-8961-2749e6e193c2",
"name": "Format Input"
},
{
"parameters": {
"options": {
"systemMessage": "Kamu adalah asisten virtual NatoChat. Jawablah pertanyaan pelanggan dengan bahasa indonesia sangat sopan dan ramah. Berikan jawaban yang singkat dan jelas tanpa emoji.\n"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [496, -880],
"id": "7c269232-7453-41e9-a99a-a7353ffc1a94",
"name": "AI Agent"
},
{
"parameters": {
"httpMethod": "POST",
"path": "wa-incoming",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [96, -880],
"id": "e13d755e-51b8-496c-9381-28dfea56a091",
"name": "Webhook WA Incoming",
"webhookId": "wa-incoming"
},
{
"parameters": {
"method": "POST",
"url": "https://api.natochat.my.id/api/messages/send.php",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"device_id\": 1,\n \"reply_jid\": \"{{ $('Format Input').item.json.from }}@lid\",\n \"message\": \"{{ $json.output }}\"\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [864, -864],
"id": "ddca5a42-c7b7-44db-9107-3199a15bfa5a",
"name": "Kirim Balasan WA"
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('Format Input').item.json.from }}",
"contextWindowLength": 10
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [656, -528],
"id": "2fec3ce2-e01c-4145-9845-d3e5732cbaac",
"name": "Simple Memory"
},
{
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"typeVersion": 1,
"position": [432, -624],
"id": "fb6512c5-8ae5-40dd-8e8d-2cfcc8387972",
"name": "Groq Chat Model"
}
],
"connections": {
"Format Input": {
"main": [[{"node": "AI Agent", "type": "main", "index": 0}]]
},
"AI Agent": {
"main": [[{"node": "Kirim Balasan WA", "type": "main", "index": 0}]]
},
"Webhook WA Incoming": {
"main": [[{"node": "Format Input", "type": "main", "index": 0}]]
},
"Simple Memory": {
"ai_memory": [[{"node": "AI Agent", "type": "ai_memory", "index": 0}]]
},
"Groq Chat Model": {
"ai_languageModel": [[{"node": "AI Agent", "type": "ai_languageModel", "index": 0}]]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true
}
}
Penting: Sebelum Menggunakan Template
- Ganti
device_idsesuai ID device WhatsApp Anda - Setup credential Header Auth dengan API Key Anda
- Setup credential Groq API (gratis di console.groq.com)
- Daftarkan URL webhook n8n di halaman Webhooks