@renatoascencio/n8n-nodes-chatwoot 0.4.3 → 0.6.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.
Files changed (202) hide show
  1. package/dist/nodes/Chatwoot/Chatwoot.node.js +544 -0
  2. package/dist/nodes/Chatwoot/Chatwoot.node.js.map +1 -1
  3. package/dist/nodes/Chatwoot/ChatwootTrigger.node.js +10 -0
  4. package/dist/nodes/Chatwoot/ChatwootTrigger.node.js.map +1 -1
  5. package/dist/nodes/Chatwoot/resources/campaign/create.operation.d.ts +2 -0
  6. package/dist/nodes/Chatwoot/resources/campaign/create.operation.js +56 -0
  7. package/dist/nodes/Chatwoot/resources/campaign/create.operation.js.map +1 -0
  8. package/dist/nodes/Chatwoot/resources/campaign/delete.operation.d.ts +2 -0
  9. package/dist/nodes/Chatwoot/resources/campaign/delete.operation.js +15 -0
  10. package/dist/nodes/Chatwoot/resources/campaign/delete.operation.js.map +1 -0
  11. package/dist/nodes/Chatwoot/resources/campaign/get.operation.d.ts +2 -0
  12. package/dist/nodes/Chatwoot/resources/campaign/get.operation.js +15 -0
  13. package/dist/nodes/Chatwoot/resources/campaign/get.operation.js.map +1 -0
  14. package/dist/nodes/Chatwoot/resources/campaign/getAll.operation.d.ts +2 -0
  15. package/dist/nodes/Chatwoot/resources/campaign/getAll.operation.js +5 -0
  16. package/dist/nodes/Chatwoot/resources/campaign/getAll.operation.js.map +1 -0
  17. package/dist/nodes/Chatwoot/resources/campaign/index.d.ts +3 -0
  18. package/dist/nodes/Chatwoot/resources/campaign/index.js +31 -0
  19. package/dist/nodes/Chatwoot/resources/campaign/index.js.map +1 -0
  20. package/dist/nodes/Chatwoot/resources/campaign/update.operation.d.ts +2 -0
  21. package/dist/nodes/Chatwoot/resources/campaign/update.operation.js +46 -0
  22. package/dist/nodes/Chatwoot/resources/campaign/update.operation.js.map +1 -0
  23. package/dist/nodes/Chatwoot/resources/company/create.operation.d.ts +2 -0
  24. package/dist/nodes/Chatwoot/resources/company/create.operation.js +40 -0
  25. package/dist/nodes/Chatwoot/resources/company/create.operation.js.map +1 -0
  26. package/dist/nodes/Chatwoot/resources/company/delete.operation.d.ts +2 -0
  27. package/dist/nodes/Chatwoot/resources/company/delete.operation.js +15 -0
  28. package/dist/nodes/Chatwoot/resources/company/delete.operation.js.map +1 -0
  29. package/dist/nodes/Chatwoot/resources/company/get.operation.d.ts +2 -0
  30. package/dist/nodes/Chatwoot/resources/company/get.operation.js +15 -0
  31. package/dist/nodes/Chatwoot/resources/company/get.operation.js.map +1 -0
  32. package/dist/nodes/Chatwoot/resources/company/getAll.operation.d.ts +2 -0
  33. package/dist/nodes/Chatwoot/resources/company/getAll.operation.js +46 -0
  34. package/dist/nodes/Chatwoot/resources/company/getAll.operation.js.map +1 -0
  35. package/dist/nodes/Chatwoot/resources/company/index.d.ts +3 -0
  36. package/dist/nodes/Chatwoot/resources/company/index.js +34 -0
  37. package/dist/nodes/Chatwoot/resources/company/index.js.map +1 -0
  38. package/dist/nodes/Chatwoot/resources/company/search.operation.d.ts +2 -0
  39. package/dist/nodes/Chatwoot/resources/company/search.operation.js +32 -0
  40. package/dist/nodes/Chatwoot/resources/company/search.operation.js.map +1 -0
  41. package/dist/nodes/Chatwoot/resources/company/update.operation.d.ts +2 -0
  42. package/dist/nodes/Chatwoot/resources/company/update.operation.js +47 -0
  43. package/dist/nodes/Chatwoot/resources/company/update.operation.js.map +1 -0
  44. package/dist/nodes/Chatwoot/resources/contact/contactableInboxes.operation.d.ts +2 -0
  45. package/dist/nodes/Chatwoot/resources/contact/contactableInboxes.operation.js +20 -0
  46. package/dist/nodes/Chatwoot/resources/contact/contactableInboxes.operation.js.map +1 -0
  47. package/dist/nodes/Chatwoot/resources/contact/exportContacts.operation.d.ts +2 -0
  48. package/dist/nodes/Chatwoot/resources/contact/exportContacts.operation.js +35 -0
  49. package/dist/nodes/Chatwoot/resources/contact/exportContacts.operation.js.map +1 -0
  50. package/dist/nodes/Chatwoot/resources/contact/importContacts.operation.d.ts +2 -0
  51. package/dist/nodes/Chatwoot/resources/contact/importContacts.operation.js +23 -0
  52. package/dist/nodes/Chatwoot/resources/contact/importContacts.operation.js.map +1 -0
  53. package/dist/nodes/Chatwoot/resources/contact/index.js +24 -0
  54. package/dist/nodes/Chatwoot/resources/contact/index.js.map +1 -1
  55. package/dist/nodes/Chatwoot/resources/contactNote/create.operation.d.ts +2 -0
  56. package/dist/nodes/Chatwoot/resources/contactNote/create.operation.js +25 -0
  57. package/dist/nodes/Chatwoot/resources/contactNote/create.operation.js.map +1 -0
  58. package/dist/nodes/Chatwoot/resources/contactNote/delete.operation.d.ts +2 -0
  59. package/dist/nodes/Chatwoot/resources/contactNote/delete.operation.js +24 -0
  60. package/dist/nodes/Chatwoot/resources/contactNote/delete.operation.js.map +1 -0
  61. package/dist/nodes/Chatwoot/resources/contactNote/getAll.operation.d.ts +2 -0
  62. package/dist/nodes/Chatwoot/resources/contactNote/getAll.operation.js +15 -0
  63. package/dist/nodes/Chatwoot/resources/contactNote/getAll.operation.js.map +1 -0
  64. package/dist/nodes/Chatwoot/resources/contactNote/index.d.ts +3 -0
  65. package/dist/nodes/Chatwoot/resources/contactNote/index.js +28 -0
  66. package/dist/nodes/Chatwoot/resources/contactNote/index.js.map +1 -0
  67. package/dist/nodes/Chatwoot/resources/contactNote/update.operation.d.ts +2 -0
  68. package/dist/nodes/Chatwoot/resources/contactNote/update.operation.js +34 -0
  69. package/dist/nodes/Chatwoot/resources/contactNote/update.operation.js.map +1 -0
  70. package/dist/nodes/Chatwoot/resources/conversation/delete.operation.d.ts +2 -0
  71. package/dist/nodes/Chatwoot/resources/conversation/delete.operation.js +20 -0
  72. package/dist/nodes/Chatwoot/resources/conversation/delete.operation.js.map +1 -0
  73. package/dist/nodes/Chatwoot/resources/conversation/index.js +48 -0
  74. package/dist/nodes/Chatwoot/resources/conversation/index.js.map +1 -1
  75. package/dist/nodes/Chatwoot/resources/conversation/mute.operation.d.ts +2 -0
  76. package/dist/nodes/Chatwoot/resources/conversation/mute.operation.js +20 -0
  77. package/dist/nodes/Chatwoot/resources/conversation/mute.operation.js.map +1 -0
  78. package/dist/nodes/Chatwoot/resources/conversation/search.operation.d.ts +2 -0
  79. package/dist/nodes/Chatwoot/resources/conversation/search.operation.js +48 -0
  80. package/dist/nodes/Chatwoot/resources/conversation/search.operation.js.map +1 -0
  81. package/dist/nodes/Chatwoot/resources/conversation/toggleTyping.operation.d.ts +2 -0
  82. package/dist/nodes/Chatwoot/resources/conversation/toggleTyping.operation.js +51 -0
  83. package/dist/nodes/Chatwoot/resources/conversation/toggleTyping.operation.js.map +1 -0
  84. package/dist/nodes/Chatwoot/resources/conversation/transcript.operation.d.ts +2 -0
  85. package/dist/nodes/Chatwoot/resources/conversation/transcript.operation.js +34 -0
  86. package/dist/nodes/Chatwoot/resources/conversation/transcript.operation.js.map +1 -0
  87. package/dist/nodes/Chatwoot/resources/conversation/unmute.operation.d.ts +2 -0
  88. package/dist/nodes/Chatwoot/resources/conversation/unmute.operation.js +20 -0
  89. package/dist/nodes/Chatwoot/resources/conversation/unmute.operation.js.map +1 -0
  90. package/dist/nodes/Chatwoot/resources/conversationParticipant/add.operation.d.ts +2 -0
  91. package/dist/nodes/Chatwoot/resources/conversationParticipant/add.operation.js +24 -0
  92. package/dist/nodes/Chatwoot/resources/conversationParticipant/add.operation.js.map +1 -0
  93. package/dist/nodes/Chatwoot/resources/conversationParticipant/getAll.operation.d.ts +2 -0
  94. package/dist/nodes/Chatwoot/resources/conversationParticipant/getAll.operation.js +15 -0
  95. package/dist/nodes/Chatwoot/resources/conversationParticipant/getAll.operation.js.map +1 -0
  96. package/dist/nodes/Chatwoot/resources/conversationParticipant/index.d.ts +3 -0
  97. package/dist/nodes/Chatwoot/resources/conversationParticipant/index.js +25 -0
  98. package/dist/nodes/Chatwoot/resources/conversationParticipant/index.js.map +1 -0
  99. package/dist/nodes/Chatwoot/resources/conversationParticipant/remove.operation.d.ts +2 -0
  100. package/dist/nodes/Chatwoot/resources/conversationParticipant/remove.operation.js +24 -0
  101. package/dist/nodes/Chatwoot/resources/conversationParticipant/remove.operation.js.map +1 -0
  102. package/dist/nodes/Chatwoot/resources/csatSurvey/download.operation.d.ts +2 -0
  103. package/dist/nodes/Chatwoot/resources/csatSurvey/download.operation.js +35 -0
  104. package/dist/nodes/Chatwoot/resources/csatSurvey/download.operation.js.map +1 -0
  105. package/dist/nodes/Chatwoot/resources/csatSurvey/index.js +19 -1
  106. package/dist/nodes/Chatwoot/resources/csatSurvey/index.js.map +1 -1
  107. package/dist/nodes/Chatwoot/resources/csatSurvey/metrics.operation.d.ts +2 -0
  108. package/dist/nodes/Chatwoot/resources/csatSurvey/metrics.operation.js +35 -0
  109. package/dist/nodes/Chatwoot/resources/csatSurvey/metrics.operation.js.map +1 -0
  110. package/dist/nodes/Chatwoot/resources/helpCenter/index.js +24 -0
  111. package/dist/nodes/Chatwoot/resources/helpCenter/index.js.map +1 -1
  112. package/dist/nodes/Chatwoot/resources/helpCenter/listArticles.operation.d.ts +2 -0
  113. package/dist/nodes/Chatwoot/resources/helpCenter/listArticles.operation.js +90 -0
  114. package/dist/nodes/Chatwoot/resources/helpCenter/listArticles.operation.js.map +1 -0
  115. package/dist/nodes/Chatwoot/resources/helpCenter/listCategories.operation.d.ts +2 -0
  116. package/dist/nodes/Chatwoot/resources/helpCenter/listCategories.operation.js +33 -0
  117. package/dist/nodes/Chatwoot/resources/helpCenter/listCategories.operation.js.map +1 -0
  118. package/dist/nodes/Chatwoot/resources/helpCenter/listPortals.operation.d.ts +2 -0
  119. package/dist/nodes/Chatwoot/resources/helpCenter/listPortals.operation.js +5 -0
  120. package/dist/nodes/Chatwoot/resources/helpCenter/listPortals.operation.js.map +1 -0
  121. package/dist/nodes/Chatwoot/resources/macro/create.operation.d.ts +2 -0
  122. package/dist/nodes/Chatwoot/resources/macro/create.operation.js +60 -0
  123. package/dist/nodes/Chatwoot/resources/macro/create.operation.js.map +1 -0
  124. package/dist/nodes/Chatwoot/resources/macro/delete.operation.d.ts +2 -0
  125. package/dist/nodes/Chatwoot/resources/macro/delete.operation.js +20 -0
  126. package/dist/nodes/Chatwoot/resources/macro/delete.operation.js.map +1 -0
  127. package/dist/nodes/Chatwoot/resources/macro/execute.operation.d.ts +2 -0
  128. package/dist/nodes/Chatwoot/resources/macro/execute.operation.js +34 -0
  129. package/dist/nodes/Chatwoot/resources/macro/execute.operation.js.map +1 -0
  130. package/dist/nodes/Chatwoot/resources/macro/get.operation.d.ts +2 -0
  131. package/dist/nodes/Chatwoot/resources/macro/get.operation.js +20 -0
  132. package/dist/nodes/Chatwoot/resources/macro/get.operation.js.map +1 -0
  133. package/dist/nodes/Chatwoot/resources/macro/getAll.operation.d.ts +2 -0
  134. package/dist/nodes/Chatwoot/resources/macro/getAll.operation.js +5 -0
  135. package/dist/nodes/Chatwoot/resources/macro/getAll.operation.js.map +1 -0
  136. package/dist/nodes/Chatwoot/resources/macro/index.d.ts +3 -0
  137. package/dist/nodes/Chatwoot/resources/macro/index.js +68 -0
  138. package/dist/nodes/Chatwoot/resources/macro/index.js.map +1 -0
  139. package/dist/nodes/Chatwoot/resources/macro/update.operation.d.ts +2 -0
  140. package/dist/nodes/Chatwoot/resources/macro/update.operation.js +60 -0
  141. package/dist/nodes/Chatwoot/resources/macro/update.operation.js.map +1 -0
  142. package/dist/nodes/Chatwoot/resources/notification/delete.operation.d.ts +2 -0
  143. package/dist/nodes/Chatwoot/resources/notification/delete.operation.js +20 -0
  144. package/dist/nodes/Chatwoot/resources/notification/delete.operation.js.map +1 -0
  145. package/dist/nodes/Chatwoot/resources/notification/getAll.operation.d.ts +2 -0
  146. package/dist/nodes/Chatwoot/resources/notification/getAll.operation.js +74 -0
  147. package/dist/nodes/Chatwoot/resources/notification/getAll.operation.js.map +1 -0
  148. package/dist/nodes/Chatwoot/resources/notification/index.d.ts +3 -0
  149. package/dist/nodes/Chatwoot/resources/notification/index.js +68 -0
  150. package/dist/nodes/Chatwoot/resources/notification/index.js.map +1 -0
  151. package/dist/nodes/Chatwoot/resources/notification/markRead.operation.d.ts +2 -0
  152. package/dist/nodes/Chatwoot/resources/notification/markRead.operation.js +20 -0
  153. package/dist/nodes/Chatwoot/resources/notification/markRead.operation.js.map +1 -0
  154. package/dist/nodes/Chatwoot/resources/notification/markUnread.operation.d.ts +2 -0
  155. package/dist/nodes/Chatwoot/resources/notification/markUnread.operation.js +20 -0
  156. package/dist/nodes/Chatwoot/resources/notification/markUnread.operation.js.map +1 -0
  157. package/dist/nodes/Chatwoot/resources/notification/readAll.operation.d.ts +2 -0
  158. package/dist/nodes/Chatwoot/resources/notification/readAll.operation.js +5 -0
  159. package/dist/nodes/Chatwoot/resources/notification/readAll.operation.js.map +1 -0
  160. package/dist/nodes/Chatwoot/resources/notification/unreadCount.operation.d.ts +2 -0
  161. package/dist/nodes/Chatwoot/resources/notification/unreadCount.operation.js +5 -0
  162. package/dist/nodes/Chatwoot/resources/notification/unreadCount.operation.js.map +1 -0
  163. package/dist/nodes/Chatwoot/resources/profile/index.js +8 -1
  164. package/dist/nodes/Chatwoot/resources/profile/index.js.map +1 -1
  165. package/dist/nodes/Chatwoot/resources/profile/update.operation.d.ts +2 -0
  166. package/dist/nodes/Chatwoot/resources/profile/update.operation.js +54 -0
  167. package/dist/nodes/Chatwoot/resources/profile/update.operation.js.map +1 -0
  168. package/dist/nodes/Chatwoot/resources/search/index.d.ts +3 -0
  169. package/dist/nodes/Chatwoot/resources/search/index.js +28 -0
  170. package/dist/nodes/Chatwoot/resources/search/index.js.map +1 -0
  171. package/dist/nodes/Chatwoot/resources/search/searchAll.operation.d.ts +2 -0
  172. package/dist/nodes/Chatwoot/resources/search/searchAll.operation.js +15 -0
  173. package/dist/nodes/Chatwoot/resources/search/searchAll.operation.js.map +1 -0
  174. package/dist/nodes/Chatwoot/resources/search/searchContacts.operation.d.ts +2 -0
  175. package/dist/nodes/Chatwoot/resources/search/searchContacts.operation.js +32 -0
  176. package/dist/nodes/Chatwoot/resources/search/searchContacts.operation.js.map +1 -0
  177. package/dist/nodes/Chatwoot/resources/search/searchConversations.operation.d.ts +2 -0
  178. package/dist/nodes/Chatwoot/resources/search/searchConversations.operation.js +32 -0
  179. package/dist/nodes/Chatwoot/resources/search/searchConversations.operation.js.map +1 -0
  180. package/dist/nodes/Chatwoot/resources/search/searchMessages.operation.d.ts +2 -0
  181. package/dist/nodes/Chatwoot/resources/search/searchMessages.operation.js +32 -0
  182. package/dist/nodes/Chatwoot/resources/search/searchMessages.operation.js.map +1 -0
  183. package/dist/nodes/Chatwoot/resources/slaPolicy/create.operation.d.ts +2 -0
  184. package/dist/nodes/Chatwoot/resources/slaPolicy/create.operation.js +60 -0
  185. package/dist/nodes/Chatwoot/resources/slaPolicy/create.operation.js.map +1 -0
  186. package/dist/nodes/Chatwoot/resources/slaPolicy/delete.operation.d.ts +2 -0
  187. package/dist/nodes/Chatwoot/resources/slaPolicy/delete.operation.js +15 -0
  188. package/dist/nodes/Chatwoot/resources/slaPolicy/delete.operation.js.map +1 -0
  189. package/dist/nodes/Chatwoot/resources/slaPolicy/get.operation.d.ts +2 -0
  190. package/dist/nodes/Chatwoot/resources/slaPolicy/get.operation.js +15 -0
  191. package/dist/nodes/Chatwoot/resources/slaPolicy/get.operation.js.map +1 -0
  192. package/dist/nodes/Chatwoot/resources/slaPolicy/getAll.operation.d.ts +2 -0
  193. package/dist/nodes/Chatwoot/resources/slaPolicy/getAll.operation.js +5 -0
  194. package/dist/nodes/Chatwoot/resources/slaPolicy/getAll.operation.js.map +1 -0
  195. package/dist/nodes/Chatwoot/resources/slaPolicy/index.d.ts +3 -0
  196. package/dist/nodes/Chatwoot/resources/slaPolicy/index.js +31 -0
  197. package/dist/nodes/Chatwoot/resources/slaPolicy/index.js.map +1 -0
  198. package/dist/nodes/Chatwoot/resources/slaPolicy/update.operation.d.ts +2 -0
  199. package/dist/nodes/Chatwoot/resources/slaPolicy/update.operation.js +67 -0
  200. package/dist/nodes/Chatwoot/resources/slaPolicy/update.operation.js.map +1 -0
  201. package/dist/tsconfig.tsbuildinfo +1 -1
  202. package/package.json +1 -1
