n8n-nodes-occasio 1.2.0 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,331 +1,70 @@
1
- # n8n-nodes-kirimchat
1
+ # n8n-nodes-chatplatform
2
2
 
3
- This is an n8n community node for [KirimChat](https://kirim.chat) - a messaging platform that integrates WhatsApp Business API, Instagram DM, and Facebook Messenger.
3
+ n8n community node untuk mengirim pesan WhatsApp, Instagram DM, dan Facebook Messenger.
4
4
 
5
5
  ## Features
6
6
 
7
- - **Send Message** - Send text, image, document, audio, video, template, or interactive messages via WhatsApp, Instagram, or Messenger
8
- - **List Templates** - List all WhatsApp message templates with filtering
9
- - **Get Template** - Get a specific template by ID
10
- - **Mark as Read** - Mark messages as read and send read receipts
11
- - **Send Typing Indicator** - Show typing indicator to customers
12
- - **Flexible Customer Lookup** - Find customers by ID, phone number, or Instagram username
7
+ - **Send Message** - Kirim text, image, document, audio, video, template, atau interactive message
8
+ - **List Templates** - Lihat daftar WhatsApp message templates
9
+ - **Get Template** - Ambil detail template by ID
10
+ - **Mark as Read** - Tandai pesan sebagai sudah dibaca
11
+ - **Send Typing Indicator** - Tampilkan indikator mengetik
13
12
 
14
13
  ## Installation
15
14
 
16
- ### Community Nodes (Recommended)
15
+ ### Via n8n Community Nodes
17
16
 
18
- 1. Go to **Settings > Community Nodes**
19
- 2. Select **Install**
20
- 3. Enter `@kichat/n8n-nodes-kirimchat` and confirm
17
+ 1. Buka **Settings > Community Nodes**
18
+ 2. Klik **Install**
19
+ 3. Masukkan nama package dan confirm
21
20
 
22
- ## Credentials
23
-
24
- You need a KirimChat API key to use this node:
25
-
26
- 1. Log in to your KirimChat dashboard
27
- 2. Go to **Settings > Developers > API Keys**
28
- 3. Click **Create API Key** and copy the key (shown only once)
29
- 4. In n8n, create new credentials for **KirimChat API**
30
- 5. Paste your API key (starts with `kc_live_`)
31
-
32
- ## Operations
33
-
34
- ### Send Message
35
-
36
- Send a message to a customer via WhatsApp, Instagram, or Messenger.
37
-
38
- #### Customer Lookup Options
39
-
40
- | Method | Description | Example |
41
- |--------|-------------|---------|
42
- | Customer ID | KirimChat customer ID | `cust_abc123` |
43
- | Phone Number | Phone with country code | `+6281234567890` |
44
- | Instagram Username | Instagram username | `johndoe` |
45
-
46
- #### Channels & Message Types
47
-
48
- | Channel | Message Types |
49
- |---------|---------------|
50
- | **WhatsApp** | `text`, `image`, `document`, `audio`, `video`, `template`, `interactive` |
51
- | **Instagram** | `text`, `image`, `media_share` |
52
- | **Messenger** | `text`, `image`, `video`, `audio`, `file` |
53
-
54
- #### Parameters
55
-
56
- | Parameter | Description |
57
- |-----------|-------------|
58
- | Customer Lookup | How to identify the customer |
59
- | Channel | `whatsapp`, `instagram`, or `messenger` |
60
- | Message Type | Type of message (varies by channel) |
61
- | Content | Text content for text messages |
62
- | Media URL | URL of media file for media messages |
63
- | Caption | Optional caption for media messages |
64
- | Filename | Filename for document/file messages |
65
-
66
- #### WhatsApp Template Messages
67
-
68
- Templates can be selected from a dropdown or entered manually.
21
+ ### Manual Installation
69
22
 
70
- | Parameter | Description |
71
- |-----------|-------------|
72
- | Template | Select from approved templates. Shows variable count e.g. `[2 var]` |
73
- | Template Variables | Comma-separated values. Example: `John, ORD-123` |
74
- | Enter Template Manually | Toggle to type template name/language |
75
-
76
- **Example:**
77
-
78
- Template: `Hello {{1}}, your order {{2}} is ready!`
79
-
80
- Template Variables: `John, ORD-123`
81
-
82
- Result: "Hello John, your order ORD-123 is ready!"
83
-
84
- **Advanced (Manual Mode with JSON):**
85
- ```json
86
- [
87
- {
88
- "type": "body",
89
- "parameters": [
90
- { "type": "text", "text": "John" },
91
- { "type": "text", "text": "12345" }
92
- ]
93
- }
94
- ]
23
+ ```bash
24
+ cd ~/.n8n/nodes
25
+ npm install nama-package
95
26
  ```
96
27
 
97
- #### WhatsApp Interactive Messages
98
-
99
- Send buttons with your messages:
100
-
101
- **CTA URL Button:**
102
- | Parameter | Description |
103
- |-----------|-------------|
104
- | Interactive Type | `cta_url` |
105
- | Body Text | Main message text (max 1024 chars) |
106
- | Header Text | Optional header (max 60 chars) |
107
- | Footer Text | Optional footer (max 60 chars) |
108
- | Button Text | Text on button (max 20 chars) |
109
- | Button URL | URL to open |
28
+ ## Credentials
110
29
 
111
- **Reply Buttons:**
112
- | Parameter | Description |
113
- |-----------|-------------|
114
- | Interactive Type | `button` |
115
- | Body Text | Main message text |
116
- | Buttons (JSON) | Array of 1-3 buttons |
30
+ 1. Login ke dashboard platform Anda
31
+ 2. Buka **Settings > Developers > API Keys**
32
+ 3. Buat API Key baru
33
+ 4. Di n8n, buat credentials baru dan paste API key
117
34
 
118
- **Example Reply Buttons:**
119
- ```json
120
- [
121
- { "id": "yes", "title": "Yes" },
122
- { "id": "no", "title": "No" },
123
- { "id": "maybe", "title": "Maybe" }
124
- ]
125
- ```
35
+ ## Operations
126
36
 
127
- **Example Response:**
128
- ```json
129
- {
130
- "success": true,
131
- "data": {
132
- "message_id": "msg_xyz789",
133
- "status": "sent",
134
- "channel": "whatsapp",
135
- "timestamp": "2025-11-26T10:31:00.000Z"
136
- }
137
- }
138
- ```
37
+ ### Send Message
139
38
 
140
- ### Mark as Read
39
+ Kirim pesan ke customer via WhatsApp, Instagram, atau Messenger.
141
40
 
142
- Mark a message as read and send read receipt to the customer.
41
+ **Customer Lookup:**
42
+ | Method | Contoh |
43
+ |--------|--------|
44
+ | Customer ID | `cust_abc123` |
45
+ | Phone Number | `+6281234567890` |
46
+ | Instagram Username | `johndoe` |
143
47
 
144
- | Parameter | Description |
145
- |-----------|-------------|
146
- | Message ID | The ID of the message to mark as read (e.g., `msg_xyz789`) |
48
+ **Message Types:**
49
+ | Channel | Types |
50
+ |---------|-------|
51
+ | WhatsApp | text, image, document, audio, video, template, interactive |
52
+ | Instagram | text, image, media_share |
53
+ | Messenger | text, image, video, audio, file |
147
54
 
148
55
  ### List Templates
149
56
 
150
- List all WhatsApp message templates with optional filtering.
151
-
152
- | Parameter | Description |
153
- |-----------|-------------|
154
- | Filter by Status | `All`, `APPROVED`, `PENDING`, or `REJECTED` |
155
- | Filter by Category | `All`, `MARKETING`, `UTILITY`, or `AUTHENTICATION` |
156
- | Limit | Maximum templates to return (1-500, default 100) |
57
+ Filter WhatsApp templates by:
58
+ - Status: APPROVED, PENDING, REJECTED
59
+ - Category: MARKETING, UTILITY, AUTHENTICATION
157
60
 
158
- **Example Response:**
159
- ```json
160
- {
161
- "success": true,
162
- "data": {
163
- "templates": [
164
- {
165
- "id": "tpl_abc123",
166
- "templateName": "order_confirmation",
167
- "language": "en",
168
- "status": "APPROVED",
169
- "category": "UTILITY",
170
- "content": "Your order {{1}} has been confirmed.",
171
- "headerType": "TEXT",
172
- "headerContent": "Order Update",
173
- "footerContent": "Thank you for shopping!",
174
- "variables": ["order_number"],
175
- "createdAt": "2025-01-15T10:00:00.000Z"
176
- }
177
- ],
178
- "total": 1
179
- }
180
- }
181
- ```
182
-
183
- ### Get Template
184
-
185
- Get a specific WhatsApp message template by ID.
186
-
187
- | Parameter | Description |
188
- |-----------|-------------|
189
- | Template ID | The ID of the template (e.g., `tpl_abc123`) |
61
+ ### Mark as Read
190
62
 
191
- **Example Response:**
192
- ```json
193
- {
194
- "success": true,
195
- "data": {
196
- "id": "tpl_abc123",
197
- "templateName": "order_confirmation",
198
- "language": "en",
199
- "status": "APPROVED",
200
- "category": "UTILITY",
201
- "content": "Your order {{1}} has been confirmed.",
202
- "headerType": "TEXT",
203
- "headerContent": "Order Update",
204
- "footerContent": "Thank you for shopping!",
205
- "buttons": [
206
- { "type": "URL", "text": "Track Order", "url": "https://..." }
207
- ],
208
- "variables": ["order_number"],
209
- "createdAt": "2025-01-15T10:00:00.000Z",
210
- "updatedAt": "2025-01-15T10:00:00.000Z"
211
- }
212
- }
213
- ```
63
+ Kirim read receipt untuk pesan masuk.
214
64
 
215
65
  ### Send Typing Indicator
216
66
 
217
- Show typing indicator to a customer before sending a message.
218
-
219
- | Parameter | Description |
220
- |-----------|-------------|
221
- | Customer Lookup | How to identify the customer |
222
- | Customer ID/Phone/Username | Customer identifier |
223
- | Channel | `whatsapp`, `instagram`, or auto-detect |
224
-
225
- > **Note:** Rate limited to 1 request per customer per 3 seconds.
226
-
227
- ## Webhook Trigger
228
-
229
- KirimChat supports outbound webhooks for real-time event notifications. Configure webhooks in your KirimChat dashboard under **Settings > Developers > Webhooks**.
230
-
231
- ### Supported Events
232
-
233
- - `message.received` - New message from customer
234
- - `message.sent` - Message sent to customer
235
- - `message.delivered` - Message delivered
236
- - `message.read` - Message read by customer
237
- - `message.failed` - Message delivery failed
238
-
239
- ### Webhook Payload Example
240
-
241
- ```json
242
- {
243
- "event_type": "message.received",
244
- "event_id": "evt_abc123",
245
- "timestamp": "2025-11-26T10:30:00.000Z",
246
- "data": {
247
- "message_id": "msg_xyz789",
248
- "customer_id": "cust_123",
249
- "customer_phone": "+6281234567890",
250
- "direction": "inbound",
251
- "message_type": "text",
252
- "content": "Hello!",
253
- "channel": "whatsapp"
254
- }
255
- }
256
- ```
257
-
258
- ### Using with n8n Webhook Node
259
-
260
- 1. Create a new workflow with **Webhook** trigger node
261
- 2. Copy the webhook URL
262
- 3. In KirimChat, create a webhook endpoint with this URL
263
- 4. Select the events you want to receive
264
- 5. Connect the webhook to your KirimChat node for automated responses
265
-
266
- ## Rate Limits
267
-
268
- | Limit Type | Rate |
269
- |------------|------|
270
- | Global | 100 requests per minute per API key |
271
- | WhatsApp | 60 messages per minute |
272
- | Instagram | 180 messages per hour |
273
- | Messenger | 180 messages per hour |
274
- | Typing Indicator | 1 request per customer per 3 seconds |
275
-
276
- ## Error Handling
277
-
278
- The node returns standard error responses:
279
-
280
- | Code | Description |
281
- |------|-------------|
282
- | 401 | Invalid or expired API key |
283
- | 403 | Account disconnected or forbidden |
284
- | 404 | Resource not found |
285
- | 400 | Invalid request or messaging window closed |
286
- | 429 | Rate limit exceeded |
287
-
288
- ### Common Error Codes
289
-
290
- | Error Code | Description |
291
- |------------|-------------|
292
- | `ValidationError` | Invalid input parameters |
293
- | `WindowClosed` | 24-hour messaging window expired |
294
- | `ConfigurationError` | Channel not configured |
295
- | `ConnectionError` | Account disconnected |
296
- | `RateLimitExceeded` | Too many requests |
297
-
298
- ## Changelog
299
-
300
- ### v1.2.0 (Latest)
301
- - ✅ Added **Template Dropdown** - Select templates from dropdown (auto-loaded from API)
302
- - ✅ Added **Simple Variables** - Add template variables without writing JSON
303
- - ✅ Added **List Templates** operation - List all WhatsApp templates with filtering
304
- - ✅ Added **Get Template** operation - Get template details by ID
305
- - ✅ Filter templates by status (Approved, Pending, Rejected)
306
- - ✅ Filter templates by category (Marketing, Utility, Authentication)
307
- - ✅ Improved template UX - No more manual JSON for simple use cases
308
-
309
- ### v1.1.0
310
- - ✅ Added Messenger channel support
311
- - ✅ Added customer lookup by phone number and Instagram username
312
- - ✅ Added WhatsApp Interactive messages (CTA URL buttons, Reply buttons)
313
- - ✅ Improved typing indicator with flexible customer lookup
314
- - ✅ Enhanced error messages
315
-
316
- ### v1.0.5
317
- - Enhanced validation for media URLs
318
- - Template components structure validation
319
-
320
- ### v1.0.1
321
- - Initial security improvements
322
- - JSON validation for templates
323
- - Base URL security warning
324
-
325
- ## Resources
326
-
327
- - [KirimChat Documentation](https://kirim.chat/developers)
328
- - [n8n Community Nodes](https://docs.n8n.io/integrations/community-nodes/)
67
+ Tampilkan typing indicator ke customer (rate limit: 1x per 3 detik).
329
68
 
330
69
  ## License
331
70
 
@@ -21,9 +21,9 @@ exports.getBrandConfig = getBrandConfig;
21
21
  * Get brand configuration from environment variables with defaults
22
22
  */
23
23
  function getBrandConfig() {
24
- const displayName = process.env.N8N_NODE_BRAND_NAME || 'OccasioNode';
25
- const brandId = process.env.N8N_NODE_BRAND_ID || 'occasioNode';
26
- const apiKeyPrefix = process.env.N8N_NODE_API_KEY_PREFIX || 'kc_live_';
24
+ const displayName = process.env.N8N_NODE_BRAND_NAME || 'OccasioChat';
25
+ const brandId = process.env.N8N_NODE_BRAND_ID || 'occasioChat';
26
+ const apiKeyPrefix = process.env.N8N_NODE_API_KEY_PREFIX || 'oc_live_';
27
27
  return {
28
28
  // Display & Identity
29
29
  displayName,
@@ -32,15 +32,15 @@ function getBrandConfig() {
32
32
  description: process.env.N8N_NODE_DESCRIPTION ||
33
33
  'Send WhatsApp, Instagram & Messenger messages with interactive buttons, flexible customer lookup, and typing indicators',
34
34
  // URLs
35
- apiBaseUrl: process.env.N8N_NODE_API_BASE_URL || 'https://api.occasio.id/api/v1/public',
36
- documentationUrl: process.env.N8N_NODE_DOCS_URL || 'https://occasio.id/en/developers',
37
- homepage: process.env.N8N_NODE_HOMEPAGE || 'https://occasio.id',
35
+ apiBaseUrl: process.env.N8N_NODE_API_BASE_URL || 'https://api-multi.occasio.id/api/v1/public',
36
+ documentationUrl: process.env.N8N_NODE_DOCS_URL || 'https://chat.occasio.id',
37
+ homepage: process.env.N8N_NODE_HOMEPAGE || 'https://chat.occasio.id',
38
38
  // Support
39
39
  supportEmail: process.env.N8N_NODE_SUPPORT_EMAIL || 'support@occasio.id',
40
40
  author: process.env.N8N_NODE_AUTHOR || displayName,
41
41
  // API Key
42
42
  apiKeyPrefix,
43
- apiKeyPlaceholder: `${apiKeyPrefix}your_api_key_here`,
43
+ apiKeyPlaceholder: `oc_live_`,
44
44
  };
45
45
  }
46
46
  // Export singleton instance for use in node/credentials
@@ -3,6 +3,7 @@ export declare class ChatPlatform implements INodeType {
3
3
  description: INodeTypeDescription;
4
4
  methods: {
5
5
  loadOptions: {
6
+ getWhatsAppPhoneNumbers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
6
7
  getInstagramAccounts(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
8
  getFacebookPages(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
8
9
  getTemplates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;