@renatoascencio/n8n-nodes-chatwoot 0.5.0 → 0.6.1
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 +116 -8
- package/dist/nodes/Chatwoot/Chatwoot.node.js +292 -0
- package/dist/nodes/Chatwoot/Chatwoot.node.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/company/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/company/create.operation.js +40 -0
- package/dist/nodes/Chatwoot/resources/company/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/company/delete.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/company/delete.operation.js +15 -0
- package/dist/nodes/Chatwoot/resources/company/delete.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/company/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/company/get.operation.js +15 -0
- package/dist/nodes/Chatwoot/resources/company/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/company/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/company/getAll.operation.js +46 -0
- package/dist/nodes/Chatwoot/resources/company/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/company/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/company/index.js +34 -0
- package/dist/nodes/Chatwoot/resources/company/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/company/search.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/company/search.operation.js +32 -0
- package/dist/nodes/Chatwoot/resources/company/search.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/company/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/company/update.operation.js +47 -0
- package/dist/nodes/Chatwoot/resources/company/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/contactableInboxes.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/contactableInboxes.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/contact/contactableInboxes.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/exportContacts.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/exportContacts.operation.js +35 -0
- package/dist/nodes/Chatwoot/resources/contact/exportContacts.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/importContacts.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/importContacts.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/contact/importContacts.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/index.js +24 -0
- package/dist/nodes/Chatwoot/resources/contact/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/conversation/index.js +16 -0
- package/dist/nodes/Chatwoot/resources/conversation/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/conversation/toggleTyping.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/toggleTyping.operation.js +51 -0
- package/dist/nodes/Chatwoot/resources/conversation/toggleTyping.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/transcript.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/transcript.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/conversation/transcript.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/download.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/download.operation.js +35 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/download.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/index.js +19 -1
- package/dist/nodes/Chatwoot/resources/csatSurvey/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/csatSurvey/metrics.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/metrics.operation.js +35 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/metrics.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/index.js +24 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/helpCenter/listArticles.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listArticles.operation.js +90 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listArticles.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listCategories.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listCategories.operation.js +33 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listCategories.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listPortals.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listPortals.operation.js +5 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/listPortals.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/search/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/search/index.js +28 -0
- package/dist/nodes/Chatwoot/resources/search/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/search/searchAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/search/searchAll.operation.js +15 -0
- package/dist/nodes/Chatwoot/resources/search/searchAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/search/searchContacts.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/search/searchContacts.operation.js +32 -0
- package/dist/nodes/Chatwoot/resources/search/searchContacts.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/search/searchConversations.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/search/searchConversations.operation.js +32 -0
- package/dist/nodes/Chatwoot/resources/search/searchConversations.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/search/searchMessages.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/search/searchMessages.operation.js +32 -0
- package/dist/nodes/Chatwoot/resources/search/searchMessages.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/create.operation.js +60 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/delete.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/delete.operation.js +15 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/delete.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/get.operation.js +15 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/getAll.operation.js +5 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/index.js +31 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/update.operation.js +67 -0
- package/dist/nodes/Chatwoot/resources/slaPolicy/update.operation.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,10 +17,10 @@ A comprehensive n8n community node for [Chatwoot](https://www.chatwoot.com/) - t
|
|
|
17
17
|
|
|
18
18
|
## Highlights
|
|
19
19
|
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
20
|
+
- **35 Resources** - Comprehensive coverage of Application, Platform, and Public APIs
|
|
21
|
+
- **195+ Operations** - Complete CRUD operations for all resources
|
|
22
22
|
- **3 API Types** - Application API, Platform API, and Public API support
|
|
23
|
-
- **Trigger Node** - Real-time webhook events from Chatwoot
|
|
23
|
+
- **Trigger Node** - Real-time webhook events (10 event types) from Chatwoot
|
|
24
24
|
- **Dynamic Dropdowns** - Auto-populated lists for agents, teams, inboxes, and labels
|
|
25
25
|
- **Smart Pagination** - Automatic handling with "Return All" option
|
|
26
26
|
- **Reports & Analytics** - Access conversation and agent statistics
|
|
@@ -132,8 +132,8 @@ Used for client-side/widget operations - creating contacts and conversations fro
|
|
|
132
132
|
|
|
133
133
|
### Chatwoot Node
|
|
134
134
|
|
|
135
|
-
The main node for interacting with Chatwoot APIs. Supports
|
|
136
|
-
- **Application API** (
|
|
135
|
+
The main node for interacting with Chatwoot APIs. Supports 35 resources across three API types:
|
|
136
|
+
- **Application API** (28 resources) - Core operations for conversations, contacts, messages, macros, notifications, campaigns, companies, SLA policies, global search, etc.
|
|
137
137
|
- **Platform API** (4 resources) - Admin operations for accounts, users, and agent bots
|
|
138
138
|
- **Public API** (3 resources) - Client-side operations for widgets and external integrations
|
|
139
139
|
|
|
@@ -141,14 +141,16 @@ The main node for interacting with Chatwoot APIs. Supports 27 resources across t
|
|
|
141
141
|
|
|
142
142
|
Webhook-based trigger that starts workflows when events occur in Chatwoot. Automatically registers and manages webhooks in your Chatwoot account.
|
|
143
143
|
|
|
144
|
-
**Supported Events:**
|
|
144
|
+
**Supported Events (10 total):**
|
|
145
|
+
- `contact_created` - New contact added
|
|
146
|
+
- `contact_updated` - Contact information changed
|
|
145
147
|
- `conversation_created` - New conversation started
|
|
146
148
|
- `conversation_status_changed` - Status changed (open/resolved/pending/snoozed)
|
|
149
|
+
- `conversation_typing_off` - Typing indicator stopped
|
|
150
|
+
- `conversation_typing_on` - Typing indicator started
|
|
147
151
|
- `conversation_updated` - Conversation modified
|
|
148
152
|
- `message_created` - New message sent or received
|
|
149
153
|
- `message_updated` - Message edited
|
|
150
|
-
- `contact_created` - New contact added
|
|
151
|
-
- `contact_updated` - Contact information changed
|
|
152
154
|
- `webwidget_triggered` - Web widget interaction
|
|
153
155
|
|
|
154
156
|
---
|
|
@@ -203,6 +205,9 @@ Full contact management with search and merge capabilities.
|
|
|
203
205
|
| **Filter** | Filter contacts with advanced criteria |
|
|
204
206
|
| **Add Labels** | Add labels to a contact |
|
|
205
207
|
| **List Labels** | Get all labels for a contact |
|
|
208
|
+
| **Import** | Import contacts from CSV file (binary upload) |
|
|
209
|
+
| **Export** | Export contacts as CSV |
|
|
210
|
+
| **Contactable Inboxes** | Get inboxes that can reach a contact |
|
|
206
211
|
|
|
207
212
|
### Conversation
|
|
208
213
|
|
|
@@ -222,6 +227,12 @@ Manage customer conversations with assignment and labeling.
|
|
|
222
227
|
| **Filter** | Filter conversations with advanced criteria |
|
|
223
228
|
| **Update Custom Attributes** | Set custom attributes on conversation |
|
|
224
229
|
| **Get Meta** | Get conversation metadata |
|
|
230
|
+
| **Mute** | Mute a conversation |
|
|
231
|
+
| **Unmute** | Unmute a conversation |
|
|
232
|
+
| **Delete** | Delete a conversation |
|
|
233
|
+
| **Search** | Search conversations by query |
|
|
234
|
+
| **Transcript** | Send conversation transcript via email |
|
|
235
|
+
| **Toggle Typing** | Show/hide typing indicator |
|
|
225
236
|
|
|
226
237
|
### Custom Attribute
|
|
227
238
|
|
|
@@ -393,6 +404,103 @@ Access customer satisfaction surveys.
|
|
|
393
404
|
| Operation | Description |
|
|
394
405
|
|-----------|-------------|
|
|
395
406
|
| **Get** | Get CSAT survey for a conversation |
|
|
407
|
+
| **Metrics** | Get CSAT survey metrics summary |
|
|
408
|
+
| **Download** | Download CSAT survey responses |
|
|
409
|
+
|
|
410
|
+
### Macro
|
|
411
|
+
|
|
412
|
+
Manage reusable action sequences.
|
|
413
|
+
|
|
414
|
+
| Operation | Description |
|
|
415
|
+
|-----------|-------------|
|
|
416
|
+
| **Get Many** | List all macros |
|
|
417
|
+
| **Get** | Retrieve a macro by ID |
|
|
418
|
+
| **Create** | Create a new macro with actions |
|
|
419
|
+
| **Update** | Modify macro settings |
|
|
420
|
+
| **Delete** | Remove a macro |
|
|
421
|
+
| **Execute** | Execute a macro on a conversation |
|
|
422
|
+
|
|
423
|
+
### Notification
|
|
424
|
+
|
|
425
|
+
Manage agent notifications.
|
|
426
|
+
|
|
427
|
+
| Operation | Description |
|
|
428
|
+
|-----------|-------------|
|
|
429
|
+
| **Get Many** | List notifications (with read/snoozed filters) |
|
|
430
|
+
| **Mark Read** | Mark a notification as read |
|
|
431
|
+
| **Mark Unread** | Mark a notification as unread |
|
|
432
|
+
| **Mark All Read** | Mark all notifications as read |
|
|
433
|
+
| **Delete** | Remove a notification |
|
|
434
|
+
| **Unread Count** | Get count of unread notifications |
|
|
435
|
+
|
|
436
|
+
### Campaign
|
|
437
|
+
|
|
438
|
+
Manage outbound campaigns.
|
|
439
|
+
|
|
440
|
+
| Operation | Description |
|
|
441
|
+
|-----------|-------------|
|
|
442
|
+
| **Get Many** | List all campaigns |
|
|
443
|
+
| **Get** | Retrieve a campaign by ID |
|
|
444
|
+
| **Create** | Create a new campaign |
|
|
445
|
+
| **Update** | Modify campaign settings |
|
|
446
|
+
| **Delete** | Remove a campaign |
|
|
447
|
+
|
|
448
|
+
### Contact Note
|
|
449
|
+
|
|
450
|
+
Manage notes on contacts.
|
|
451
|
+
|
|
452
|
+
| Operation | Description |
|
|
453
|
+
|-----------|-------------|
|
|
454
|
+
| **Get Many** | List all notes for a contact |
|
|
455
|
+
| **Create** | Create a note on a contact |
|
|
456
|
+
| **Update** | Modify a contact note |
|
|
457
|
+
| **Delete** | Remove a contact note |
|
|
458
|
+
|
|
459
|
+
### Conversation Participant
|
|
460
|
+
|
|
461
|
+
Manage conversation watchers/participants.
|
|
462
|
+
|
|
463
|
+
| Operation | Description |
|
|
464
|
+
|-----------|-------------|
|
|
465
|
+
| **Get Many** | List participants of a conversation |
|
|
466
|
+
| **Add** | Add participants to a conversation |
|
|
467
|
+
| **Remove** | Remove participants from a conversation |
|
|
468
|
+
|
|
469
|
+
### Company (Enterprise)
|
|
470
|
+
|
|
471
|
+
Manage B2B companies. Requires Chatwoot Enterprise.
|
|
472
|
+
|
|
473
|
+
| Operation | Description |
|
|
474
|
+
|-----------|-------------|
|
|
475
|
+
| **Get Many** | List all companies with sorting |
|
|
476
|
+
| **Get** | Retrieve a company by ID |
|
|
477
|
+
| **Create** | Create a new company |
|
|
478
|
+
| **Update** | Modify company settings |
|
|
479
|
+
| **Delete** | Remove a company |
|
|
480
|
+
| **Search** | Search companies by name or domain |
|
|
481
|
+
|
|
482
|
+
### SLA Policy (Enterprise)
|
|
483
|
+
|
|
484
|
+
Manage SLA policies. Requires Chatwoot Enterprise.
|
|
485
|
+
|
|
486
|
+
| Operation | Description |
|
|
487
|
+
|-----------|-------------|
|
|
488
|
+
| **Get Many** | List all SLA policies |
|
|
489
|
+
| **Get** | Retrieve an SLA policy by ID |
|
|
490
|
+
| **Create** | Create an SLA policy with thresholds |
|
|
491
|
+
| **Update** | Modify SLA policy settings |
|
|
492
|
+
| **Delete** | Remove an SLA policy |
|
|
493
|
+
|
|
494
|
+
### Search (Global)
|
|
495
|
+
|
|
496
|
+
Search across all entities.
|
|
497
|
+
|
|
498
|
+
| Operation | Description |
|
|
499
|
+
|-----------|-------------|
|
|
500
|
+
| **Search All** | Search across conversations, contacts, and messages |
|
|
501
|
+
| **Search Conversations** | Search conversations only |
|
|
502
|
+
| **Search Contacts** | Search contacts only |
|
|
503
|
+
| **Search Messages** | Search messages only |
|
|
396
504
|
|
|
397
505
|
---
|
|
398
506
|
|
|
@@ -28,6 +28,9 @@ const notification_1 = require("./resources/notification");
|
|
|
28
28
|
const campaign_1 = require("./resources/campaign");
|
|
29
29
|
const contactNote_1 = require("./resources/contactNote");
|
|
30
30
|
const conversationParticipant_1 = require("./resources/conversationParticipant");
|
|
31
|
+
const company_1 = require("./resources/company");
|
|
32
|
+
const search_1 = require("./resources/search");
|
|
33
|
+
const slaPolicy_1 = require("./resources/slaPolicy");
|
|
31
34
|
const platformAccount_1 = require("./resources/platformAccount");
|
|
32
35
|
const platformUser_1 = require("./resources/platformUser");
|
|
33
36
|
const accountUser_1 = require("./resources/accountUser");
|
|
@@ -82,6 +85,9 @@ class Chatwoot {
|
|
|
82
85
|
'campaign',
|
|
83
86
|
'contactNote',
|
|
84
87
|
'conversationParticipant',
|
|
88
|
+
'company',
|
|
89
|
+
'search',
|
|
90
|
+
'slaPolicy',
|
|
85
91
|
],
|
|
86
92
|
},
|
|
87
93
|
},
|
|
@@ -119,6 +125,7 @@ class Chatwoot {
|
|
|
119
125
|
{ name: 'Automation Rule', value: 'automationRule' },
|
|
120
126
|
{ name: 'Campaign', value: 'campaign' },
|
|
121
127
|
{ name: 'Canned Response', value: 'cannedResponse' },
|
|
128
|
+
{ name: 'Company (Enterprise)', value: 'company' },
|
|
122
129
|
{ name: 'Contact', value: 'contact' },
|
|
123
130
|
{ name: 'Contact Note', value: 'contactNote' },
|
|
124
131
|
{ name: 'Conversation', value: 'conversation' },
|
|
@@ -135,6 +142,8 @@ class Chatwoot {
|
|
|
135
142
|
{ name: 'Notification', value: 'notification' },
|
|
136
143
|
{ name: 'Profile', value: 'profile' },
|
|
137
144
|
{ name: 'Report', value: 'report' },
|
|
145
|
+
{ name: 'Search', value: 'search' },
|
|
146
|
+
{ name: 'SLA Policy (Enterprise)', value: 'slaPolicy' },
|
|
138
147
|
{ name: 'Team', value: 'team' },
|
|
139
148
|
{ name: 'Webhook', value: 'webhook' },
|
|
140
149
|
{ name: '[Platform] Account', value: 'platformAccount' },
|
|
@@ -172,6 +181,9 @@ class Chatwoot {
|
|
|
172
181
|
campaign_1.campaignOperations,
|
|
173
182
|
contactNote_1.contactNoteOperations,
|
|
174
183
|
conversationParticipant_1.conversationParticipantOperations,
|
|
184
|
+
company_1.companyOperations,
|
|
185
|
+
search_1.searchOperations,
|
|
186
|
+
slaPolicy_1.slaPolicyOperations,
|
|
175
187
|
platformAccount_1.platformAccountOperations,
|
|
176
188
|
platformUser_1.platformUserOperations,
|
|
177
189
|
accountUser_1.accountUserOperations,
|
|
@@ -204,6 +216,9 @@ class Chatwoot {
|
|
|
204
216
|
...campaign_1.campaignFields,
|
|
205
217
|
...contactNote_1.contactNoteFields,
|
|
206
218
|
...conversationParticipant_1.conversationParticipantFields,
|
|
219
|
+
...company_1.companyFields,
|
|
220
|
+
...search_1.searchFields,
|
|
221
|
+
...slaPolicy_1.slaPolicyFields,
|
|
207
222
|
...platformAccount_1.platformAccountFields,
|
|
208
223
|
...platformUser_1.platformUserFields,
|
|
209
224
|
...accountUser_1.accountUserFields,
|
|
@@ -744,6 +759,20 @@ class Chatwoot {
|
|
|
744
759
|
responseData = payload.slice(0, limit);
|
|
745
760
|
}
|
|
746
761
|
}
|
|
762
|
+
else if (operation === 'transcript') {
|
|
763
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
764
|
+
const email = this.getNodeParameter('email', i);
|
|
765
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/conversations/${conversationId}/transcript`, { email });
|
|
766
|
+
}
|
|
767
|
+
else if (operation === 'toggleTyping') {
|
|
768
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
769
|
+
const typingStatus = this.getNodeParameter('typingStatus', i);
|
|
770
|
+
const isPrivate = this.getNodeParameter('isPrivate', i);
|
|
771
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/conversations/${conversationId}/toggle_typing_status`, {
|
|
772
|
+
typing_status: typingStatus,
|
|
773
|
+
is_private: isPrivate,
|
|
774
|
+
});
|
|
775
|
+
}
|
|
747
776
|
else {
|
|
748
777
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
749
778
|
}
|
|
@@ -928,6 +957,45 @@ class Chatwoot {
|
|
|
928
957
|
const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
|
|
929
958
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/contacts/${contactId}/labels`);
|
|
930
959
|
}
|
|
960
|
+
else if (operation === 'import') {
|
|
961
|
+
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
962
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
963
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
964
|
+
const credentials = await this.getCredentials('chatwootApi');
|
|
965
|
+
const baseUrl = credentials.baseUrl.trim().replace(/\/+$/, '');
|
|
966
|
+
const accountId = credentials.accountId;
|
|
967
|
+
responseData = (await this.helpers.httpRequest({
|
|
968
|
+
method: 'POST',
|
|
969
|
+
url: `${baseUrl}/api/v1/accounts/${accountId}/contacts/import`,
|
|
970
|
+
headers: {
|
|
971
|
+
api_access_token: credentials.apiAccessToken,
|
|
972
|
+
},
|
|
973
|
+
body: {
|
|
974
|
+
import_file: {
|
|
975
|
+
value: buffer,
|
|
976
|
+
options: {
|
|
977
|
+
filename: binaryData.fileName || 'contacts.csv',
|
|
978
|
+
contentType: binaryData.mimeType || 'text/csv',
|
|
979
|
+
},
|
|
980
|
+
},
|
|
981
|
+
},
|
|
982
|
+
json: true,
|
|
983
|
+
}));
|
|
984
|
+
}
|
|
985
|
+
else if (operation === 'export') {
|
|
986
|
+
const options = this.getNodeParameter('options', i);
|
|
987
|
+
const body = {};
|
|
988
|
+
if (options.tag)
|
|
989
|
+
body.tag = options.tag;
|
|
990
|
+
if (options.column_names) {
|
|
991
|
+
body.column_names = options.column_names.split(',').map((c) => c.trim());
|
|
992
|
+
}
|
|
993
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/contacts/export', body);
|
|
994
|
+
}
|
|
995
|
+
else if (operation === 'contactableInboxes') {
|
|
996
|
+
const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
|
|
997
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/contacts/${contactId}/contactable_inboxes`);
|
|
998
|
+
}
|
|
931
999
|
else {
|
|
932
1000
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
933
1001
|
}
|
|
@@ -1166,6 +1234,39 @@ class Chatwoot {
|
|
|
1166
1234
|
const body = { title, content, ...additionalFields };
|
|
1167
1235
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/portals/${portalSlug}/articles`, body);
|
|
1168
1236
|
}
|
|
1237
|
+
else if (operation === 'listPortals') {
|
|
1238
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/portals');
|
|
1239
|
+
}
|
|
1240
|
+
else if (operation === 'listCategories') {
|
|
1241
|
+
const portalSlug = this.getNodeParameter('portalSlug', i);
|
|
1242
|
+
const locale = this.getNodeParameter('locale', i, 'en');
|
|
1243
|
+
const qs = {};
|
|
1244
|
+
if (locale)
|
|
1245
|
+
qs.locale = locale;
|
|
1246
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/portals/${portalSlug}/categories`, {}, qs);
|
|
1247
|
+
}
|
|
1248
|
+
else if (operation === 'listArticles') {
|
|
1249
|
+
const portalSlug = this.getNodeParameter('portalSlug', i);
|
|
1250
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1251
|
+
const options = this.getNodeParameter('options', i);
|
|
1252
|
+
const qs = {};
|
|
1253
|
+
if (options.locale)
|
|
1254
|
+
qs.locale = options.locale;
|
|
1255
|
+
if (options.category_slug)
|
|
1256
|
+
qs.category_slug = options.category_slug;
|
|
1257
|
+
if (options.status)
|
|
1258
|
+
qs.status = options.status;
|
|
1259
|
+
if (returnAll) {
|
|
1260
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', `/portals/${portalSlug}/articles`, {}, qs, 'payload');
|
|
1261
|
+
}
|
|
1262
|
+
else {
|
|
1263
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1264
|
+
qs.page = 1;
|
|
1265
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/portals/${portalSlug}/articles`, {}, qs));
|
|
1266
|
+
const payload = (result.payload || []);
|
|
1267
|
+
responseData = payload.slice(0, limit);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1169
1270
|
else {
|
|
1170
1271
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1171
1272
|
}
|
|
@@ -1225,6 +1326,24 @@ class Chatwoot {
|
|
|
1225
1326
|
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1226
1327
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/csat_survey/${conversationId}`);
|
|
1227
1328
|
}
|
|
1329
|
+
else if (operation === 'metrics') {
|
|
1330
|
+
const options = this.getNodeParameter('options', i);
|
|
1331
|
+
const qs = {};
|
|
1332
|
+
if (options.since)
|
|
1333
|
+
qs.since = new Date(options.since).getTime() / 1000;
|
|
1334
|
+
if (options.until)
|
|
1335
|
+
qs.until = new Date(options.until).getTime() / 1000;
|
|
1336
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/csat_survey_responses/metrics', {}, qs);
|
|
1337
|
+
}
|
|
1338
|
+
else if (operation === 'download') {
|
|
1339
|
+
const options = this.getNodeParameter('options', i);
|
|
1340
|
+
const qs = {};
|
|
1341
|
+
if (options.since)
|
|
1342
|
+
qs.since = new Date(options.since).getTime() / 1000;
|
|
1343
|
+
if (options.until)
|
|
1344
|
+
qs.until = new Date(options.until).getTime() / 1000;
|
|
1345
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/csat_survey_responses/download', {}, qs);
|
|
1346
|
+
}
|
|
1228
1347
|
else {
|
|
1229
1348
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1230
1349
|
}
|
|
@@ -1436,6 +1555,179 @@ class Chatwoot {
|
|
|
1436
1555
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1437
1556
|
}
|
|
1438
1557
|
}
|
|
1558
|
+
else if (resource === 'company') {
|
|
1559
|
+
if (operation === 'getAll') {
|
|
1560
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1561
|
+
const options = this.getNodeParameter('options', i);
|
|
1562
|
+
const qs = {};
|
|
1563
|
+
if (options.sort)
|
|
1564
|
+
qs.sort = options.sort;
|
|
1565
|
+
if (returnAll) {
|
|
1566
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/companies', {}, qs, 'payload');
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1570
|
+
qs.page = 1;
|
|
1571
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/companies', {}, qs));
|
|
1572
|
+
const payload = (result.payload || []);
|
|
1573
|
+
responseData = payload.slice(0, limit);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
else if (operation === 'get') {
|
|
1577
|
+
const companyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('companyId', i), 'Company ID');
|
|
1578
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/companies/${companyId}`);
|
|
1579
|
+
}
|
|
1580
|
+
else if (operation === 'create') {
|
|
1581
|
+
const name = this.getNodeParameter('name', i);
|
|
1582
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1583
|
+
const body = { name };
|
|
1584
|
+
if (additionalFields.domain)
|
|
1585
|
+
body.domain = additionalFields.domain;
|
|
1586
|
+
if (additionalFields.description)
|
|
1587
|
+
body.description = additionalFields.description;
|
|
1588
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/companies', body);
|
|
1589
|
+
}
|
|
1590
|
+
else if (operation === 'update') {
|
|
1591
|
+
const companyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('companyId', i), 'Company ID');
|
|
1592
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1593
|
+
const body = {};
|
|
1594
|
+
if (updateFields.name)
|
|
1595
|
+
body.name = updateFields.name;
|
|
1596
|
+
if (updateFields.domain)
|
|
1597
|
+
body.domain = updateFields.domain;
|
|
1598
|
+
if (updateFields.description)
|
|
1599
|
+
body.description = updateFields.description;
|
|
1600
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/companies/${companyId}`, body);
|
|
1601
|
+
}
|
|
1602
|
+
else if (operation === 'delete') {
|
|
1603
|
+
const companyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('companyId', i), 'Company ID');
|
|
1604
|
+
await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/companies/${companyId}`);
|
|
1605
|
+
responseData = { success: true, id: companyId };
|
|
1606
|
+
}
|
|
1607
|
+
else if (operation === 'search') {
|
|
1608
|
+
const query = this.getNodeParameter('query', i);
|
|
1609
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1610
|
+
const qs = { q: query };
|
|
1611
|
+
if (returnAll) {
|
|
1612
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/companies/search', {}, qs, 'payload');
|
|
1613
|
+
}
|
|
1614
|
+
else {
|
|
1615
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1616
|
+
qs.page = 1;
|
|
1617
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/companies/search', {}, qs));
|
|
1618
|
+
const payload = (result.payload || []);
|
|
1619
|
+
responseData = payload.slice(0, limit);
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
else {
|
|
1623
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
else if (resource === 'search') {
|
|
1627
|
+
if (operation === 'searchAll') {
|
|
1628
|
+
const query = this.getNodeParameter('query', i);
|
|
1629
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search', {}, { q: query });
|
|
1630
|
+
}
|
|
1631
|
+
else if (operation === 'searchConversations') {
|
|
1632
|
+
const query = this.getNodeParameter('query', i);
|
|
1633
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1634
|
+
const qs = { q: query };
|
|
1635
|
+
if (returnAll) {
|
|
1636
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/search/conversations', {}, qs, 'payload');
|
|
1637
|
+
}
|
|
1638
|
+
else {
|
|
1639
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1640
|
+
qs.page = 1;
|
|
1641
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search/conversations', {}, qs));
|
|
1642
|
+
const payload = (result.payload || []);
|
|
1643
|
+
responseData = payload.slice(0, limit);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
else if (operation === 'searchContacts') {
|
|
1647
|
+
const query = this.getNodeParameter('query', i);
|
|
1648
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1649
|
+
const qs = { q: query };
|
|
1650
|
+
if (returnAll) {
|
|
1651
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/search/contacts', {}, qs, 'payload');
|
|
1652
|
+
}
|
|
1653
|
+
else {
|
|
1654
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1655
|
+
qs.page = 1;
|
|
1656
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search/contacts', {}, qs));
|
|
1657
|
+
const payload = (result.payload || []);
|
|
1658
|
+
responseData = payload.slice(0, limit);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
else if (operation === 'searchMessages') {
|
|
1662
|
+
const query = this.getNodeParameter('query', i);
|
|
1663
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1664
|
+
const qs = { q: query };
|
|
1665
|
+
if (returnAll) {
|
|
1666
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/search/messages', {}, qs, 'payload');
|
|
1667
|
+
}
|
|
1668
|
+
else {
|
|
1669
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1670
|
+
qs.page = 1;
|
|
1671
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search/messages', {}, qs));
|
|
1672
|
+
const payload = (result.payload || []);
|
|
1673
|
+
responseData = payload.slice(0, limit);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
else if (resource === 'slaPolicy') {
|
|
1681
|
+
if (operation === 'getAll') {
|
|
1682
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/sla_policies');
|
|
1683
|
+
}
|
|
1684
|
+
else if (operation === 'get') {
|
|
1685
|
+
const slaPolicyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('slaPolicyId', i), 'SLA Policy ID');
|
|
1686
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/sla_policies/${slaPolicyId}`);
|
|
1687
|
+
}
|
|
1688
|
+
else if (operation === 'create') {
|
|
1689
|
+
const name = this.getNodeParameter('name', i);
|
|
1690
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1691
|
+
const body = { name };
|
|
1692
|
+
if (additionalFields.description)
|
|
1693
|
+
body.description = additionalFields.description;
|
|
1694
|
+
if (additionalFields.first_response_time_threshold)
|
|
1695
|
+
body.first_response_time_threshold = additionalFields.first_response_time_threshold;
|
|
1696
|
+
if (additionalFields.next_response_time_threshold)
|
|
1697
|
+
body.next_response_time_threshold = additionalFields.next_response_time_threshold;
|
|
1698
|
+
if (additionalFields.resolution_time_threshold)
|
|
1699
|
+
body.resolution_time_threshold = additionalFields.resolution_time_threshold;
|
|
1700
|
+
if (additionalFields.only_during_business_hours !== undefined)
|
|
1701
|
+
body.only_during_business_hours = additionalFields.only_during_business_hours;
|
|
1702
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/sla_policies', body);
|
|
1703
|
+
}
|
|
1704
|
+
else if (operation === 'update') {
|
|
1705
|
+
const slaPolicyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('slaPolicyId', i), 'SLA Policy ID');
|
|
1706
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1707
|
+
const body = {};
|
|
1708
|
+
if (updateFields.name)
|
|
1709
|
+
body.name = updateFields.name;
|
|
1710
|
+
if (updateFields.description)
|
|
1711
|
+
body.description = updateFields.description;
|
|
1712
|
+
if (updateFields.first_response_time_threshold)
|
|
1713
|
+
body.first_response_time_threshold = updateFields.first_response_time_threshold;
|
|
1714
|
+
if (updateFields.next_response_time_threshold)
|
|
1715
|
+
body.next_response_time_threshold = updateFields.next_response_time_threshold;
|
|
1716
|
+
if (updateFields.resolution_time_threshold)
|
|
1717
|
+
body.resolution_time_threshold = updateFields.resolution_time_threshold;
|
|
1718
|
+
if (updateFields.only_during_business_hours !== undefined)
|
|
1719
|
+
body.only_during_business_hours = updateFields.only_during_business_hours;
|
|
1720
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/sla_policies/${slaPolicyId}`, body);
|
|
1721
|
+
}
|
|
1722
|
+
else if (operation === 'delete') {
|
|
1723
|
+
const slaPolicyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('slaPolicyId', i), 'SLA Policy ID');
|
|
1724
|
+
await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/sla_policies/${slaPolicyId}`);
|
|
1725
|
+
responseData = { success: true, id: slaPolicyId };
|
|
1726
|
+
}
|
|
1727
|
+
else {
|
|
1728
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1439
1731
|
else if (resource === 'platformAccount') {
|
|
1440
1732
|
if (operation === 'create') {
|
|
1441
1733
|
const name = this.getNodeParameter('name', i);
|