@@ -23,6 +23,14 @@ const helpCenter_1 = require("./resources/helpCenter");
23
23
  const integration_1 = require("./resources/integration");
24
24
  const auditLog_1 = require("./resources/auditLog");
25
25
  const csatSurvey_1 = require("./resources/csatSurvey");
26
+ const macro_1 = require("./resources/macro");
27
+ const notification_1 = require("./resources/notification");
28
+ const campaign_1 = require("./resources/campaign");
29
+ const contactNote_1 = require("./resources/contactNote");
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");
26
34
  const platformAccount_1 = require("./resources/platformAccount");
27
35
  const platformUser_1 = require("./resources/platformUser");
28
36
  const accountUser_1 = require("./resources/accountUser");
@@ -72,6 +80,14 @@ class Chatwoot {
72
80
  'integration',
73
81
  'auditLog',
74
82
  'csatSurvey',
83
+ 'macro',
84
+ 'notification',
85
+ 'campaign',
86
+ 'contactNote',
87
+ 'conversationParticipant',
88
+ 'company',
89
+ 'search',
90
+ 'slaPolicy',
75
91
  ],
76
92
  },
77
93
  },
@@ -107,9 +123,13 @@ class Chatwoot {
107
123
  { name: 'Agent Bot', value: 'agentBot' },
108
124
  { name: 'Audit Log', value: 'auditLog' },
109
125
  { name: 'Automation Rule', value: 'automationRule' },
126
+ { name: 'Campaign', value: 'campaign' },
110
127
  { name: 'Canned Response', value: 'cannedResponse' },
128
+ { name: 'Company (Enterprise)', value: 'company' },
111
129
  { name: 'Contact', value: 'contact' },
130
+ { name: 'Contact Note', value: 'contactNote' },
112
131
  { name: 'Conversation', value: 'conversation' },
132
+ { name: 'Conversation Participant', value: 'conversationParticipant' },
113
133
  { name: 'CSAT Survey', value: 'csatSurvey' },
114
134
  { name: 'Custom Attribute', value: 'customAttribute' },
115
135
  { name: 'Custom Filter', value: 'customFilter' },
@@ -117,9 +137,13 @@ class Chatwoot {
117
137
  { name: 'Inbox', value: 'inbox' },
118
138
  { name: 'Integration', value: 'integration' },
119
139
  { name: 'Label', value: 'label' },
140
+ { name: 'Macro', value: 'macro' },
120
141
  { name: 'Message', value: 'message' },
142
+ { name: 'Notification', value: 'notification' },
121
143
  { name: 'Profile', value: 'profile' },
122
144
  { name: 'Report', value: 'report' },
145
+ { name: 'Search', value: 'search' },
146
+ { name: 'SLA Policy (Enterprise)', value: 'slaPolicy' },
123
147
  { name: 'Team', value: 'team' },
124
148
  { name: 'Webhook', value: 'webhook' },
125
149
  { name: '[Platform] Account', value: 'platformAccount' },
@@ -152,6 +176,14 @@ class Chatwoot {
152
176
  integration_1.integrationOperations,
153
177
  auditLog_1.auditLogOperations,
154
178
  csatSurvey_1.csatSurveyOperations,
179
+ macro_1.macroOperations,
180
+ notification_1.notificationOperations,
181
+ campaign_1.campaignOperations,
182
+ contactNote_1.contactNoteOperations,
183
+ conversationParticipant_1.conversationParticipantOperations,
184
+ company_1.companyOperations,
185
+ search_1.searchOperations,
186
+ slaPolicy_1.slaPolicyOperations,
155
187
  platformAccount_1.platformAccountOperations,
156
188
  platformUser_1.platformUserOperations,
157
189
  accountUser_1.accountUserOperations,
@@ -179,6 +211,14 @@ class Chatwoot {
179
211
  ...integration_1.integrationFields,
180
212
  ...auditLog_1.auditLogFields,
181
213
  ...csatSurvey_1.csatSurveyFields,
214
+ ...macro_1.macroFields,
215
+ ...notification_1.notificationFields,
216
+ ...campaign_1.campaignFields,
217
+ ...contactNote_1.contactNoteFields,
218
+ ...conversationParticipant_1.conversationParticipantFields,
219
+ ...company_1.companyFields,
220
+ ...search_1.searchFields,
221
+ ...slaPolicy_1.slaPolicyFields,
182
222
  ...platformAccount_1.platformAccountFields,
183
223
  ...platformUser_1.platformUserFields,
184
224
  ...accountUser_1.accountUserFields,
@@ -691,6 +731,48 @@ class Chatwoot {
691
731
  qs.assignee_type = filters.assignee_type;
692
732
  responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/conversations/meta', {}, qs);
693
733
  }
734
+ else if (operation === 'mute') {
735
+ const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
736
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/conversations/${conversationId}/mute`);
737
+ }
738
+ else if (operation === 'unmute') {
739
+ const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
740
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/conversations/${conversationId}/unmute`);
741
+ }
742
+ else if (operation === 'delete') {
743
+ const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
744
+ await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/conversations/${conversationId}`);
745
+ responseData = { success: true, id: conversationId };
746
+ }
747
+ else if (operation === 'search') {
748
+ const query = this.getNodeParameter('query', i);
749
+ const returnAll = this.getNodeParameter('returnAll', i);
750
+ const qs2 = { q: query };
751
+ if (returnAll) {
752
+ responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/conversations/search', {}, qs2, 'payload');
753
+ }
754
+ else {
755
+ const limit = this.getNodeParameter('limit', i);
756
+ qs2.page = 1;
757
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/conversations/search', {}, qs2));
758
+ const payload = (result.payload || []);
759
+ responseData = payload.slice(0, limit);
760
+ }
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
+ }
694
776
  else {
695
777
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
696
778
  }
@@ -875,6 +957,24 @@ class Chatwoot {
875
957
  const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
876
958
  responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/contacts/${contactId}/labels`);
877
959
  }
960
+ else if (operation === 'import') {
961
+ const fileContent = this.getNodeParameter('fileContent', i);
962
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/contacts/import', { import_file: fileContent });
963
+ }
964
+ else if (operation === 'export') {
965
+ const options = this.getNodeParameter('options', i);
966
+ const body = {};
967
+ if (options.tag)
968
+ body.tag = options.tag;
969
+ if (options.column_names) {
970
+ body.column_names = options.column_names.split(',').map((c) => c.trim());
971
+ }
972
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/contacts/export', body);
973
+ }
974
+ else if (operation === 'contactableInboxes') {
975
+ const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
976
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/contacts/${contactId}/contactable_inboxes`);
977
+ }
878
978
  else {
879
979
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
880
980
  }
@@ -1062,6 +1162,19 @@ class Chatwoot {
1062
1162
  if (operation === 'fetch') {
1063
1163
  responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/profile');
1064
1164
  }
1165
+ else if (operation === 'update') {
1166
+ const updateFields = this.getNodeParameter('updateFields', i);
1167
+ const body = {};
1168
+ if (updateFields.name)
1169
+ body.name = updateFields.name;
1170
+ if (updateFields.email)
1171
+ body.email = updateFields.email;
1172
+ if (updateFields.availability)
1173
+ body.availability = updateFields.availability;
1174
+ if (updateFields.auto_offline !== undefined)
1175
+ body.auto_offline = updateFields.auto_offline;
1176
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PUT', '/profile', body);
1177
+ }
1065
1178
  else {
1066
1179
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1067
1180
  }
@@ -1100,6 +1213,39 @@ class Chatwoot {
1100
1213
  const body = { title, content, ...additionalFields };
1101
1214
  responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/portals/${portalSlug}/articles`, body);
1102
1215
  }
1216
+ else if (operation === 'listPortals') {
1217
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/portals');
1218
+ }
1219
+ else if (operation === 'listCategories') {
1220
+ const portalSlug = this.getNodeParameter('portalSlug', i);
1221
+ const locale = this.getNodeParameter('locale', i, 'en');
1222
+ const qs = {};
1223
+ if (locale)
1224
+ qs.locale = locale;
1225
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/portals/${portalSlug}/categories`, {}, qs);
1226
+ }
1227
+ else if (operation === 'listArticles') {
1228
+ const portalSlug = this.getNodeParameter('portalSlug', i);
1229
+ const returnAll = this.getNodeParameter('returnAll', i);
1230
+ const options = this.getNodeParameter('options', i);
1231
+ const qs = {};
1232
+ if (options.locale)
1233
+ qs.locale = options.locale;
1234
+ if (options.category_slug)
1235
+ qs.category_slug = options.category_slug;
1236
+ if (options.status)
1237
+ qs.status = options.status;
1238
+ if (returnAll) {
1239
+ responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', `/portals/${portalSlug}/articles`, {}, qs, 'payload');
1240
+ }
1241
+ else {
1242
+ const limit = this.getNodeParameter('limit', i);
1243
+ qs.page = 1;
1244
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/portals/${portalSlug}/articles`, {}, qs));
1245
+ const payload = (result.payload || []);
1246
+ responseData = payload.slice(0, limit);
1247
+ }
1248
+ }
1103
1249
  else {
1104
1250
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1105
1251
  }
