@renatoascencio/n8n-nodes-chatwoot 0.3.0 → 0.4.0
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 +247 -9
- package/dist/credentials/ChatwootPlatformApi.credentials.d.ts +9 -0
- package/dist/credentials/ChatwootPlatformApi.credentials.js +49 -0
- package/dist/credentials/ChatwootPlatformApi.credentials.js.map +1 -0
- package/dist/credentials/ChatwootPublicApi.credentials.d.ts +7 -0
- package/dist/credentials/ChatwootPublicApi.credentials.js +31 -0
- package/dist/credentials/ChatwootPublicApi.credentials.js.map +1 -0
- package/dist/nodes/Chatwoot/Chatwoot.node.d.ts +4 -1
- package/dist/nodes/Chatwoot/Chatwoot.node.js +579 -12
- package/dist/nodes/Chatwoot/Chatwoot.node.js.map +1 -1
- package/dist/nodes/Chatwoot/GenericFunctions.d.ts +14 -0
- package/dist/nodes/Chatwoot/GenericFunctions.js +170 -0
- package/dist/nodes/Chatwoot/GenericFunctions.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/accountAgentBot/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/create.operation.js +63 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/delete.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/delete.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/delete.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/get.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/getAll.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/index.js +60 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/update.operation.js +70 -0
- package/dist/nodes/Chatwoot/resources/accountAgentBot/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountUser/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountUser/create.operation.js +52 -0
- package/dist/nodes/Chatwoot/resources/accountUser/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountUser/delete.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountUser/delete.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/accountUser/delete.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountUser/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/accountUser/getAll.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/accountUser/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/accountUser/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/accountUser/index.js +44 -0
- package/dist/nodes/Chatwoot/resources/accountUser/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/auditLog/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/auditLog/getAll.operation.js +76 -0
- package/dist/nodes/Chatwoot/resources/auditLog/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/auditLog/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/auditLog/index.js +26 -0
- package/dist/nodes/Chatwoot/resources/auditLog/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/addLabels.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/addLabels.operation.js +36 -0
- package/dist/nodes/Chatwoot/resources/contact/addLabels.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/filter.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/filter.operation.js +51 -0
- package/dist/nodes/Chatwoot/resources/contact/filter.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/contact/listLabels.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/listLabels.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/contact/listLabels.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/filter.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/filter.operation.js +51 -0
- package/dist/nodes/Chatwoot/resources/conversation/filter.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/getMeta.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/getMeta.operation.js +55 -0
- package/dist/nodes/Chatwoot/resources/conversation/getMeta.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/index.js +40 -0
- package/dist/nodes/Chatwoot/resources/conversation/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/conversation/listLabels.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/listLabels.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/conversation/listLabels.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/update.operation.js +56 -0
- package/dist/nodes/Chatwoot/resources/conversation/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/updateCustomAttributes.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/updateCustomAttributes.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/conversation/updateCustomAttributes.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/get.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/index.js +26 -0
- package/dist/nodes/Chatwoot/resources/csatSurvey/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createArticle.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createArticle.operation.js +113 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createArticle.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createCategory.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createCategory.operation.js +91 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createCategory.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createPortal.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createPortal.operation.js +84 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/createPortal.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/getPortal.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/getPortal.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/getPortal.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/index.js +60 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/updatePortal.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/updatePortal.operation.js +77 -0
- package/dist/nodes/Chatwoot/resources/helpCenter/updatePortal.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/inbox/addAgent.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/inbox/addAgent.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/inbox/addAgent.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/inbox/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/inbox/create.operation.js +110 -0
- package/dist/nodes/Chatwoot/resources/inbox/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/inbox/deleteAgent.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/inbox/deleteAgent.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/inbox/deleteAgent.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/inbox/getAgentBot.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/inbox/getAgentBot.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/inbox/getAgentBot.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/inbox/getMembers.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/inbox/getMembers.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/inbox/getMembers.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/inbox/index.js +48 -0
- package/dist/nodes/Chatwoot/resources/inbox/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/inbox/setAgentBot.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/inbox/setAgentBot.operation.js +36 -0
- package/dist/nodes/Chatwoot/resources/inbox/setAgentBot.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/integration/createHook.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/integration/createHook.operation.js +47 -0
- package/dist/nodes/Chatwoot/resources/integration/createHook.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/integration/deleteHook.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/integration/deleteHook.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/integration/deleteHook.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/integration/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/integration/getAll.operation.js +5 -0
- package/dist/nodes/Chatwoot/resources/integration/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/integration/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/integration/index.js +52 -0
- package/dist/nodes/Chatwoot/resources/integration/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/integration/updateHook.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/integration/updateHook.operation.js +47 -0
- package/dist/nodes/Chatwoot/resources/integration/updateHook.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/message/index.js +13 -1
- package/dist/nodes/Chatwoot/resources/message/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/message/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/message/update.operation.js +51 -0
- package/dist/nodes/Chatwoot/resources/message/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/create.operation.js +56 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/delete.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/delete.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/delete.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/get.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/index.js +52 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/update.operation.js +63 -0
- package/dist/nodes/Chatwoot/resources/platformAccount/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformUser/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformUser/create.operation.js +67 -0
- package/dist/nodes/Chatwoot/resources/platformUser/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformUser/delete.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformUser/delete.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/platformUser/delete.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformUser/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformUser/get.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/platformUser/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformUser/getSsoUrl.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformUser/getSsoUrl.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/platformUser/getSsoUrl.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformUser/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/platformUser/index.js +60 -0
- package/dist/nodes/Chatwoot/resources/platformUser/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/platformUser/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/platformUser/update.operation.js +66 -0
- package/dist/nodes/Chatwoot/resources/platformUser/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/profile/fetch.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/profile/fetch.operation.js +5 -0
- package/dist/nodes/Chatwoot/resources/profile/fetch.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/profile/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/profile/index.js +26 -0
- package/dist/nodes/Chatwoot/resources/profile/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicContact/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicContact/create.operation.js +63 -0
- package/dist/nodes/Chatwoot/resources/publicContact/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicContact/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicContact/get.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/publicContact/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicContact/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/publicContact/index.js +44 -0
- package/dist/nodes/Chatwoot/resources/publicContact/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicContact/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicContact/update.operation.js +70 -0
- package/dist/nodes/Chatwoot/resources/publicContact/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/create.operation.js +42 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/get.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/getAll.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/index.js +68 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/resolve.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/resolve.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/resolve.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/toggleTyping.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/toggleTyping.operation.js +52 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/toggleTyping.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/updateLastSeen.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/updateLastSeen.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/publicConversation/updateLastSeen.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/create.operation.js +73 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/getAll.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/index.js +44 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/update.operation.js +65 -0
- package/dist/nodes/Chatwoot/resources/publicMessage/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/team/addAgent.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/team/addAgent.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/team/addAgent.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/team/deleteAgent.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/team/deleteAgent.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/team/deleteAgent.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/team/getMembers.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/team/getMembers.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/team/getMembers.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/team/index.js +32 -0
- package/dist/nodes/Chatwoot/resources/team/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/team/updateAgents.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/team/updateAgents.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/team/updateAgents.operation.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -18,6 +18,18 @@ const conversation_1 = require("./resources/conversation");
|
|
|
18
18
|
const message_1 = require("./resources/message");
|
|
19
19
|
const contact_1 = require("./resources/contact");
|
|
20
20
|
const report_1 = require("./resources/report");
|
|
21
|
+
const profile_1 = require("./resources/profile");
|
|
22
|
+
const helpCenter_1 = require("./resources/helpCenter");
|
|
23
|
+
const integration_1 = require("./resources/integration");
|
|
24
|
+
const auditLog_1 = require("./resources/auditLog");
|
|
25
|
+
const csatSurvey_1 = require("./resources/csatSurvey");
|
|
26
|
+
const platformAccount_1 = require("./resources/platformAccount");
|
|
27
|
+
const platformUser_1 = require("./resources/platformUser");
|
|
28
|
+
const accountUser_1 = require("./resources/accountUser");
|
|
29
|
+
const accountAgentBot_1 = require("./resources/accountAgentBot");
|
|
30
|
+
const publicContact_1 = require("./resources/publicContact");
|
|
31
|
+
const publicConversation_1 = require("./resources/publicConversation");
|
|
32
|
+
const publicMessage_1 = require("./resources/publicMessage");
|
|
21
33
|
class Chatwoot {
|
|
22
34
|
constructor() {
|
|
23
35
|
this.description = {
|
|
@@ -37,6 +49,50 @@ class Chatwoot {
|
|
|
37
49
|
{
|
|
38
50
|
name: 'chatwootApi',
|
|
39
51
|
required: true,
|
|
52
|
+
displayOptions: {
|
|
53
|
+
show: {
|
|
54
|
+
resource: [
|
|
55
|
+
'account',
|
|
56
|
+
'agent',
|
|
57
|
+
'agentBot',
|
|
58
|
+
'automationRule',
|
|
59
|
+
'cannedResponse',
|
|
60
|
+
'contact',
|
|
61
|
+
'conversation',
|
|
62
|
+
'customAttribute',
|
|
63
|
+
'customFilter',
|
|
64
|
+
'inbox',
|
|
65
|
+
'label',
|
|
66
|
+
'message',
|
|
67
|
+
'report',
|
|
68
|
+
'team',
|
|
69
|
+
'webhook',
|
|
70
|
+
'profile',
|
|
71
|
+
'helpCenter',
|
|
72
|
+
'integration',
|
|
73
|
+
'auditLog',
|
|
74
|
+
'csatSurvey',
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'chatwootPlatformApi',
|
|
81
|
+
required: true,
|
|
82
|
+
displayOptions: {
|
|
83
|
+
show: {
|
|
84
|
+
resource: ['platformAccount', 'platformUser', 'accountUser', 'accountAgentBot'],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'chatwootPublicApi',
|
|
90
|
+
required: true,
|
|
91
|
+
displayOptions: {
|
|
92
|
+
show: {
|
|
93
|
+
resource: ['publicContact', 'publicConversation', 'publicMessage'],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
40
96
|
},
|
|
41
97
|
],
|
|
42
98
|
properties: [
|
|
@@ -49,18 +105,30 @@ class Chatwoot {
|
|
|
49
105
|
{ name: 'Account', value: 'account' },
|
|
50
106
|
{ name: 'Agent', value: 'agent' },
|
|
51
107
|
{ name: 'Agent Bot', value: 'agentBot' },
|
|
108
|
+
{ name: 'Audit Log', value: 'auditLog' },
|
|
52
109
|
{ name: 'Automation Rule', value: 'automationRule' },
|
|
53
110
|
{ name: 'Canned Response', value: 'cannedResponse' },
|
|
54
111
|
{ name: 'Contact', value: 'contact' },
|
|
55
112
|
{ name: 'Conversation', value: 'conversation' },
|
|
113
|
+
{ name: 'CSAT Survey', value: 'csatSurvey' },
|
|
56
114
|
{ name: 'Custom Attribute', value: 'customAttribute' },
|
|
57
115
|
{ name: 'Custom Filter', value: 'customFilter' },
|
|
116
|
+
{ name: 'Help Center', value: 'helpCenter' },
|
|
58
117
|
{ name: 'Inbox', value: 'inbox' },
|
|
118
|
+
{ name: 'Integration', value: 'integration' },
|
|
59
119
|
{ name: 'Label', value: 'label' },
|
|
60
120
|
{ name: 'Message', value: 'message' },
|
|
121
|
+
{ name: 'Profile', value: 'profile' },
|
|
61
122
|
{ name: 'Report', value: 'report' },
|
|
62
123
|
{ name: 'Team', value: 'team' },
|
|
63
124
|
{ name: 'Webhook', value: 'webhook' },
|
|
125
|
+
{ name: '[Platform] Account', value: 'platformAccount' },
|
|
126
|
+
{ name: '[Platform] Account Agent Bot', value: 'accountAgentBot' },
|
|
127
|
+
{ name: '[Platform] Account User', value: 'accountUser' },
|
|
128
|
+
{ name: '[Platform] User', value: 'platformUser' },
|
|
129
|
+
{ name: '[Public] Contact', value: 'publicContact' },
|
|
130
|
+
{ name: '[Public] Conversation', value: 'publicConversation' },
|
|
131
|
+
{ name: '[Public] Message', value: 'publicMessage' },
|
|
64
132
|
],
|
|
65
133
|
default: 'conversation',
|
|
66
134
|
},
|
|
@@ -79,6 +147,18 @@ class Chatwoot {
|
|
|
79
147
|
message_1.messageOperations,
|
|
80
148
|
contact_1.contactOperations,
|
|
81
149
|
report_1.reportOperations,
|
|
150
|
+
profile_1.profileOperations,
|
|
151
|
+
helpCenter_1.helpCenterOperations,
|
|
152
|
+
integration_1.integrationOperations,
|
|
153
|
+
auditLog_1.auditLogOperations,
|
|
154
|
+
csatSurvey_1.csatSurveyOperations,
|
|
155
|
+
platformAccount_1.platformAccountOperations,
|
|
156
|
+
platformUser_1.platformUserOperations,
|
|
157
|
+
accountUser_1.accountUserOperations,
|
|
158
|
+
accountAgentBot_1.accountAgentBotOperations,
|
|
159
|
+
publicContact_1.publicContactOperations,
|
|
160
|
+
publicConversation_1.publicConversationOperations,
|
|
161
|
+
publicMessage_1.publicMessageOperations,
|
|
82
162
|
...account_1.accountFields,
|
|
83
163
|
...agent_1.agentFields,
|
|
84
164
|
...agentBot_1.agentBotFields,
|
|
@@ -94,6 +174,18 @@ class Chatwoot {
|
|
|
94
174
|
...message_1.messageFields,
|
|
95
175
|
...contact_1.contactFields,
|
|
96
176
|
...report_1.reportFields,
|
|
177
|
+
...profile_1.profileFields,
|
|
178
|
+
...helpCenter_1.helpCenterFields,
|
|
179
|
+
...integration_1.integrationFields,
|
|
180
|
+
...auditLog_1.auditLogFields,
|
|
181
|
+
...csatSurvey_1.csatSurveyFields,
|
|
182
|
+
...platformAccount_1.platformAccountFields,
|
|
183
|
+
...platformUser_1.platformUserFields,
|
|
184
|
+
...accountUser_1.accountUserFields,
|
|
185
|
+
...accountAgentBot_1.accountAgentBotFields,
|
|
186
|
+
...publicContact_1.publicContactFields,
|
|
187
|
+
...publicConversation_1.publicConversationFields,
|
|
188
|
+
...publicMessage_1.publicMessageFields,
|
|
97
189
|
],
|
|
98
190
|
};
|
|
99
191
|
this.methods = {
|
|
@@ -102,6 +194,9 @@ class Chatwoot {
|
|
|
102
194
|
getTeams: GenericFunctions_1.getTeams,
|
|
103
195
|
getInboxes: GenericFunctions_1.getInboxes,
|
|
104
196
|
getLabels: GenericFunctions_1.getLabels,
|
|
197
|
+
getAgentBots: GenericFunctions_1.getAgentBots,
|
|
198
|
+
getPortals: GenericFunctions_1.getPortals,
|
|
199
|
+
getIntegrations: GenericFunctions_1.getIntegrations,
|
|
105
200
|
},
|
|
106
201
|
};
|
|
107
202
|
}
|
|
@@ -214,6 +309,31 @@ class Chatwoot {
|
|
|
214
309
|
await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/teams/${teamId}`);
|
|
215
310
|
responseData = { success: true, id: teamId };
|
|
216
311
|
}
|
|
312
|
+
else if (operation === 'addAgent') {
|
|
313
|
+
const teamId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('teamId', i), 'Team ID');
|
|
314
|
+
const userIdsStr = this.getNodeParameter('userIds', i);
|
|
315
|
+
const userIds = userIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
|
|
316
|
+
const body = { user_ids: userIds };
|
|
317
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/teams/${teamId}/team_members`, body);
|
|
318
|
+
}
|
|
319
|
+
else if (operation === 'deleteAgent') {
|
|
320
|
+
const teamId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('teamId', i), 'Team ID');
|
|
321
|
+
const userIdsStr = this.getNodeParameter('userIds', i);
|
|
322
|
+
const userIds = userIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
|
|
323
|
+
const body = { user_ids: userIds };
|
|
324
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/teams/${teamId}/team_members`, body);
|
|
325
|
+
}
|
|
326
|
+
else if (operation === 'getMembers') {
|
|
327
|
+
const teamId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('teamId', i), 'Team ID');
|
|
328
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/teams/${teamId}/team_members`);
|
|
329
|
+
}
|
|
330
|
+
else if (operation === 'updateAgents') {
|
|
331
|
+
const teamId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('teamId', i), 'Team ID');
|
|
332
|
+
const userIdsStr = this.getNodeParameter('userIds', i);
|
|
333
|
+
const userIds = userIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
|
|
334
|
+
const body = { user_ids: userIds };
|
|
335
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/teams/${teamId}/team_members`, body);
|
|
336
|
+
}
|
|
217
337
|
else {
|
|
218
338
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
219
339
|
}
|
|
@@ -227,12 +347,57 @@ class Chatwoot {
|
|
|
227
347
|
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
228
348
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/inboxes/${inboxId}`);
|
|
229
349
|
}
|
|
350
|
+
else if (operation === 'create') {
|
|
351
|
+
const name = this.getNodeParameter('name', i);
|
|
352
|
+
const channelType = this.getNodeParameter('channelType', i);
|
|
353
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
354
|
+
const body = { name };
|
|
355
|
+
const channel = { type: channelType };
|
|
356
|
+
if (channelType === 'web_widget') {
|
|
357
|
+
if (additionalFields.website_url)
|
|
358
|
+
channel.website_url = additionalFields.website_url;
|
|
359
|
+
if (additionalFields.welcome_title)
|
|
360
|
+
channel.welcome_title = additionalFields.welcome_title;
|
|
361
|
+
if (additionalFields.welcome_tagline)
|
|
362
|
+
channel.welcome_tagline = additionalFields.welcome_tagline;
|
|
363
|
+
}
|
|
364
|
+
body.channel = channel;
|
|
365
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/inboxes', body);
|
|
366
|
+
}
|
|
230
367
|
else if (operation === 'update') {
|
|
231
368
|
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
232
369
|
const updateFields = this.getNodeParameter('updateFields', i);
|
|
233
370
|
const body = { ...updateFields };
|
|
234
371
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/inboxes/${inboxId}`, body);
|
|
235
372
|
}
|
|
373
|
+
else if (operation === 'addAgent') {
|
|
374
|
+
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
375
|
+
const userIdsStr = this.getNodeParameter('userIds', i);
|
|
376
|
+
const userIds = userIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
|
|
377
|
+
const body = { user_ids: userIds };
|
|
378
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/inbox_members/${inboxId}`, body);
|
|
379
|
+
}
|
|
380
|
+
else if (operation === 'deleteAgent') {
|
|
381
|
+
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
382
|
+
const userIdsStr = this.getNodeParameter('userIds', i);
|
|
383
|
+
const userIds = userIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
|
|
384
|
+
const body = { user_ids: userIds };
|
|
385
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/inbox_members/${inboxId}`, body);
|
|
386
|
+
}
|
|
387
|
+
else if (operation === 'getMembers') {
|
|
388
|
+
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
389
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/inbox_members/${inboxId}`);
|
|
390
|
+
}
|
|
391
|
+
else if (operation === 'getAgentBot') {
|
|
392
|
+
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
393
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/inboxes/${inboxId}/agent_bot`);
|
|
394
|
+
}
|
|
395
|
+
else if (operation === 'setAgentBot') {
|
|
396
|
+
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
397
|
+
const agentBotId = this.getNodeParameter('agentBotId', i);
|
|
398
|
+
const body = { agent_bot: agentBotId || null };
|
|
399
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/inboxes/${inboxId}/set_agent_bot`, body);
|
|
400
|
+
}
|
|
236
401
|
else {
|
|
237
402
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
238
403
|
}
|
|
@@ -327,7 +492,7 @@ class Chatwoot {
|
|
|
327
492
|
if (additionalFields.default_value)
|
|
328
493
|
body.default_value = additionalFields.default_value;
|
|
329
494
|
if (additionalFields.attribute_values) {
|
|
330
|
-
body.attribute_values = additionalFields.attribute_values.split(',').map(v => v.trim());
|
|
495
|
+
body.attribute_values = additionalFields.attribute_values.split(',').map((v) => v.trim());
|
|
331
496
|
}
|
|
332
497
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/custom_attribute_definitions', body);
|
|
333
498
|
}
|
|
@@ -342,7 +507,7 @@ class Chatwoot {
|
|
|
342
507
|
if (updateFields.default_value)
|
|
343
508
|
body.default_value = updateFields.default_value;
|
|
344
509
|
if (updateFields.attribute_values) {
|
|
345
|
-
body.attribute_values = updateFields.attribute_values.split(',').map(v => v.trim());
|
|
510
|
+
body.attribute_values = updateFields.attribute_values.split(',').map((v) => v.trim());
|
|
346
511
|
}
|
|
347
512
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/custom_attribute_definitions/${customAttributeId}`, body);
|
|
348
513
|
}
|
|
@@ -398,7 +563,7 @@ class Chatwoot {
|
|
|
398
563
|
if (filters.team_id)
|
|
399
564
|
qs.team_id = filters.team_id;
|
|
400
565
|
if (filters.labels)
|
|
401
|
-
qs.labels = filters.labels.split(',').map(l => l.trim());
|
|
566
|
+
qs.labels = filters.labels.split(',').map((l) => l.trim());
|
|
402
567
|
if (filters.q)
|
|
403
568
|
qs.q = filters.q;
|
|
404
569
|
if (returnAll) {
|
|
@@ -407,7 +572,7 @@ class Chatwoot {
|
|
|
407
572
|
else {
|
|
408
573
|
const limit = this.getNodeParameter('limit', i);
|
|
409
574
|
qs.page = 1;
|
|
410
|
-
const result = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/conversations', {}, qs);
|
|
575
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/conversations', {}, qs));
|
|
411
576
|
const payload = (result.payload || []);
|
|
412
577
|
responseData = payload.slice(0, limit);
|
|
413
578
|
}
|
|
@@ -472,6 +637,57 @@ class Chatwoot {
|
|
|
472
637
|
const body = { priority };
|
|
473
638
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/conversations/${conversationId}/toggle_priority`, body);
|
|
474
639
|
}
|
|
640
|
+
else if (operation === 'update') {
|
|
641
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
642
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
643
|
+
const body = {};
|
|
644
|
+
if (updateFields.priority)
|
|
645
|
+
body.priority = updateFields.priority;
|
|
646
|
+
if (updateFields.assignee_id)
|
|
647
|
+
body.assignee_id = updateFields.assignee_id;
|
|
648
|
+
if (updateFields.team_id)
|
|
649
|
+
body.team_id = updateFields.team_id;
|
|
650
|
+
if (updateFields.status)
|
|
651
|
+
body.status = updateFields.status;
|
|
652
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PUT', `/conversations/${conversationId}`, body);
|
|
653
|
+
}
|
|
654
|
+
else if (operation === 'filter') {
|
|
655
|
+
const filterPayload = this.getNodeParameter('filterPayload', i);
|
|
656
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
657
|
+
const body = { payload: JSON.parse(filterPayload) };
|
|
658
|
+
if (returnAll) {
|
|
659
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'POST', '/conversations/filter', body, {}, 'payload');
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
const limit = this.getNodeParameter('limit', i);
|
|
663
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/conversations/filter', body));
|
|
664
|
+
const payload = (result.payload || []);
|
|
665
|
+
responseData = payload.slice(0, limit);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
else if (operation === 'updateCustomAttributes') {
|
|
669
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
670
|
+
const customAttributes = this.getNodeParameter('customAttributes', i);
|
|
671
|
+
const body = {
|
|
672
|
+
custom_attributes: JSON.parse(customAttributes),
|
|
673
|
+
};
|
|
674
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/conversations/${conversationId}/custom_attributes`, body);
|
|
675
|
+
}
|
|
676
|
+
else if (operation === 'listLabels') {
|
|
677
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
678
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/conversations/${conversationId}/labels`);
|
|
679
|
+
}
|
|
680
|
+
else if (operation === 'getMeta') {
|
|
681
|
+
const filters = this.getNodeParameter('filters', i, {});
|
|
682
|
+
const qs = {};
|
|
683
|
+
if (filters.status)
|
|
684
|
+
qs.status = filters.status;
|
|
685
|
+
if (filters.inbox_id)
|
|
686
|
+
qs.inbox_id = filters.inbox_id;
|
|
687
|
+
if (filters.assignee_type)
|
|
688
|
+
qs.assignee_type = filters.assignee_type;
|
|
689
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/conversations/meta', {}, qs);
|
|
690
|
+
}
|
|
475
691
|
else {
|
|
476
692
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
477
693
|
}
|
|
@@ -507,6 +723,13 @@ class Chatwoot {
|
|
|
507
723
|
await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/conversations/${conversationId}/messages/${messageId}`);
|
|
508
724
|
responseData = { success: true, id: messageId };
|
|
509
725
|
}
|
|
726
|
+
else if (operation === 'update') {
|
|
727
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
728
|
+
const messageId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('messageId', i), 'Message ID');
|
|
729
|
+
const content = this.getNodeParameter('content', i);
|
|
730
|
+
const body = { content };
|
|
731
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/conversations/${conversationId}/messages/${messageId}`, body);
|
|
732
|
+
}
|
|
510
733
|
else {
|
|
511
734
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
512
735
|
}
|
|
@@ -526,9 +749,10 @@ class Chatwoot {
|
|
|
526
749
|
if (additionalFields.identifier)
|
|
527
750
|
body.identifier = additionalFields.identifier;
|
|
528
751
|
if (additionalFields.custom_attributes) {
|
|
529
|
-
body.custom_attributes =
|
|
530
|
-
|
|
531
|
-
|
|
752
|
+
body.custom_attributes =
|
|
753
|
+
typeof additionalFields.custom_attributes === 'string'
|
|
754
|
+
? JSON.parse(additionalFields.custom_attributes)
|
|
755
|
+
: additionalFields.custom_attributes;
|
|
532
756
|
}
|
|
533
757
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/contacts', body);
|
|
534
758
|
}
|
|
@@ -548,7 +772,7 @@ class Chatwoot {
|
|
|
548
772
|
else {
|
|
549
773
|
const limit = this.getNodeParameter('limit', i);
|
|
550
774
|
qs.page = 1;
|
|
551
|
-
const result = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/contacts', {}, qs);
|
|
775
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/contacts', {}, qs));
|
|
552
776
|
const payload = (result.payload || []);
|
|
553
777
|
responseData = payload.slice(0, limit);
|
|
554
778
|
}
|
|
@@ -570,9 +794,10 @@ class Chatwoot {
|
|
|
570
794
|
if (updateFields.blocked !== undefined)
|
|
571
795
|
body.blocked = updateFields.blocked;
|
|
572
796
|
if (updateFields.custom_attributes) {
|
|
573
|
-
body.custom_attributes =
|
|
574
|
-
|
|
575
|
-
|
|
797
|
+
body.custom_attributes =
|
|
798
|
+
typeof updateFields.custom_attributes === 'string'
|
|
799
|
+
? JSON.parse(updateFields.custom_attributes)
|
|
800
|
+
: updateFields.custom_attributes;
|
|
576
801
|
}
|
|
577
802
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PUT', `/contacts/${contactId}`, body);
|
|
578
803
|
}
|
|
@@ -594,7 +819,7 @@ class Chatwoot {
|
|
|
594
819
|
else {
|
|
595
820
|
const limit = this.getNodeParameter('limit', i);
|
|
596
821
|
qs.page = 1;
|
|
597
|
-
const result = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/contacts/search', {}, qs);
|
|
822
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/contacts/search', {}, qs));
|
|
598
823
|
const payload = (result.payload || []);
|
|
599
824
|
responseData = payload.slice(0, limit);
|
|
600
825
|
}
|
|
@@ -613,6 +838,30 @@ class Chatwoot {
|
|
|
613
838
|
};
|
|
614
839
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/actions/contact_merge', body);
|
|
615
840
|
}
|
|
841
|
+
else if (operation === 'filter') {
|
|
842
|
+
const filterPayload = this.getNodeParameter('filterPayload', i);
|
|
843
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
844
|
+
const body = { payload: JSON.parse(filterPayload) };
|
|
845
|
+
if (returnAll) {
|
|
846
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'POST', '/contacts/filter', body, {}, 'payload');
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
const limit = this.getNodeParameter('limit', i);
|
|
850
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/contacts/filter', body));
|
|
851
|
+
const payload = (result.payload || []);
|
|
852
|
+
responseData = payload.slice(0, limit);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
else if (operation === 'addLabels') {
|
|
856
|
+
const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
|
|
857
|
+
const labels = this.getNodeParameter('labels', i);
|
|
858
|
+
const body = { labels };
|
|
859
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/contacts/${contactId}/labels`, body);
|
|
860
|
+
}
|
|
861
|
+
else if (operation === 'listLabels') {
|
|
862
|
+
const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
|
|
863
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/contacts/${contactId}/labels`);
|
|
864
|
+
}
|
|
616
865
|
else {
|
|
617
866
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
618
867
|
}
|
|
@@ -796,6 +1045,324 @@ class Chatwoot {
|
|
|
796
1045
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
797
1046
|
}
|
|
798
1047
|
}
|
|
1048
|
+
else if (resource === 'profile') {
|
|
1049
|
+
if (operation === 'fetch') {
|
|
1050
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/profile');
|
|
1051
|
+
}
|
|
1052
|
+
else {
|
|
1053
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
else if (resource === 'helpCenter') {
|
|
1057
|
+
if (operation === 'createPortal') {
|
|
1058
|
+
const name = this.getNodeParameter('name', i);
|
|
1059
|
+
const slug = this.getNodeParameter('slug', i);
|
|
1060
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1061
|
+
const body = { name, slug, ...additionalFields };
|
|
1062
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/portals', body);
|
|
1063
|
+
}
|
|
1064
|
+
else if (operation === 'getPortal') {
|
|
1065
|
+
const portalSlug = this.getNodeParameter('portalSlug', i);
|
|
1066
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/portals/${portalSlug}`);
|
|
1067
|
+
}
|
|
1068
|
+
else if (operation === 'updatePortal') {
|
|
1069
|
+
const portalSlug = this.getNodeParameter('portalSlug', i);
|
|
1070
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1071
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/portals/${portalSlug}`, updateFields);
|
|
1072
|
+
}
|
|
1073
|
+
else if (operation === 'createCategory') {
|
|
1074
|
+
const portalSlug = this.getNodeParameter('portalSlug', i);
|
|
1075
|
+
const name = this.getNodeParameter('name', i);
|
|
1076
|
+
const slug = this.getNodeParameter('slug', i);
|
|
1077
|
+
const locale = this.getNodeParameter('locale', i);
|
|
1078
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1079
|
+
const body = { name, slug, locale, ...additionalFields };
|
|
1080
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/portals/${portalSlug}/categories`, body);
|
|
1081
|
+
}
|
|
1082
|
+
else if (operation === 'createArticle') {
|
|
1083
|
+
const portalSlug = this.getNodeParameter('portalSlug', i);
|
|
1084
|
+
const title = this.getNodeParameter('title', i);
|
|
1085
|
+
const content = this.getNodeParameter('content', i);
|
|
1086
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1087
|
+
const body = { title, content, ...additionalFields };
|
|
1088
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/portals/${portalSlug}/articles`, body);
|
|
1089
|
+
}
|
|
1090
|
+
else {
|
|
1091
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
else if (resource === 'integration') {
|
|
1095
|
+
if (operation === 'getAll') {
|
|
1096
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/integrations/apps');
|
|
1097
|
+
}
|
|
1098
|
+
else if (operation === 'createHook') {
|
|
1099
|
+
const appId = this.getNodeParameter('appId', i);
|
|
1100
|
+
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
1101
|
+
const settings = JSON.parse(this.getNodeParameter('settings', i));
|
|
1102
|
+
const body = { app_id: appId, inbox_id: inboxId, settings };
|
|
1103
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/integrations/hooks', body);
|
|
1104
|
+
}
|
|
1105
|
+
else if (operation === 'updateHook') {
|
|
1106
|
+
const hookId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('hookId', i), 'Hook ID');
|
|
1107
|
+
const settings = JSON.parse(this.getNodeParameter('settings', i));
|
|
1108
|
+
const body = { settings };
|
|
1109
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/integrations/hooks/${hookId}`, body);
|
|
1110
|
+
}
|
|
1111
|
+
else if (operation === 'deleteHook') {
|
|
1112
|
+
const hookId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('hookId', i), 'Hook ID');
|
|
1113
|
+
await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/integrations/hooks/${hookId}`);
|
|
1114
|
+
responseData = { success: true, id: hookId };
|
|
1115
|
+
}
|
|
1116
|
+
else {
|
|
1117
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
else if (resource === 'auditLog') {
|
|
1121
|
+
if (operation === 'getAll') {
|
|
1122
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1123
|
+
const filters = this.getNodeParameter('filters', i);
|
|
1124
|
+
const qs = {};
|
|
1125
|
+
if (filters.auditable_type)
|
|
1126
|
+
qs.auditable_type = filters.auditable_type;
|
|
1127
|
+
if (filters.user_id)
|
|
1128
|
+
qs.user_id = filters.user_id;
|
|
1129
|
+
if (returnAll) {
|
|
1130
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/audit_logs', {}, qs, 'payload');
|
|
1131
|
+
}
|
|
1132
|
+
else {
|
|
1133
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1134
|
+
qs.page = 1;
|
|
1135
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/audit_logs', {}, qs));
|
|
1136
|
+
const payload = (result.payload || []);
|
|
1137
|
+
responseData = payload.slice(0, limit);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
else {
|
|
1141
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
else if (resource === 'csatSurvey') {
|
|
1145
|
+
if (operation === 'get') {
|
|
1146
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1147
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/csat_survey/${conversationId}`);
|
|
1148
|
+
}
|
|
1149
|
+
else {
|
|
1150
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
else if (resource === 'platformAccount') {
|
|
1154
|
+
if (operation === 'create') {
|
|
1155
|
+
const name = this.getNodeParameter('name', i);
|
|
1156
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1157
|
+
const body = { name, ...additionalFields };
|
|
1158
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'POST', '/accounts', body);
|
|
1159
|
+
}
|
|
1160
|
+
else if (operation === 'get') {
|
|
1161
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1162
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'GET', `/accounts/${accountId}`);
|
|
1163
|
+
}
|
|
1164
|
+
else if (operation === 'update') {
|
|
1165
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1166
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1167
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'PATCH', `/accounts/${accountId}`, updateFields);
|
|
1168
|
+
}
|
|
1169
|
+
else if (operation === 'delete') {
|
|
1170
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1171
|
+
await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'DELETE', `/accounts/${accountId}`);
|
|
1172
|
+
responseData = { success: true, id: accountId };
|
|
1173
|
+
}
|
|
1174
|
+
else {
|
|
1175
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
else if (resource === 'platformUser') {
|
|
1179
|
+
if (operation === 'create') {
|
|
1180
|
+
const email = this.getNodeParameter('email', i);
|
|
1181
|
+
const name = this.getNodeParameter('name', i);
|
|
1182
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1183
|
+
const body = { email, name };
|
|
1184
|
+
if (additionalFields.password)
|
|
1185
|
+
body.password = additionalFields.password;
|
|
1186
|
+
if (additionalFields.custom_attributes) {
|
|
1187
|
+
body.custom_attributes = JSON.parse(additionalFields.custom_attributes);
|
|
1188
|
+
}
|
|
1189
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'POST', '/users', body);
|
|
1190
|
+
}
|
|
1191
|
+
else if (operation === 'get') {
|
|
1192
|
+
const userId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('userId', i), 'User ID');
|
|
1193
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'GET', `/users/${userId}`);
|
|
1194
|
+
}
|
|
1195
|
+
else if (operation === 'update') {
|
|
1196
|
+
const userId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('userId', i), 'User ID');
|
|
1197
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1198
|
+
if (updateFields.custom_attributes && typeof updateFields.custom_attributes === 'string') {
|
|
1199
|
+
updateFields.custom_attributes = JSON.parse(updateFields.custom_attributes);
|
|
1200
|
+
}
|
|
1201
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'PATCH', `/users/${userId}`, updateFields);
|
|
1202
|
+
}
|
|
1203
|
+
else if (operation === 'delete') {
|
|
1204
|
+
const userId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('userId', i), 'User ID');
|
|
1205
|
+
await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'DELETE', `/users/${userId}`);
|
|
1206
|
+
responseData = { success: true, id: userId };
|
|
1207
|
+
}
|
|
1208
|
+
else if (operation === 'getSsoUrl') {
|
|
1209
|
+
const userId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('userId', i), 'User ID');
|
|
1210
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'GET', `/users/${userId}/login`);
|
|
1211
|
+
}
|
|
1212
|
+
else {
|
|
1213
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
else if (resource === 'accountUser') {
|
|
1217
|
+
if (operation === 'getAll') {
|
|
1218
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1219
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'GET', `/accounts/${accountId}/account_users`);
|
|
1220
|
+
}
|
|
1221
|
+
else if (operation === 'create') {
|
|
1222
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1223
|
+
const userId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('userId', i), 'User ID');
|
|
1224
|
+
const role = this.getNodeParameter('role', i);
|
|
1225
|
+
const body = { user_id: userId, role };
|
|
1226
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'POST', `/accounts/${accountId}/account_users`, body);
|
|
1227
|
+
}
|
|
1228
|
+
else if (operation === 'delete') {
|
|
1229
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1230
|
+
const userId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('userId', i), 'User ID');
|
|
1231
|
+
await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'DELETE', `/accounts/${accountId}/account_users`, { user_id: userId });
|
|
1232
|
+
responseData = { success: true, accountId, userId };
|
|
1233
|
+
}
|
|
1234
|
+
else {
|
|
1235
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
else if (resource === 'accountAgentBot') {
|
|
1239
|
+
if (operation === 'getAll') {
|
|
1240
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1241
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'GET', `/accounts/${accountId}/agent_bots`);
|
|
1242
|
+
}
|
|
1243
|
+
else if (operation === 'get') {
|
|
1244
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1245
|
+
const agentBotId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('agentBotId', i), 'Agent Bot ID');
|
|
1246
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'GET', `/accounts/${accountId}/agent_bots/${agentBotId}`);
|
|
1247
|
+
}
|
|
1248
|
+
else if (operation === 'create') {
|
|
1249
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1250
|
+
const name = this.getNodeParameter('name', i);
|
|
1251
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1252
|
+
const body = { name, ...additionalFields };
|
|
1253
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'POST', `/accounts/${accountId}/agent_bots`, body);
|
|
1254
|
+
}
|
|
1255
|
+
else if (operation === 'update') {
|
|
1256
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1257
|
+
const agentBotId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('agentBotId', i), 'Agent Bot ID');
|
|
1258
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1259
|
+
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'PATCH', `/accounts/${accountId}/agent_bots/${agentBotId}`, updateFields);
|
|
1260
|
+
}
|
|
1261
|
+
else if (operation === 'delete') {
|
|
1262
|
+
const accountId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('accountId', i), 'Account ID');
|
|
1263
|
+
const agentBotId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('agentBotId', i), 'Agent Bot ID');
|
|
1264
|
+
await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'DELETE', `/accounts/${accountId}/agent_bots/${agentBotId}`);
|
|
1265
|
+
responseData = { success: true, id: agentBotId };
|
|
1266
|
+
}
|
|
1267
|
+
else {
|
|
1268
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
else if (resource === 'publicContact') {
|
|
1272
|
+
const credentials = await this.getCredentials('chatwootPublicApi');
|
|
1273
|
+
const inboxIdentifier = credentials.inboxIdentifier;
|
|
1274
|
+
if (operation === 'create') {
|
|
1275
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1276
|
+
if (additionalFields.custom_attributes && typeof additionalFields.custom_attributes === 'string') {
|
|
1277
|
+
additionalFields.custom_attributes = JSON.parse(additionalFields.custom_attributes);
|
|
1278
|
+
}
|
|
1279
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts`, additionalFields);
|
|
1280
|
+
}
|
|
1281
|
+
else if (operation === 'get') {
|
|
1282
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1283
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'GET', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}`);
|
|
1284
|
+
}
|
|
1285
|
+
else if (operation === 'update') {
|
|
1286
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1287
|
+
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1288
|
+
if (updateFields.custom_attributes && typeof updateFields.custom_attributes === 'string') {
|
|
1289
|
+
updateFields.custom_attributes = JSON.parse(updateFields.custom_attributes);
|
|
1290
|
+
}
|
|
1291
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'PATCH', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}`, updateFields);
|
|
1292
|
+
}
|
|
1293
|
+
else {
|
|
1294
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
else if (resource === 'publicConversation') {
|
|
1298
|
+
const credentials = await this.getCredentials('chatwootPublicApi');
|
|
1299
|
+
const inboxIdentifier = credentials.inboxIdentifier;
|
|
1300
|
+
if (operation === 'create') {
|
|
1301
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1302
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1303
|
+
if (additionalFields.custom_attributes && typeof additionalFields.custom_attributes === 'string') {
|
|
1304
|
+
additionalFields.custom_attributes = JSON.parse(additionalFields.custom_attributes);
|
|
1305
|
+
}
|
|
1306
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations`, additionalFields);
|
|
1307
|
+
}
|
|
1308
|
+
else if (operation === 'get') {
|
|
1309
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1310
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1311
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'GET', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations/${conversationId}`);
|
|
1312
|
+
}
|
|
1313
|
+
else if (operation === 'getAll') {
|
|
1314
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1315
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'GET', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations`);
|
|
1316
|
+
}
|
|
1317
|
+
else if (operation === 'resolve') {
|
|
1318
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1319
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1320
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations/${conversationId}/toggle_status`);
|
|
1321
|
+
}
|
|
1322
|
+
else if (operation === 'toggleTyping') {
|
|
1323
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1324
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1325
|
+
const typingStatus = this.getNodeParameter('typingStatus', i);
|
|
1326
|
+
const body = { typing_status: typingStatus };
|
|
1327
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations/${conversationId}/toggle_typing`, body);
|
|
1328
|
+
}
|
|
1329
|
+
else if (operation === 'updateLastSeen') {
|
|
1330
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1331
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1332
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations/${conversationId}/update_last_seen`);
|
|
1333
|
+
}
|
|
1334
|
+
else {
|
|
1335
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
else if (resource === 'publicMessage') {
|
|
1339
|
+
const credentials = await this.getCredentials('chatwootPublicApi');
|
|
1340
|
+
const inboxIdentifier = credentials.inboxIdentifier;
|
|
1341
|
+
if (operation === 'create') {
|
|
1342
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1343
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1344
|
+
const content = this.getNodeParameter('content', i);
|
|
1345
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1346
|
+
const body = { content, ...additionalFields };
|
|
1347
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations/${conversationId}/messages`, body);
|
|
1348
|
+
}
|
|
1349
|
+
else if (operation === 'getAll') {
|
|
1350
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1351
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1352
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'GET', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations/${conversationId}/messages`);
|
|
1353
|
+
}
|
|
1354
|
+
else if (operation === 'update') {
|
|
1355
|
+
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1356
|
+
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1357
|
+
const messageId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('messageId', i), 'Message ID');
|
|
1358
|
+
const content = this.getNodeParameter('content', i);
|
|
1359
|
+
const body = { content };
|
|
1360
|
+
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'PATCH', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations/${conversationId}/messages/${messageId}`, body);
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1363
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
799
1366
|
else {
|
|
800
1367
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Resource "${resource}" is not supported`, { itemIndex: i });
|
|
801
1368
|
}
|