@@ -1159,6 +1305,404 @@ class Chatwoot {
1159
1305
  const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
1160
1306
  responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/csat_survey/${conversationId}`);
1161
1307
  }
1308
+ else if (operation === 'metrics') {
1309
+ const options = this.getNodeParameter('options', i);
1310
+ const qs = {};
1311
+ if (options.since)
1312
+ qs.since = new Date(options.since).getTime() / 1000;
1313
+ if (options.until)
1314
+ qs.until = new Date(options.until).getTime() / 1000;
1315
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/csat_survey_responses/metrics', {}, qs);
1316
+ }
1317
+ else if (operation === 'download') {
1318
+ const options = this.getNodeParameter('options', i);
1319
+ const qs = {};
1320
+ if (options.since)
1321
+ qs.since = new Date(options.since).getTime() / 1000;
1322
+ if (options.until)
1323
+ qs.until = new Date(options.until).getTime() / 1000;
1324
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/csat_survey_responses/download', {}, qs);
1325
+ }
1326
+ else {
1327
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1328
+ }
1329
+ }
1330
+ else if (resource === 'macro') {
1331
+ if (operation === 'getAll') {
1332
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/macros');
1333
+ }
1334
+ else if (operation === 'get') {
1335
+ const macroId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('macroId', i), 'Macro ID');
1336
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/macros/${macroId}`);
1337
+ }
1338
+ else if (operation === 'create') {
1339
+ const name = this.getNodeParameter('name', i);
1340
+ const actions = this.getNodeParameter('actions', i);
1341
+ const additionalFields = this.getNodeParameter('additionalFields', i);
1342
+ const body = {
1343
+ name,
1344
+ actions: typeof actions === 'string' ? JSON.parse(actions) : actions,
1345
+ };
1346
+ if (additionalFields.visibility)
1347
+ body.visibility = additionalFields.visibility;
1348
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/macros', body);
1349
+ }
1350
+ else if (operation === 'update') {
1351
+ const macroId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('macroId', i), 'Macro ID');
1352
+ const updateFields = this.getNodeParameter('updateFields', i);
1353
+ const body = {};
1354
+ if (updateFields.name)
1355
+ body.name = updateFields.name;
1356
+ if (updateFields.visibility)
1357
+ body.visibility = updateFields.visibility;
1358
+ if (updateFields.actions) {
1359
+ body.actions = typeof updateFields.actions === 'string'
1360
+ ? JSON.parse(updateFields.actions)
1361
+ : updateFields.actions;
1362
+ }
1363
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/macros/${macroId}`, body);
1364
+ }
1365
+ else if (operation === 'delete') {
1366
+ const macroId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('macroId', i), 'Macro ID');
1367
+ await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/macros/${macroId}`);
1368
+ responseData = { success: true, id: macroId };
1369
+ }
1370
+ else if (operation === 'execute') {
1371
+ const macroId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('macroId', i), 'Macro ID');
1372
+ const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
1373
+ const body = { conversation_ids: [conversationId] };
1374
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/macros/${macroId}/execute`, body);
1375
+ }
1376
+ else {
1377
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1378
+ }
1379
+ }
1380
+ else if (resource === 'notification') {
1381
+ if (operation === 'getAll') {
1382
+ const returnAll = this.getNodeParameter('returnAll', i);
1383
+ const options = this.getNodeParameter('options', i);
1384
+ const qs = {};
1385
+ const includes = [];
1386
+ if (options.includes_read)
1387
+ includes.push('read');
1388
+ if (options.includes_snoozed)
1389
+ includes.push('snoozed');
1390
+ if (includes.length > 0)
1391
+ qs['includes[]'] = includes;
1392
+ if (options.sort_order)
1393
+ qs.sort_order = options.sort_order;
1394
+ if (returnAll) {
1395
+ const allItems = [];
1396
+ let page = 1;
1397
+ let hasMore = true;
1398
+ while (hasMore) {
1399
+ qs.page = page;
1400
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/notifications', {}, qs));
1401
+ const data = result.data;
1402
+ const payload = ((data === null || data === void 0 ? void 0 : data.payload) || []);
1403
+ allItems.push(...payload);
1404
+ const meta = data === null || data === void 0 ? void 0 : data.meta;
1405
+ const count = (meta === null || meta === void 0 ? void 0 : meta.count) || 0;
1406
+ hasMore = payload.length > 0 && allItems.length < count;
1407
+ page += 1;
1408
+ if (page > 100)
1409
+ break;
1410
+ }
1411
+ responseData = allItems;
1412
+ }
1413
+ else {
1414
+ const limit = this.getNodeParameter('limit', i);
1415
+ qs.page = 1;
1416
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/notifications', {}, qs));
1417
+ const data = result.data;
1418
+ const payload = ((data === null || data === void 0 ? void 0 : data.payload) || []);
1419
+ responseData = payload.slice(0, limit);
1420
+ }
1421
+ }
1422
+ else if (operation === 'markRead') {
1423
+ const notificationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('notificationId', i), 'Notification ID');
1424
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/notifications/${notificationId}`);
1425
+ }
1426
+ else if (operation === 'delete') {
1427
+ const notificationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('notificationId', i), 'Notification ID');
1428
+ await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/notifications/${notificationId}`);
1429
+ responseData = { success: true, id: notificationId };
1430
+ }
1431
+ else if (operation === 'readAll') {
1432
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/notifications/read_all');
1433
+ }
1434
+ else if (operation === 'unreadCount') {
1435
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/notifications/unread_count');
1436
+ }
1437
+ else if (operation === 'markUnread') {
1438
+ const notificationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('notificationId', i), 'Notification ID');
1439
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/notifications/${notificationId}/unread`);
1440
+ }
1441
+ else {
1442
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1443
+ }
1444
+ }
1445
+ else if (resource === 'campaign') {
1446
+ if (operation === 'getAll') {
1447
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/campaigns');
1448
+ }
1449
+ else if (operation === 'get') {
1450
+ const campaignId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('campaignId', i), 'Campaign ID');
1451
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/campaigns/${campaignId}`);
1452
+ }
1453
+ else if (operation === 'create') {
1454
+ const title = this.getNodeParameter('title', i);
1455
+ const message = this.getNodeParameter('message', i);
1456
+ const additionalFields = this.getNodeParameter('additionalFields', i);
1457
+ const body = { title, message };
1458
+ if (additionalFields.inbox_id)
1459
+ body.inbox_id = additionalFields.inbox_id;
1460
+ if (additionalFields.scheduled_at)
1461
+ body.scheduled_at = additionalFields.scheduled_at;
1462
+ if (additionalFields.audience) {
1463
+ body.audience = typeof additionalFields.audience === 'string'
1464
+ ? JSON.parse(additionalFields.audience)
1465
+ : additionalFields.audience;
1466
+ }
1467
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/campaigns', body);
1468
+ }
1469
+ else if (operation === 'update') {
1470
+ const campaignId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('campaignId', i), 'Campaign ID');
1471
+ const updateFields = this.getNodeParameter('updateFields', i);
1472
+ const body = {};
1473
+ if (updateFields.title)
1474
+ body.title = updateFields.title;
1475
+ if (updateFields.message)
1476
+ body.message = updateFields.message;
1477
+ if (updateFields.scheduled_at)
1478
+ body.scheduled_at = updateFields.scheduled_at;
1479
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/campaigns/${campaignId}`, body);
1480
+ }
1481
+ else if (operation === 'delete') {
1482
+ const campaignId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('campaignId', i), 'Campaign ID');
1483
+ await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/campaigns/${campaignId}`);
1484
+ responseData = { success: true, id: campaignId };
1485
+ }
1486
+ else {
1487
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1488
+ }
1489
+ }
1490
+ else if (resource === 'contactNote') {
1491
+ if (operation === 'getAll') {
1492
+ const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
1493
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/contacts/${contactId}/notes`);
1494
+ }
1495
+ else if (operation === 'create') {
1496
+ const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
1497
+ const content = this.getNodeParameter('content', i);
1498
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/contacts/${contactId}/notes`, { content });
1499
+ }
1500
+ else if (operation === 'update') {
1501
+ const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
1502
+ const noteId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('noteId', i), 'Note ID');
1503
+ const content = this.getNodeParameter('content', i);
1504
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/contacts/${contactId}/notes/${noteId}`, { content });
1505
+ }
1506
+ else if (operation === 'delete') {
1507
+ const contactId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('contactId', i), 'Contact ID');
1508
+ const noteId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('noteId', i), 'Note ID');
1509
+ await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/contacts/${contactId}/notes/${noteId}`);
1510
+ responseData = { success: true, id: noteId };
1511
+ }
1512
+ else {
1513
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1514
+ }
1515
+ }
1516
+ else if (resource === 'conversationParticipant') {
1517
+ if (operation === 'getAll') {
1518
+ const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
1519
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/conversations/${conversationId}/participants`);
1520
+ }
1521
+ else if (operation === 'add') {
1522
+ const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
1523
+ const userIdsStr = this.getNodeParameter('userIds', i);
1524
+ const userIds = userIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
1525
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/conversations/${conversationId}/participants`, { user_ids: userIds });
1526
+ }
1527
+ else if (operation === 'remove') {
1528
+ const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
1529
+ const userIdsStr = this.getNodeParameter('userIds', i);
1530
+ const userIds = userIdsStr.split(',').map((id) => parseInt(id.trim(), 10));
1531
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/conversations/${conversationId}/participants`, { user_ids: userIds });
1532
+ }
1533
+ else {
1534
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1535
+ }
1536
+ }
1537
+ else if (resource === 'company') {
1538
+ if (operation === 'getAll') {
1539
+ const returnAll = this.getNodeParameter('returnAll', i);
1540
+ const options = this.getNodeParameter('options', i);
1541
+ const qs = {};
1542
+ if (options.sort)
1543
+ qs.sort = options.sort;
1544
+ if (returnAll) {
1545
+ responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/companies', {}, qs, 'payload');
1546
+ }
1547
+ else {
1548
+ const limit = this.getNodeParameter('limit', i);
1549
+ qs.page = 1;
1550
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/companies', {}, qs));
1551
+ const payload = (result.payload || []);
1552
+ responseData = payload.slice(0, limit);
1553
+ }
1554
+ }
1555
+ else if (operation === 'get') {
1556
+ const companyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('companyId', i), 'Company ID');
1557
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/companies/${companyId}`);
1558
+ }
1559
+ else if (operation === 'create') {
1560
+ const name = this.getNodeParameter('name', i);
1561
+ const additionalFields = this.getNodeParameter('additionalFields', i);
1562
+ const body = { name };
1563
+ if (additionalFields.domain)
1564
+ body.domain = additionalFields.domain;
1565
+ if (additionalFields.description)
1566
+ body.description = additionalFields.description;
1567
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/companies', body);
1568
+ }
1569
+ else if (operation === 'update') {
1570
+ const companyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('companyId', i), 'Company ID');
1571
+ const updateFields = this.getNodeParameter('updateFields', i);
1572
+ const body = {};
1573
+ if (updateFields.name)
1574
+ body.name = updateFields.name;
1575
+ if (updateFields.domain)
1576
+ body.domain = updateFields.domain;
1577
+ if (updateFields.description)
1578
+ body.description = updateFields.description;
1579
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/companies/${companyId}`, body);
1580
+ }
1581
+ else if (operation === 'delete') {
1582
+ const companyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('companyId', i), 'Company ID');
1583
+ await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/companies/${companyId}`);
1584
+ responseData = { success: true, id: companyId };
1585
+ }
1586
+ else if (operation === 'search') {
1587
+ const query = this.getNodeParameter('query', i);
1588
+ const returnAll = this.getNodeParameter('returnAll', i);
1589
+ const qs = { q: query };
1590
+ if (returnAll) {
1591
+ responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/companies/search', {}, qs, 'payload');
1592
+ }
1593
+ else {
1594
+ const limit = this.getNodeParameter('limit', i);
1595
+ qs.page = 1;
1596
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/companies/search', {}, qs));
1597
+ const payload = (result.payload || []);
1598
+ responseData = payload.slice(0, limit);
1599
+ }
1600
+ }
1601
+ else {
1602
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1603
+ }
1604
+ }
1605
+ else if (resource === 'search') {
1606
+ if (operation === 'searchAll') {
1607
+ const query = this.getNodeParameter('query', i);
1608
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search', {}, { q: query });
1609
+ }
1610
+ else if (operation === 'searchConversations') {
1611
+ const query = this.getNodeParameter('query', i);
1612
+ const returnAll = this.getNodeParameter('returnAll', i);
1613
+ const qs = { q: query };
1614
+ if (returnAll) {
1615
+ responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/search/conversations', {}, qs, 'payload');
1616
+ }
1617
+ else {
1618
+ const limit = this.getNodeParameter('limit', i);
1619
+ qs.page = 1;
1620
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search/conversations', {}, qs));
1621
+ const payload = (result.payload || []);
1622
+ responseData = payload.slice(0, limit);
1623
+ }
1624
+ }
1625
+ else if (operation === 'searchContacts') {
1626
+ const query = this.getNodeParameter('query', i);
1627
+ const returnAll = this.getNodeParameter('returnAll', i);
1628
+ const qs = { q: query };
1629
+ if (returnAll) {
1630
+ responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/search/contacts', {}, qs, 'payload');
1631
+ }
1632
+ else {
1633
+ const limit = this.getNodeParameter('limit', i);
1634
+ qs.page = 1;
1635
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search/contacts', {}, qs));
1636
+ const payload = (result.payload || []);
1637
+ responseData = payload.slice(0, limit);
1638
+ }
1639
+ }
1640
+ else if (operation === 'searchMessages') {
1641
+ const query = this.getNodeParameter('query', i);
1642
+ const returnAll = this.getNodeParameter('returnAll', i);
1643
+ const qs = { q: query };
1644
+ if (returnAll) {
1645
+ responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/search/messages', {}, qs, 'payload');
1646
+ }
1647
+ else {
1648
+ const limit = this.getNodeParameter('limit', i);
1649
+ qs.page = 1;
1650
+ const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/search/messages', {}, qs));
1651
+ const payload = (result.payload || []);
1652
+ responseData = payload.slice(0, limit);
1653
+ }
1654
+ }
1655
+ else {
1656
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1657
+ }
1658
+ }
1659
+ else if (resource === 'slaPolicy') {
1660
+ if (operation === 'getAll') {
1661
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/sla_policies');
1662
+ }
1663
+ else if (operation === 'get') {
1664
+ const slaPolicyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('slaPolicyId', i), 'SLA Policy ID');
1665
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', `/sla_policies/${slaPolicyId}`);
1666
+ }
1667
+ else if (operation === 'create') {
1668
+ const name = this.getNodeParameter('name', i);
1669
+ const additionalFields = this.getNodeParameter('additionalFields', i);
1670
+ const body = { name };
1671
+ if (additionalFields.description)
1672
+ body.description = additionalFields.description;
1673
+ if (additionalFields.first_response_time_threshold)
1674
+ body.first_response_time_threshold = additionalFields.first_response_time_threshold;
1675
+ if (additionalFields.next_response_time_threshold)
1676
+ body.next_response_time_threshold = additionalFields.next_response_time_threshold;
1677
+ if (additionalFields.resolution_time_threshold)
1678
+ body.resolution_time_threshold = additionalFields.resolution_time_threshold;
1679
+ if (additionalFields.only_during_business_hours !== undefined)
1680
+ body.only_during_business_hours = additionalFields.only_during_business_hours;
1681
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/sla_policies', body);
1682
+ }
1683
+ else if (operation === 'update') {
1684
+ const slaPolicyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('slaPolicyId', i), 'SLA Policy ID');
1685
+ const updateFields = this.getNodeParameter('updateFields', i);
1686
+ const body = {};
1687
+ if (updateFields.name)
1688
+ body.name = updateFields.name;
1689
+ if (updateFields.description)
1690
+ body.description = updateFields.description;
1691
+ if (updateFields.first_response_time_threshold)
1692
+ body.first_response_time_threshold = updateFields.first_response_time_threshold;
1693
+ if (updateFields.next_response_time_threshold)
1694
+ body.next_response_time_threshold = updateFields.next_response_time_threshold;
1695
+ if (updateFields.resolution_time_threshold)
1696
+ body.resolution_time_threshold = updateFields.resolution_time_threshold;
1697
+ if (updateFields.only_during_business_hours !== undefined)
1698
+ body.only_during_business_hours = updateFields.only_during_business_hours;
1699
+ responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/sla_policies/${slaPolicyId}`, body);
1700
+ }
1701
+ else if (operation === 'delete') {
1702
+ const slaPolicyId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('slaPolicyId', i), 'SLA Policy ID');
1703
+ await GenericFunctions_1.chatwootApiRequest.call(this, 'DELETE', `/sla_policies/${slaPolicyId}`);
1704
+ responseData = { success: true, id: slaPolicyId };
1705
+ }
1162
1706
  else {
1163
1707
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
1164
1708
  }