@renatoascencio/n8n-nodes-evolution-api 0.1.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 (423) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +330 -0
  3. package/dist/credentials/EvolutionApi.credentials.d.ts +10 -0
  4. package/dist/credentials/EvolutionApi.credentials.js +84 -0
  5. package/dist/credentials/EvolutionApi.credentials.js.map +1 -0
  6. package/dist/nodes/EvolutionApi/EvolutionApi.node.d.ts +19 -0
  7. package/dist/nodes/EvolutionApi/EvolutionApi.node.js +180 -0
  8. package/dist/nodes/EvolutionApi/EvolutionApi.node.js.map +1 -0
  9. package/dist/nodes/EvolutionApi/EvolutionApi.node.json +22 -0
  10. package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.d.ts +18 -0
  11. package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.js +615 -0
  12. package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.js.map +1 -0
  13. package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.json +19 -0
  14. package/dist/nodes/EvolutionApi/GenericFunctions.d.ts +114 -0
  15. package/dist/nodes/EvolutionApi/GenericFunctions.js +681 -0
  16. package/dist/nodes/EvolutionApi/GenericFunctions.js.map +1 -0
  17. package/dist/nodes/EvolutionApi/constants.d.ts +7 -0
  18. package/dist/nodes/EvolutionApi/constants.js +77 -0
  19. package/dist/nodes/EvolutionApi/constants.js.map +1 -0
  20. package/dist/nodes/EvolutionApi/evolution.svg +11 -0
  21. package/dist/nodes/EvolutionApi/resources/call/index.d.ts +5 -0
  22. package/dist/nodes/EvolutionApi/resources/call/index.js +62 -0
  23. package/dist/nodes/EvolutionApi/resources/call/index.js.map +1 -0
  24. package/dist/nodes/EvolutionApi/resources/call/offer.operation.d.ts +29 -0
  25. package/dist/nodes/EvolutionApi/resources/call/offer.operation.js +56 -0
  26. package/dist/nodes/EvolutionApi/resources/call/offer.operation.js.map +1 -0
  27. package/dist/nodes/EvolutionApi/resources/chat/archive.operation.d.ts +29 -0
  28. package/dist/nodes/EvolutionApi/resources/chat/archive.operation.js +44 -0
  29. package/dist/nodes/EvolutionApi/resources/chat/archive.operation.js.map +1 -0
  30. package/dist/nodes/EvolutionApi/resources/chat/checkNumbers.operation.d.ts +29 -0
  31. package/dist/nodes/EvolutionApi/resources/chat/checkNumbers.operation.js +28 -0
  32. package/dist/nodes/EvolutionApi/resources/chat/checkNumbers.operation.js.map +1 -0
  33. package/dist/nodes/EvolutionApi/resources/chat/deleteMessage.operation.d.ts +29 -0
  34. package/dist/nodes/EvolutionApi/resources/chat/deleteMessage.operation.js +68 -0
  35. package/dist/nodes/EvolutionApi/resources/chat/deleteMessage.operation.js.map +1 -0
  36. package/dist/nodes/EvolutionApi/resources/chat/downloadMedia.operation.d.ts +30 -0
  37. package/dist/nodes/EvolutionApi/resources/chat/downloadMedia.operation.js +143 -0
  38. package/dist/nodes/EvolutionApi/resources/chat/downloadMedia.operation.js.map +1 -0
  39. package/dist/nodes/EvolutionApi/resources/chat/editMessage.operation.d.ts +29 -0
  40. package/dist/nodes/EvolutionApi/resources/chat/editMessage.operation.js +49 -0
  41. package/dist/nodes/EvolutionApi/resources/chat/editMessage.operation.js.map +1 -0
  42. package/dist/nodes/EvolutionApi/resources/chat/get.operation.d.ts +29 -0
  43. package/dist/nodes/EvolutionApi/resources/chat/get.operation.js +28 -0
  44. package/dist/nodes/EvolutionApi/resources/chat/get.operation.js.map +1 -0
  45. package/dist/nodes/EvolutionApi/resources/chat/getChannels.operation.d.ts +29 -0
  46. package/dist/nodes/EvolutionApi/resources/chat/getChannels.operation.js +23 -0
  47. package/dist/nodes/EvolutionApi/resources/chat/getChannels.operation.js.map +1 -0
  48. package/dist/nodes/EvolutionApi/resources/chat/getContacts.operation.d.ts +29 -0
  49. package/dist/nodes/EvolutionApi/resources/chat/getContacts.operation.js +55 -0
  50. package/dist/nodes/EvolutionApi/resources/chat/getContacts.operation.js.map +1 -0
  51. package/dist/nodes/EvolutionApi/resources/chat/getMany.operation.d.ts +30 -0
  52. package/dist/nodes/EvolutionApi/resources/chat/getMany.operation.js +74 -0
  53. package/dist/nodes/EvolutionApi/resources/chat/getMany.operation.js.map +1 -0
  54. package/dist/nodes/EvolutionApi/resources/chat/getMessages.operation.d.ts +29 -0
  55. package/dist/nodes/EvolutionApi/resources/chat/getMessages.operation.js +124 -0
  56. package/dist/nodes/EvolutionApi/resources/chat/getMessages.operation.js.map +1 -0
  57. package/dist/nodes/EvolutionApi/resources/chat/getPollVotes.operation.d.ts +29 -0
  58. package/dist/nodes/EvolutionApi/resources/chat/getPollVotes.operation.js +36 -0
  59. package/dist/nodes/EvolutionApi/resources/chat/getPollVotes.operation.js.map +1 -0
  60. package/dist/nodes/EvolutionApi/resources/chat/getStatusUpdates.operation.d.ts +29 -0
  61. package/dist/nodes/EvolutionApi/resources/chat/getStatusUpdates.operation.js +57 -0
  62. package/dist/nodes/EvolutionApi/resources/chat/getStatusUpdates.operation.js.map +1 -0
  63. package/dist/nodes/EvolutionApi/resources/chat/helpers.d.ts +25 -0
  64. package/dist/nodes/EvolutionApi/resources/chat/helpers.js +219 -0
  65. package/dist/nodes/EvolutionApi/resources/chat/helpers.js.map +1 -0
  66. package/dist/nodes/EvolutionApi/resources/chat/index.d.ts +5 -0
  67. package/dist/nodes/EvolutionApi/resources/chat/index.js +209 -0
  68. package/dist/nodes/EvolutionApi/resources/chat/index.js.map +1 -0
  69. package/dist/nodes/EvolutionApi/resources/chat/markAsPlayed.operation.d.ts +29 -0
  70. package/dist/nodes/EvolutionApi/resources/chat/markAsPlayed.operation.js +49 -0
  71. package/dist/nodes/EvolutionApi/resources/chat/markAsPlayed.operation.js.map +1 -0
  72. package/dist/nodes/EvolutionApi/resources/chat/markAsRead.operation.d.ts +29 -0
  73. package/dist/nodes/EvolutionApi/resources/chat/markAsRead.operation.js +48 -0
  74. package/dist/nodes/EvolutionApi/resources/chat/markAsRead.operation.js.map +1 -0
  75. package/dist/nodes/EvolutionApi/resources/chat/markUnread.operation.d.ts +29 -0
  76. package/dist/nodes/EvolutionApi/resources/chat/markUnread.operation.js +35 -0
  77. package/dist/nodes/EvolutionApi/resources/chat/markUnread.operation.js.map +1 -0
  78. package/dist/nodes/EvolutionApi/resources/chat/sendPresence.operation.d.ts +29 -0
  79. package/dist/nodes/EvolutionApi/resources/chat/sendPresence.operation.js +53 -0
  80. package/dist/nodes/EvolutionApi/resources/chat/sendPresence.operation.js.map +1 -0
  81. package/dist/nodes/EvolutionApi/resources/chat/updateBlockStatus.operation.d.ts +29 -0
  82. package/dist/nodes/EvolutionApi/resources/chat/updateBlockStatus.operation.js +44 -0
  83. package/dist/nodes/EvolutionApi/resources/chat/updateBlockStatus.operation.js.map +1 -0
  84. package/dist/nodes/EvolutionApi/resources/chatbot/changeStatus.operation.d.ts +31 -0
  85. package/dist/nodes/EvolutionApi/resources/chatbot/changeStatus.operation.js +73 -0
  86. package/dist/nodes/EvolutionApi/resources/chatbot/changeStatus.operation.js.map +1 -0
  87. package/dist/nodes/EvolutionApi/resources/chatbot/create.operation.d.ts +38 -0
  88. package/dist/nodes/EvolutionApi/resources/chatbot/create.operation.js +251 -0
  89. package/dist/nodes/EvolutionApi/resources/chatbot/create.operation.js.map +1 -0
  90. package/dist/nodes/EvolutionApi/resources/chatbot/createCredential.operation.d.ts +29 -0
  91. package/dist/nodes/EvolutionApi/resources/chatbot/createCredential.operation.js +44 -0
  92. package/dist/nodes/EvolutionApi/resources/chatbot/createCredential.operation.js.map +1 -0
  93. package/dist/nodes/EvolutionApi/resources/chatbot/delete.operation.d.ts +3 -0
  94. package/dist/nodes/EvolutionApi/resources/chatbot/delete.operation.js +19 -0
  95. package/dist/nodes/EvolutionApi/resources/chatbot/delete.operation.js.map +1 -0
  96. package/dist/nodes/EvolutionApi/resources/chatbot/deleteCredential.operation.d.ts +29 -0
  97. package/dist/nodes/EvolutionApi/resources/chatbot/deleteCredential.operation.js +30 -0
  98. package/dist/nodes/EvolutionApi/resources/chatbot/deleteCredential.operation.js.map +1 -0
  99. package/dist/nodes/EvolutionApi/resources/chatbot/fields.d.ts +10 -0
  100. package/dist/nodes/EvolutionApi/resources/chatbot/fields.js +229 -0
  101. package/dist/nodes/EvolutionApi/resources/chatbot/fields.js.map +1 -0
  102. package/dist/nodes/EvolutionApi/resources/chatbot/get.operation.d.ts +30 -0
  103. package/dist/nodes/EvolutionApi/resources/chatbot/get.operation.js +29 -0
  104. package/dist/nodes/EvolutionApi/resources/chatbot/get.operation.js.map +1 -0
  105. package/dist/nodes/EvolutionApi/resources/chatbot/getCredentials.operation.d.ts +29 -0
  106. package/dist/nodes/EvolutionApi/resources/chatbot/getCredentials.operation.js +17 -0
  107. package/dist/nodes/EvolutionApi/resources/chatbot/getCredentials.operation.js.map +1 -0
  108. package/dist/nodes/EvolutionApi/resources/chatbot/getMany.operation.d.ts +29 -0
  109. package/dist/nodes/EvolutionApi/resources/chatbot/getMany.operation.js +18 -0
  110. package/dist/nodes/EvolutionApi/resources/chatbot/getMany.operation.js.map +1 -0
  111. package/dist/nodes/EvolutionApi/resources/chatbot/getModels.operation.d.ts +29 -0
  112. package/dist/nodes/EvolutionApi/resources/chatbot/getModels.operation.js +39 -0
  113. package/dist/nodes/EvolutionApi/resources/chatbot/getModels.operation.js.map +1 -0
  114. package/dist/nodes/EvolutionApi/resources/chatbot/getSessions.operation.d.ts +29 -0
  115. package/dist/nodes/EvolutionApi/resources/chatbot/getSessions.operation.js +69 -0
  116. package/dist/nodes/EvolutionApi/resources/chatbot/getSessions.operation.js.map +1 -0
  117. package/dist/nodes/EvolutionApi/resources/chatbot/getSettings.operation.d.ts +29 -0
  118. package/dist/nodes/EvolutionApi/resources/chatbot/getSettings.operation.js +17 -0
  119. package/dist/nodes/EvolutionApi/resources/chatbot/getSettings.operation.js.map +1 -0
  120. package/dist/nodes/EvolutionApi/resources/chatbot/helpers.d.ts +24 -0
  121. package/dist/nodes/EvolutionApi/resources/chatbot/helpers.js +273 -0
  122. package/dist/nodes/EvolutionApi/resources/chatbot/helpers.js.map +1 -0
  123. package/dist/nodes/EvolutionApi/resources/chatbot/ignoreJid.operation.d.ts +29 -0
  124. package/dist/nodes/EvolutionApi/resources/chatbot/ignoreJid.operation.js +35 -0
  125. package/dist/nodes/EvolutionApi/resources/chatbot/ignoreJid.operation.js.map +1 -0
  126. package/dist/nodes/EvolutionApi/resources/chatbot/index.d.ts +6 -0
  127. package/dist/nodes/EvolutionApi/resources/chatbot/index.js +210 -0
  128. package/dist/nodes/EvolutionApi/resources/chatbot/index.js.map +1 -0
  129. package/dist/nodes/EvolutionApi/resources/chatbot/methods.d.ts +2 -0
  130. package/dist/nodes/EvolutionApi/resources/chatbot/methods.js +58 -0
  131. package/dist/nodes/EvolutionApi/resources/chatbot/methods.js.map +1 -0
  132. package/dist/nodes/EvolutionApi/resources/chatbot/setSettings.operation.d.ts +33 -0
  133. package/dist/nodes/EvolutionApi/resources/chatbot/setSettings.operation.js +133 -0
  134. package/dist/nodes/EvolutionApi/resources/chatbot/setSettings.operation.js.map +1 -0
  135. package/dist/nodes/EvolutionApi/resources/chatbot/start.operation.d.ts +29 -0
  136. package/dist/nodes/EvolutionApi/resources/chatbot/start.operation.js +112 -0
  137. package/dist/nodes/EvolutionApi/resources/chatbot/start.operation.js.map +1 -0
  138. package/dist/nodes/EvolutionApi/resources/chatbot/update.operation.d.ts +29 -0
  139. package/dist/nodes/EvolutionApi/resources/chatbot/update.operation.js +191 -0
  140. package/dist/nodes/EvolutionApi/resources/chatbot/update.operation.js.map +1 -0
  141. package/dist/nodes/EvolutionApi/resources/chatwoot/get.operation.d.ts +29 -0
  142. package/dist/nodes/EvolutionApi/resources/chatwoot/get.operation.js +25 -0
  143. package/dist/nodes/EvolutionApi/resources/chatwoot/get.operation.js.map +1 -0
  144. package/dist/nodes/EvolutionApi/resources/chatwoot/helpers.d.ts +4 -0
  145. package/dist/nodes/EvolutionApi/resources/chatwoot/helpers.js +26 -0
  146. package/dist/nodes/EvolutionApi/resources/chatwoot/helpers.js.map +1 -0
  147. package/dist/nodes/EvolutionApi/resources/chatwoot/index.d.ts +5 -0
  148. package/dist/nodes/EvolutionApi/resources/chatwoot/index.js +70 -0
  149. package/dist/nodes/EvolutionApi/resources/chatwoot/index.js.map +1 -0
  150. package/dist/nodes/EvolutionApi/resources/chatwoot/set.operation.d.ts +30 -0
  151. package/dist/nodes/EvolutionApi/resources/chatwoot/set.operation.js +252 -0
  152. package/dist/nodes/EvolutionApi/resources/chatwoot/set.operation.js.map +1 -0
  153. package/dist/nodes/EvolutionApi/resources/group/acceptInvite.operation.d.ts +29 -0
  154. package/dist/nodes/EvolutionApi/resources/group/acceptInvite.operation.js +25 -0
  155. package/dist/nodes/EvolutionApi/resources/group/acceptInvite.operation.js.map +1 -0
  156. package/dist/nodes/EvolutionApi/resources/group/create.operation.d.ts +29 -0
  157. package/dist/nodes/EvolutionApi/resources/group/create.operation.js +68 -0
  158. package/dist/nodes/EvolutionApi/resources/group/create.operation.js.map +1 -0
  159. package/dist/nodes/EvolutionApi/resources/group/get.operation.d.ts +29 -0
  160. package/dist/nodes/EvolutionApi/resources/group/get.operation.js +15 -0
  161. package/dist/nodes/EvolutionApi/resources/group/get.operation.js.map +1 -0
  162. package/dist/nodes/EvolutionApi/resources/group/getInviteCode.operation.d.ts +29 -0
  163. package/dist/nodes/EvolutionApi/resources/group/getInviteCode.operation.js +15 -0
  164. package/dist/nodes/EvolutionApi/resources/group/getInviteCode.operation.js.map +1 -0
  165. package/dist/nodes/EvolutionApi/resources/group/getInviteInfo.operation.d.ts +29 -0
  166. package/dist/nodes/EvolutionApi/resources/group/getInviteInfo.operation.js +25 -0
  167. package/dist/nodes/EvolutionApi/resources/group/getInviteInfo.operation.js.map +1 -0
  168. package/dist/nodes/EvolutionApi/resources/group/getMany.operation.d.ts +29 -0
  169. package/dist/nodes/EvolutionApi/resources/group/getMany.operation.js +72 -0
  170. package/dist/nodes/EvolutionApi/resources/group/getMany.operation.js.map +1 -0
  171. package/dist/nodes/EvolutionApi/resources/group/getParticipants.operation.d.ts +29 -0
  172. package/dist/nodes/EvolutionApi/resources/group/getParticipants.operation.js +21 -0
  173. package/dist/nodes/EvolutionApi/resources/group/getParticipants.operation.js.map +1 -0
  174. package/dist/nodes/EvolutionApi/resources/group/helpers.d.ts +8 -0
  175. package/dist/nodes/EvolutionApi/resources/group/helpers.js +139 -0
  176. package/dist/nodes/EvolutionApi/resources/group/helpers.js.map +1 -0
  177. package/dist/nodes/EvolutionApi/resources/group/index.d.ts +7 -0
  178. package/dist/nodes/EvolutionApi/resources/group/index.js +216 -0
  179. package/dist/nodes/EvolutionApi/resources/group/index.js.map +1 -0
  180. package/dist/nodes/EvolutionApi/resources/group/leave.operation.d.ts +29 -0
  181. package/dist/nodes/EvolutionApi/resources/group/leave.operation.js +15 -0
  182. package/dist/nodes/EvolutionApi/resources/group/leave.operation.js.map +1 -0
  183. package/dist/nodes/EvolutionApi/resources/group/revokeInviteCode.operation.d.ts +29 -0
  184. package/dist/nodes/EvolutionApi/resources/group/revokeInviteCode.operation.js +20 -0
  185. package/dist/nodes/EvolutionApi/resources/group/revokeInviteCode.operation.js.map +1 -0
  186. package/dist/nodes/EvolutionApi/resources/group/sendInvite.operation.d.ts +29 -0
  187. package/dist/nodes/EvolutionApi/resources/group/sendInvite.operation.js +48 -0
  188. package/dist/nodes/EvolutionApi/resources/group/sendInvite.operation.js.map +1 -0
  189. package/dist/nodes/EvolutionApi/resources/group/toggleEphemeral.operation.d.ts +29 -0
  190. package/dist/nodes/EvolutionApi/resources/group/toggleEphemeral.operation.js +43 -0
  191. package/dist/nodes/EvolutionApi/resources/group/toggleEphemeral.operation.js.map +1 -0
  192. package/dist/nodes/EvolutionApi/resources/group/updateDescription.operation.d.ts +29 -0
  193. package/dist/nodes/EvolutionApi/resources/group/updateDescription.operation.js +34 -0
  194. package/dist/nodes/EvolutionApi/resources/group/updateDescription.operation.js.map +1 -0
  195. package/dist/nodes/EvolutionApi/resources/group/updateMemberAddMode.operation.d.ts +29 -0
  196. package/dist/nodes/EvolutionApi/resources/group/updateMemberAddMode.operation.js +47 -0
  197. package/dist/nodes/EvolutionApi/resources/group/updateMemberAddMode.operation.js.map +1 -0
  198. package/dist/nodes/EvolutionApi/resources/group/updateParticipants.operation.d.ts +29 -0
  199. package/dist/nodes/EvolutionApi/resources/group/updateParticipants.operation.js +67 -0
  200. package/dist/nodes/EvolutionApi/resources/group/updateParticipants.operation.js.map +1 -0
  201. package/dist/nodes/EvolutionApi/resources/group/updatePicture.operation.d.ts +29 -0
  202. package/dist/nodes/EvolutionApi/resources/group/updatePicture.operation.js +99 -0
  203. package/dist/nodes/EvolutionApi/resources/group/updatePicture.operation.js.map +1 -0
  204. package/dist/nodes/EvolutionApi/resources/group/updateSetting.operation.d.ts +29 -0
  205. package/dist/nodes/EvolutionApi/resources/group/updateSetting.operation.js +57 -0
  206. package/dist/nodes/EvolutionApi/resources/group/updateSetting.operation.js.map +1 -0
  207. package/dist/nodes/EvolutionApi/resources/group/updateSubject.operation.d.ts +29 -0
  208. package/dist/nodes/EvolutionApi/resources/group/updateSubject.operation.js +31 -0
  209. package/dist/nodes/EvolutionApi/resources/group/updateSubject.operation.js.map +1 -0
  210. package/dist/nodes/EvolutionApi/resources/index.d.ts +6 -0
  211. package/dist/nodes/EvolutionApi/resources/index.js +144 -0
  212. package/dist/nodes/EvolutionApi/resources/index.js.map +1 -0
  213. package/dist/nodes/EvolutionApi/resources/instance/connect.operation.d.ts +29 -0
  214. package/dist/nodes/EvolutionApi/resources/instance/connect.operation.js +40 -0
  215. package/dist/nodes/EvolutionApi/resources/instance/connect.operation.js.map +1 -0
  216. package/dist/nodes/EvolutionApi/resources/instance/create.operation.d.ts +30 -0
  217. package/dist/nodes/EvolutionApi/resources/instance/create.operation.js +519 -0
  218. package/dist/nodes/EvolutionApi/resources/instance/create.operation.js.map +1 -0
  219. package/dist/nodes/EvolutionApi/resources/instance/delete.operation.d.ts +3 -0
  220. package/dist/nodes/EvolutionApi/resources/instance/delete.operation.js +11 -0
  221. package/dist/nodes/EvolutionApi/resources/instance/delete.operation.js.map +1 -0
  222. package/dist/nodes/EvolutionApi/resources/instance/getConnectionState.operation.d.ts +3 -0
  223. package/dist/nodes/EvolutionApi/resources/instance/getConnectionState.operation.js +11 -0
  224. package/dist/nodes/EvolutionApi/resources/instance/getConnectionState.operation.js.map +1 -0
  225. package/dist/nodes/EvolutionApi/resources/instance/getMany.operation.d.ts +31 -0
  226. package/dist/nodes/EvolutionApi/resources/instance/getMany.operation.js +149 -0
  227. package/dist/nodes/EvolutionApi/resources/instance/getMany.operation.js.map +1 -0
  228. package/dist/nodes/EvolutionApi/resources/instance/helpers.d.ts +5 -0
  229. package/dist/nodes/EvolutionApi/resources/instance/helpers.js +60 -0
  230. package/dist/nodes/EvolutionApi/resources/instance/helpers.js.map +1 -0
  231. package/dist/nodes/EvolutionApi/resources/instance/index.d.ts +6 -0
  232. package/dist/nodes/EvolutionApi/resources/instance/index.js +128 -0
  233. package/dist/nodes/EvolutionApi/resources/instance/index.js.map +1 -0
  234. package/dist/nodes/EvolutionApi/resources/instance/logout.operation.d.ts +3 -0
  235. package/dist/nodes/EvolutionApi/resources/instance/logout.operation.js +11 -0
  236. package/dist/nodes/EvolutionApi/resources/instance/logout.operation.js.map +1 -0
  237. package/dist/nodes/EvolutionApi/resources/instance/restart.operation.d.ts +3 -0
  238. package/dist/nodes/EvolutionApi/resources/instance/restart.operation.js +13 -0
  239. package/dist/nodes/EvolutionApi/resources/instance/restart.operation.js.map +1 -0
  240. package/dist/nodes/EvolutionApi/resources/instance/setPresence.operation.d.ts +29 -0
  241. package/dist/nodes/EvolutionApi/resources/instance/setPresence.operation.js +24 -0
  242. package/dist/nodes/EvolutionApi/resources/instance/setPresence.operation.js.map +1 -0
  243. package/dist/nodes/EvolutionApi/resources/label/addToChat.operation.d.ts +29 -0
  244. package/dist/nodes/EvolutionApi/resources/label/addToChat.operation.js +11 -0
  245. package/dist/nodes/EvolutionApi/resources/label/addToChat.operation.js.map +1 -0
  246. package/dist/nodes/EvolutionApi/resources/label/getMany.operation.d.ts +3 -0
  247. package/dist/nodes/EvolutionApi/resources/label/getMany.operation.js +12 -0
  248. package/dist/nodes/EvolutionApi/resources/label/getMany.operation.js.map +1 -0
  249. package/dist/nodes/EvolutionApi/resources/label/helpers.d.ts +4 -0
  250. package/dist/nodes/EvolutionApi/resources/label/helpers.js +69 -0
  251. package/dist/nodes/EvolutionApi/resources/label/helpers.js.map +1 -0
  252. package/dist/nodes/EvolutionApi/resources/label/index.d.ts +6 -0
  253. package/dist/nodes/EvolutionApi/resources/label/index.js +88 -0
  254. package/dist/nodes/EvolutionApi/resources/label/index.js.map +1 -0
  255. package/dist/nodes/EvolutionApi/resources/label/removeFromChat.operation.d.ts +29 -0
  256. package/dist/nodes/EvolutionApi/resources/label/removeFromChat.operation.js +11 -0
  257. package/dist/nodes/EvolutionApi/resources/label/removeFromChat.operation.js.map +1 -0
  258. package/dist/nodes/EvolutionApi/resources/message/generateMessageId.operation.d.ts +29 -0
  259. package/dist/nodes/EvolutionApi/resources/message/generateMessageId.operation.js +21 -0
  260. package/dist/nodes/EvolutionApi/resources/message/generateMessageId.operation.js.map +1 -0
  261. package/dist/nodes/EvolutionApi/resources/message/helpers.d.ts +39 -0
  262. package/dist/nodes/EvolutionApi/resources/message/helpers.js +566 -0
  263. package/dist/nodes/EvolutionApi/resources/message/helpers.js.map +1 -0
  264. package/dist/nodes/EvolutionApi/resources/message/index.d.ts +6 -0
  265. package/dist/nodes/EvolutionApi/resources/message/index.js +192 -0
  266. package/dist/nodes/EvolutionApi/resources/message/index.js.map +1 -0
  267. package/dist/nodes/EvolutionApi/resources/message/sendAudio.operation.d.ts +29 -0
  268. package/dist/nodes/EvolutionApi/resources/message/sendAudio.operation.js +36 -0
  269. package/dist/nodes/EvolutionApi/resources/message/sendAudio.operation.js.map +1 -0
  270. package/dist/nodes/EvolutionApi/resources/message/sendButtons.operation.d.ts +29 -0
  271. package/dist/nodes/EvolutionApi/resources/message/sendButtons.operation.js +114 -0
  272. package/dist/nodes/EvolutionApi/resources/message/sendButtons.operation.js.map +1 -0
  273. package/dist/nodes/EvolutionApi/resources/message/sendCarousel.operation.d.ts +30 -0
  274. package/dist/nodes/EvolutionApi/resources/message/sendCarousel.operation.js +162 -0
  275. package/dist/nodes/EvolutionApi/resources/message/sendCarousel.operation.js.map +1 -0
  276. package/dist/nodes/EvolutionApi/resources/message/sendContact.operation.d.ts +29 -0
  277. package/dist/nodes/EvolutionApi/resources/message/sendContact.operation.js +105 -0
  278. package/dist/nodes/EvolutionApi/resources/message/sendContact.operation.js.map +1 -0
  279. package/dist/nodes/EvolutionApi/resources/message/sendList.operation.d.ts +30 -0
  280. package/dist/nodes/EvolutionApi/resources/message/sendList.operation.js +197 -0
  281. package/dist/nodes/EvolutionApi/resources/message/sendList.operation.js.map +1 -0
  282. package/dist/nodes/EvolutionApi/resources/message/sendLocation.operation.d.ts +29 -0
  283. package/dist/nodes/EvolutionApi/resources/message/sendLocation.operation.js +70 -0
  284. package/dist/nodes/EvolutionApi/resources/message/sendLocation.operation.js.map +1 -0
  285. package/dist/nodes/EvolutionApi/resources/message/sendMedia.operation.d.ts +29 -0
  286. package/dist/nodes/EvolutionApi/resources/message/sendMedia.operation.js +142 -0
  287. package/dist/nodes/EvolutionApi/resources/message/sendMedia.operation.js.map +1 -0
  288. package/dist/nodes/EvolutionApi/resources/message/sendPoll.operation.d.ts +29 -0
  289. package/dist/nodes/EvolutionApi/resources/message/sendPoll.operation.js +67 -0
  290. package/dist/nodes/EvolutionApi/resources/message/sendPoll.operation.js.map +1 -0
  291. package/dist/nodes/EvolutionApi/resources/message/sendPtv.operation.d.ts +29 -0
  292. package/dist/nodes/EvolutionApi/resources/message/sendPtv.operation.js +22 -0
  293. package/dist/nodes/EvolutionApi/resources/message/sendPtv.operation.js.map +1 -0
  294. package/dist/nodes/EvolutionApi/resources/message/sendReaction.operation.d.ts +29 -0
  295. package/dist/nodes/EvolutionApi/resources/message/sendReaction.operation.js +81 -0
  296. package/dist/nodes/EvolutionApi/resources/message/sendReaction.operation.js.map +1 -0
  297. package/dist/nodes/EvolutionApi/resources/message/sendStatus.operation.d.ts +29 -0
  298. package/dist/nodes/EvolutionApi/resources/message/sendStatus.operation.js +147 -0
  299. package/dist/nodes/EvolutionApi/resources/message/sendStatus.operation.js.map +1 -0
  300. package/dist/nodes/EvolutionApi/resources/message/sendSticker.operation.d.ts +29 -0
  301. package/dist/nodes/EvolutionApi/resources/message/sendSticker.operation.js +41 -0
  302. package/dist/nodes/EvolutionApi/resources/message/sendSticker.operation.js.map +1 -0
  303. package/dist/nodes/EvolutionApi/resources/message/sendTemplate.operation.d.ts +29 -0
  304. package/dist/nodes/EvolutionApi/resources/message/sendTemplate.operation.js +92 -0
  305. package/dist/nodes/EvolutionApi/resources/message/sendTemplate.operation.js.map +1 -0
  306. package/dist/nodes/EvolutionApi/resources/message/sendText.operation.d.ts +29 -0
  307. package/dist/nodes/EvolutionApi/resources/message/sendText.operation.js +38 -0
  308. package/dist/nodes/EvolutionApi/resources/message/sendText.operation.js.map +1 -0
  309. package/dist/nodes/EvolutionApi/resources/profile/get.operation.d.ts +29 -0
  310. package/dist/nodes/EvolutionApi/resources/profile/get.operation.js +27 -0
  311. package/dist/nodes/EvolutionApi/resources/profile/get.operation.js.map +1 -0
  312. package/dist/nodes/EvolutionApi/resources/profile/getBusinessProfile.operation.d.ts +29 -0
  313. package/dist/nodes/EvolutionApi/resources/profile/getBusinessProfile.operation.js +24 -0
  314. package/dist/nodes/EvolutionApi/resources/profile/getBusinessProfile.operation.js.map +1 -0
  315. package/dist/nodes/EvolutionApi/resources/profile/getPicture.operation.d.ts +29 -0
  316. package/dist/nodes/EvolutionApi/resources/profile/getPicture.operation.js +27 -0
  317. package/dist/nodes/EvolutionApi/resources/profile/getPicture.operation.js.map +1 -0
  318. package/dist/nodes/EvolutionApi/resources/profile/getPrivacySettings.operation.d.ts +3 -0
  319. package/dist/nodes/EvolutionApi/resources/profile/getPrivacySettings.operation.js +11 -0
  320. package/dist/nodes/EvolutionApi/resources/profile/getPrivacySettings.operation.js.map +1 -0
  321. package/dist/nodes/EvolutionApi/resources/profile/index.d.ts +5 -0
  322. package/dist/nodes/EvolutionApi/resources/profile/index.js +136 -0
  323. package/dist/nodes/EvolutionApi/resources/profile/index.js.map +1 -0
  324. package/dist/nodes/EvolutionApi/resources/profile/removePicture.operation.d.ts +3 -0
  325. package/dist/nodes/EvolutionApi/resources/profile/removePicture.operation.js +11 -0
  326. package/dist/nodes/EvolutionApi/resources/profile/removePicture.operation.js.map +1 -0
  327. package/dist/nodes/EvolutionApi/resources/profile/updateName.operation.d.ts +29 -0
  328. package/dist/nodes/EvolutionApi/resources/profile/updateName.operation.js +27 -0
  329. package/dist/nodes/EvolutionApi/resources/profile/updateName.operation.js.map +1 -0
  330. package/dist/nodes/EvolutionApi/resources/profile/updatePicture.operation.d.ts +29 -0
  331. package/dist/nodes/EvolutionApi/resources/profile/updatePicture.operation.js +86 -0
  332. package/dist/nodes/EvolutionApi/resources/profile/updatePicture.operation.js.map +1 -0
  333. package/dist/nodes/EvolutionApi/resources/profile/updatePrivacySettings.operation.d.ts +30 -0
  334. package/dist/nodes/EvolutionApi/resources/profile/updatePrivacySettings.operation.js +133 -0
  335. package/dist/nodes/EvolutionApi/resources/profile/updatePrivacySettings.operation.js.map +1 -0
  336. package/dist/nodes/EvolutionApi/resources/profile/updateStatus.operation.d.ts +29 -0
  337. package/dist/nodes/EvolutionApi/resources/profile/updateStatus.operation.js +28 -0
  338. package/dist/nodes/EvolutionApi/resources/profile/updateStatus.operation.js.map +1 -0
  339. package/dist/nodes/EvolutionApi/resources/proxy/get.operation.d.ts +29 -0
  340. package/dist/nodes/EvolutionApi/resources/proxy/get.operation.js +25 -0
  341. package/dist/nodes/EvolutionApi/resources/proxy/get.operation.js.map +1 -0
  342. package/dist/nodes/EvolutionApi/resources/proxy/helpers.d.ts +3 -0
  343. package/dist/nodes/EvolutionApi/resources/proxy/helpers.js +28 -0
  344. package/dist/nodes/EvolutionApi/resources/proxy/helpers.js.map +1 -0
  345. package/dist/nodes/EvolutionApi/resources/proxy/index.d.ts +5 -0
  346. package/dist/nodes/EvolutionApi/resources/proxy/index.js +70 -0
  347. package/dist/nodes/EvolutionApi/resources/proxy/index.js.map +1 -0
  348. package/dist/nodes/EvolutionApi/resources/proxy/set.operation.d.ts +30 -0
  349. package/dist/nodes/EvolutionApi/resources/proxy/set.operation.js +137 -0
  350. package/dist/nodes/EvolutionApi/resources/proxy/set.operation.js.map +1 -0
  351. package/dist/nodes/EvolutionApi/resources/settings/get.operation.d.ts +29 -0
  352. package/dist/nodes/EvolutionApi/resources/settings/get.operation.js +25 -0
  353. package/dist/nodes/EvolutionApi/resources/settings/get.operation.js.map +1 -0
  354. package/dist/nodes/EvolutionApi/resources/settings/helpers.d.ts +5 -0
  355. package/dist/nodes/EvolutionApi/resources/settings/helpers.js +37 -0
  356. package/dist/nodes/EvolutionApi/resources/settings/helpers.js.map +1 -0
  357. package/dist/nodes/EvolutionApi/resources/settings/index.d.ts +5 -0
  358. package/dist/nodes/EvolutionApi/resources/settings/index.js +70 -0
  359. package/dist/nodes/EvolutionApi/resources/settings/index.js.map +1 -0
  360. package/dist/nodes/EvolutionApi/resources/settings/set.operation.d.ts +30 -0
  361. package/dist/nodes/EvolutionApi/resources/settings/set.operation.js +128 -0
  362. package/dist/nodes/EvolutionApi/resources/settings/set.operation.js.map +1 -0
  363. package/dist/nodes/EvolutionApi/resources/template/create.operation.d.ts +29 -0
  364. package/dist/nodes/EvolutionApi/resources/template/create.operation.js +97 -0
  365. package/dist/nodes/EvolutionApi/resources/template/create.operation.js.map +1 -0
  366. package/dist/nodes/EvolutionApi/resources/template/delete.operation.d.ts +29 -0
  367. package/dist/nodes/EvolutionApi/resources/template/delete.operation.js +50 -0
  368. package/dist/nodes/EvolutionApi/resources/template/delete.operation.js.map +1 -0
  369. package/dist/nodes/EvolutionApi/resources/template/getCatalog.operation.d.ts +30 -0
  370. package/dist/nodes/EvolutionApi/resources/template/getCatalog.operation.js +48 -0
  371. package/dist/nodes/EvolutionApi/resources/template/getCatalog.operation.js.map +1 -0
  372. package/dist/nodes/EvolutionApi/resources/template/getCollections.operation.d.ts +29 -0
  373. package/dist/nodes/EvolutionApi/resources/template/getCollections.operation.js +41 -0
  374. package/dist/nodes/EvolutionApi/resources/template/getCollections.operation.js.map +1 -0
  375. package/dist/nodes/EvolutionApi/resources/template/getMany.operation.d.ts +29 -0
  376. package/dist/nodes/EvolutionApi/resources/template/getMany.operation.js +109 -0
  377. package/dist/nodes/EvolutionApi/resources/template/getMany.operation.js.map +1 -0
  378. package/dist/nodes/EvolutionApi/resources/template/helpers.d.ts +3 -0
  379. package/dist/nodes/EvolutionApi/resources/template/helpers.js +32 -0
  380. package/dist/nodes/EvolutionApi/resources/template/helpers.js.map +1 -0
  381. package/dist/nodes/EvolutionApi/resources/template/index.d.ts +5 -0
  382. package/dist/nodes/EvolutionApi/resources/template/index.js +109 -0
  383. package/dist/nodes/EvolutionApi/resources/template/index.js.map +1 -0
  384. package/dist/nodes/EvolutionApi/resources/template/update.operation.d.ts +29 -0
  385. package/dist/nodes/EvolutionApi/resources/template/update.operation.js +89 -0
  386. package/dist/nodes/EvolutionApi/resources/template/update.operation.js.map +1 -0
  387. package/dist/nodes/EvolutionApi/resources/webhook/get.operation.d.ts +29 -0
  388. package/dist/nodes/EvolutionApi/resources/webhook/get.operation.js +25 -0
  389. package/dist/nodes/EvolutionApi/resources/webhook/get.operation.js.map +1 -0
  390. package/dist/nodes/EvolutionApi/resources/webhook/getTransport.operation.d.ts +30 -0
  391. package/dist/nodes/EvolutionApi/resources/webhook/getTransport.operation.js +49 -0
  392. package/dist/nodes/EvolutionApi/resources/webhook/getTransport.operation.js.map +1 -0
  393. package/dist/nodes/EvolutionApi/resources/webhook/helpers.d.ts +17 -0
  394. package/dist/nodes/EvolutionApi/resources/webhook/helpers.js +144 -0
  395. package/dist/nodes/EvolutionApi/resources/webhook/helpers.js.map +1 -0
  396. package/dist/nodes/EvolutionApi/resources/webhook/index.d.ts +5 -0
  397. package/dist/nodes/EvolutionApi/resources/webhook/index.js +91 -0
  398. package/dist/nodes/EvolutionApi/resources/webhook/index.js.map +1 -0
  399. package/dist/nodes/EvolutionApi/resources/webhook/set.operation.d.ts +29 -0
  400. package/dist/nodes/EvolutionApi/resources/webhook/set.operation.js +174 -0
  401. package/dist/nodes/EvolutionApi/resources/webhook/set.operation.js.map +1 -0
  402. package/dist/nodes/EvolutionApi/resources/webhook/setTransport.operation.d.ts +29 -0
  403. package/dist/nodes/EvolutionApi/resources/webhook/setTransport.operation.js +159 -0
  404. package/dist/nodes/EvolutionApi/resources/webhook/setTransport.operation.js.map +1 -0
  405. package/dist/nodes/EvolutionApi/trigger/auth.d.ts +26 -0
  406. package/dist/nodes/EvolutionApi/trigger/auth.js +96 -0
  407. package/dist/nodes/EvolutionApi/trigger/auth.js.map +1 -0
  408. package/dist/nodes/EvolutionApi/trigger/constants.d.ts +10 -0
  409. package/dist/nodes/EvolutionApi/trigger/constants.js +154 -0
  410. package/dist/nodes/EvolutionApi/trigger/constants.js.map +1 -0
  411. package/dist/nodes/EvolutionApi/trigger/dedupe.d.ts +5 -0
  412. package/dist/nodes/EvolutionApi/trigger/dedupe.js +87 -0
  413. package/dist/nodes/EvolutionApi/trigger/dedupe.js.map +1 -0
  414. package/dist/nodes/EvolutionApi/trigger/payload.d.ts +48 -0
  415. package/dist/nodes/EvolutionApi/trigger/payload.js +265 -0
  416. package/dist/nodes/EvolutionApi/trigger/payload.js.map +1 -0
  417. package/dist/nodes/EvolutionApi/trigger/registration.d.ts +36 -0
  418. package/dist/nodes/EvolutionApi/trigger/registration.js +156 -0
  419. package/dist/nodes/EvolutionApi/trigger/registration.js.map +1 -0
  420. package/dist/nodes/EvolutionApi/types.d.ts +44 -0
  421. package/dist/nodes/EvolutionApi/types.js +3 -0
  422. package/dist/nodes/EvolutionApi/types.js.map +1 -0
  423. package/package.json +83 -0
@@ -0,0 +1,615 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EvolutionApiTrigger = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const constants_1 = require("./constants");
6
+ const GenericFunctions_1 = require("./GenericFunctions");
7
+ const auth_1 = require("./trigger/auth");
8
+ const constants_2 = require("./trigger/constants");
9
+ const dedupe_1 = require("./trigger/dedupe");
10
+ const payload_1 = require("./trigger/payload");
11
+ const registration_1 = require("./trigger/registration");
12
+ const MANUAL_AUTH_METHODS = ['none', 'jwt', 'jwtAndHeader', 'header'];
13
+ function getTriggerMode(context) {
14
+ return context.getNodeParameter('mode', 'automatic') === 'manual' ? 'manual' : 'automatic';
15
+ }
16
+ function getAutomaticAuth(context) {
17
+ const value = context.getNodeParameter('autoAuth', 'jwtAndHeader');
18
+ return value === 'jwt' || value === 'header' ? value : 'jwtAndHeader';
19
+ }
20
+ function getSelectedEvents(context) {
21
+ const events = context.getNodeParameter('events', []);
22
+ return Array.isArray(events) ? events.map(String) : [];
23
+ }
24
+ function getWebhookUrl(context) {
25
+ const url = context.getNodeWebhookUrl('default');
26
+ if (!url) {
27
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'The webhook URL of this node is not available');
28
+ }
29
+ return url;
30
+ }
31
+ async function getInstanceName(context) {
32
+ return await GenericFunctions_1.resolveInstanceNameFromValue.call(context, context.getNodeParameter('instanceName', '', { extractValue: true }), { encode: false });
33
+ }
34
+ function getManualVerification(context) {
35
+ const method = context.getNodeParameter('manualAuth', 'jwt');
36
+ if (!MANUAL_AUTH_METHODS.includes(method)) {
37
+ return { error: `Unknown authentication method "${String(method)}"` };
38
+ }
39
+ const config = {};
40
+ if (method === 'header' || method === 'jwtAndHeader') {
41
+ const name = String(context.getNodeParameter('headerName', constants_2.SECRET_HEADER_NAME)).trim();
42
+ const value = String(context.getNodeParameter('headerValue', ''));
43
+ if (!value)
44
+ return { error: 'Set "Header Value" (the secret header Evolution sends)' };
45
+ config.secretHeader = { name: name || constants_2.SECRET_HEADER_NAME, value };
46
+ }
47
+ if (method === 'jwt' || method === 'jwtAndHeader') {
48
+ const secret = String(context.getNodeParameter('jwtSecret', ''));
49
+ if (!secret)
50
+ return { error: 'Set "JWT Secret" (the jwt_key of the Evolution webhook)' };
51
+ config.jwtSecret = secret;
52
+ }
53
+ return { config };
54
+ }
55
+ function getServedWebhookUrl(context) {
56
+ var _a, _b;
57
+ return (_b = (_a = context).getWebhookResourceUrl) === null || _b === void 0 ? void 0 : _b.call(_a, 'default');
58
+ }
59
+ function getRequestRegistrations(context, staticData, productionUrl) {
60
+ const registrations = (0, registration_1.getRegistrations)(staticData);
61
+ const servedUrl = getServedWebhookUrl(context);
62
+ if (servedUrl || context.getMode() !== 'manual') {
63
+ const registration = registrations[servedUrl || productionUrl];
64
+ return registration ? [registration] : [];
65
+ }
66
+ return Object.entries(registrations)
67
+ .filter(([url]) => url !== productionUrl)
68
+ .map(([, registration]) => registration);
69
+ }
70
+ function respond(context, status, message) {
71
+ context.getResponseObject().status(status).json({ message });
72
+ return { noWebhookResponse: true };
73
+ }
74
+ class EvolutionApiTrigger {
75
+ constructor() {
76
+ this.description = {
77
+ displayName: 'Evolution API Trigger',
78
+ name: 'evolutionApiTrigger',
79
+ icon: { light: 'file:evolution.svg', dark: 'file:evolution.svg' },
80
+ group: ['trigger'],
81
+ version: 1,
82
+ subtitle: '={{($parameter["events"] || []).length ? $parameter["events"].join(", ") : "All events"}}',
83
+ description: 'Starts the workflow when Evolution API (WhatsApp) sends a webhook event',
84
+ defaults: {
85
+ name: 'Evolution API Trigger',
86
+ },
87
+ eventTriggerDescription: 'Waiting for Evolution API to send an event',
88
+ activationMessage: 'Evolution API webhook events will now start this workflow.',
89
+ inputs: [],
90
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
91
+ credentials: [
92
+ {
93
+ name: GenericFunctions_1.CREDENTIAL_TYPE,
94
+ required: true,
95
+ displayOptions: { show: { mode: ['automatic'] } },
96
+ },
97
+ ],
98
+ webhooks: [
99
+ {
100
+ name: 'default',
101
+ httpMethod: 'POST',
102
+ responseMode: 'onReceived',
103
+ path: 'webhook',
104
+ },
105
+ ],
106
+ properties: [
107
+ {
108
+ displayName: 'Mode',
109
+ name: 'mode',
110
+ type: 'options',
111
+ noDataExpression: true,
112
+ options: [
113
+ {
114
+ name: 'Automatic (Instance Webhook)',
115
+ value: 'automatic',
116
+ description: 'On activation n8n registers this URL as the instance webhook (authenticated with a random secret) and restores the previous webhook on deactivation',
117
+ },
118
+ {
119
+ name: 'Manual / Global Webhook',
120
+ value: 'manual',
121
+ description: 'You configure the webhook in Evolution API yourself (instance webhook or WEBHOOK_GLOBAL_URL); n8n only receives and verifies the events',
122
+ },
123
+ ],
124
+ default: 'automatic',
125
+ },
126
+ {
127
+ displayName: "Evolution API keeps only ONE webhook per instance. While this workflow is active (or listening for a test event), this trigger takes over the instance webhook: it saves the current configuration and replaces it with this node's URL, protected by a random JWT secret and/or secret header. The saved configuration is restored when the workflow is deactivated. Do not use the same instance in two automatic triggers or with other webhook consumers at the same time.",
128
+ name: 'automaticNotice',
129
+ type: 'notice',
130
+ default: '',
131
+ displayOptions: { show: { mode: ['automatic'] } },
132
+ },
133
+ {
134
+ displayName: 'Configure Evolution API yourself with the webhook URL above and "Webhook by Events" off: either as the instance webhook (Webhook > Set; add a secret header or a jwt_key in its headers) or as WEBHOOK_GLOBAL_URL. The global webhook cannot send headers or a JWT, so it cannot be authenticated: use Authentication "None" and restrict access to the URL at network level.',
135
+ name: 'manualNotice',
136
+ type: 'notice',
137
+ default: '',
138
+ displayOptions: { show: { mode: ['manual'] } },
139
+ },
140
+ {
141
+ displayName: 'Instance Name',
142
+ name: 'instanceName',
143
+ type: 'resourceLocator',
144
+ default: { mode: 'list', value: '' },
145
+ description: 'Instance whose webhook this trigger takes over. Leave empty to use the "Default Instance Name" of the credential.',
146
+ displayOptions: { show: { mode: ['automatic'] } },
147
+ modes: [
148
+ {
149
+ displayName: 'From List',
150
+ name: 'list',
151
+ type: 'list',
152
+ placeholder: 'Select an instance...',
153
+ typeOptions: {
154
+ searchListMethod: 'searchInstances',
155
+ searchable: true,
156
+ },
157
+ },
158
+ {
159
+ displayName: 'By Name',
160
+ name: 'name',
161
+ type: 'string',
162
+ placeholder: 'e.g. my-instance',
163
+ },
164
+ ],
165
+ },
166
+ {
167
+ displayName: 'Events',
168
+ name: 'events',
169
+ type: 'multiOptions',
170
+ options: constants_2.TRIGGER_EVENT_OPTIONS,
171
+ default: ['MESSAGES_UPSERT'],
172
+ description: `Events that start the workflow; leave empty for every event. In Automatic mode only these events are registered in Evolution. Messaging History Set: ${constants_1.REQUIRES_24}`,
173
+ },
174
+ {
175
+ displayName: 'Authentication',
176
+ name: 'autoAuth',
177
+ type: 'options',
178
+ noDataExpression: true,
179
+ options: [
180
+ {
181
+ name: 'JWT Only',
182
+ value: 'jwt',
183
+ description: 'Evolution signs every delivery with an HS256 JWT (jwt_key); the secret itself never travels with the request',
184
+ },
185
+ {
186
+ name: 'JWT and Secret Header',
187
+ value: 'jwtAndHeader',
188
+ description: 'Evolution signs every delivery with an HS256 JWT (jwt_key) and also sends a random secret header; both are verified',
189
+ },
190
+ {
191
+ name: 'Secret Header Only',
192
+ value: 'header',
193
+ description: `Evolution sends a random secret in the "${constants_2.SECRET_HEADER_NAME}" header; does not depend on the server clocks`,
194
+ },
195
+ ],
196
+ default: 'jwtAndHeader',
197
+ description: 'How Evolution proves that a delivery comes from it. The secrets are generated on activation and stored in the workflow static data. Unauthenticated requests get 401. Missing registration state gets 503 so Evolution can retry while activation completes.',
198
+ displayOptions: { show: { mode: ['automatic'] } },
199
+ },
200
+ {
201
+ displayName: 'Authentication',
202
+ name: 'manualAuth',
203
+ type: 'options',
204
+ noDataExpression: true,
205
+ options: [
206
+ {
207
+ name: 'JWT Only',
208
+ value: 'jwt',
209
+ description: 'Verify the "Authorization: Bearer" HS256 JWT that Evolution sends when the instance webhook headers contain jwt_key',
210
+ },
211
+ {
212
+ name: 'JWT and Secret Header',
213
+ value: 'jwtAndHeader',
214
+ description: 'Require both the secret header and a valid JWT',
215
+ },
216
+ {
217
+ name: 'None',
218
+ value: 'none',
219
+ description: 'Accept every request: the webhook URL is the only protection. Required for the global webhook, which cannot send headers.',
220
+ },
221
+ {
222
+ name: 'Secret Header Only',
223
+ value: 'header',
224
+ description: 'Require a static header configured in the instance webhook headers',
225
+ },
226
+ ],
227
+ default: 'jwt',
228
+ description: 'How to verify deliveries. Requests that fail verification get 401 (Evolution does not retry 401).',
229
+ displayOptions: { show: { mode: ['manual'] } },
230
+ },
231
+ {
232
+ displayName: 'Header Name',
233
+ name: 'headerName',
234
+ type: 'string',
235
+ default: constants_2.SECRET_HEADER_NAME,
236
+ description: 'Name of the secret header, as configured in the Evolution webhook headers',
237
+ displayOptions: { show: { mode: ['manual'], manualAuth: ['header', 'jwtAndHeader'] } },
238
+ },
239
+ {
240
+ displayName: 'Header Value',
241
+ name: 'headerValue',
242
+ type: 'string',
243
+ typeOptions: { password: true },
244
+ default: '',
245
+ required: true,
246
+ description: 'Expected value of the secret header (compared in constant time)',
247
+ displayOptions: { show: { mode: ['manual'], manualAuth: ['header', 'jwtAndHeader'] } },
248
+ },
249
+ {
250
+ displayName: 'JWT Secret',
251
+ name: 'jwtSecret',
252
+ type: 'string',
253
+ typeOptions: { password: true },
254
+ default: '',
255
+ required: true,
256
+ description: 'The jwt_key set in the headers of the Evolution instance webhook (HS256 secret)',
257
+ displayOptions: { show: { mode: ['manual'], manualAuth: ['jwt', 'jwtAndHeader'] } },
258
+ },
259
+ {
260
+ displayName: 'Options',
261
+ name: 'options',
262
+ type: 'collection',
263
+ placeholder: 'Add Option',
264
+ default: {},
265
+ options: [
266
+ {
267
+ displayName: 'Binary Property',
268
+ name: 'binaryPropertyName',
269
+ type: 'string',
270
+ default: 'data',
271
+ description: 'Binary property that receives the media when "Output Media as Binary" is on',
272
+ },
273
+ {
274
+ displayName: 'Deduplicate Retried Deliveries',
275
+ name: 'deduplicate',
276
+ type: 'boolean',
277
+ default: true,
278
+ description: 'Whether to ignore an event already received in the last 30 minutes. Evolution retries a delivery up to 10 times when n8n does not answer in time, and the instance and global webhooks both deliver the same event.',
279
+ },
280
+ {
281
+ displayName: 'Ignore Groups',
282
+ name: 'ignoreGroups',
283
+ type: 'boolean',
284
+ default: false,
285
+ description: 'Whether to ignore events of group chats (remoteJid ending in @g.us). Group-only events such as Group Participants Update are controlled by Events.',
286
+ },
287
+ {
288
+ displayName: 'Ignore Messages From Me',
289
+ name: 'ignoreFromMe',
290
+ type: 'boolean',
291
+ default: false,
292
+ description: 'Whether to ignore events of messages sent by the connected number itself (fromMe = true), including Send Message. Useful to avoid reply loops in bots.',
293
+ },
294
+ {
295
+ displayName: 'Ignore Newsletters',
296
+ name: 'ignoreNewsletters',
297
+ type: 'boolean',
298
+ default: false,
299
+ description: 'Whether to ignore events of WhatsApp channels (remoteJid ending in @newsletter)',
300
+ },
301
+ {
302
+ displayName: 'Ignore Status and Broadcasts',
303
+ name: 'ignoreBroadcasts',
304
+ type: 'boolean',
305
+ default: false,
306
+ description: 'Whether to ignore status updates (status@broadcast) and broadcast lists (remoteJid ending in @broadcast)',
307
+ },
308
+ {
309
+ displayName: 'Include Media as Base64',
310
+ name: 'webhookBase64',
311
+ type: 'boolean',
312
+ default: false,
313
+ description: 'Whether Evolution embeds the downloaded media in media messages (data.message.base64). Automatic mode registers the webhook with "Webhook Base64" on; in Manual mode enable it in Evolution yourself. Evolution only reads this setting when the instance connects, so restart the instance (Instance > Restart) after activating the workflow. Large files can exceed the n8n payload limit (N8N_PAYLOAD_SIZE_MAX).',
314
+ },
315
+ {
316
+ displayName: 'JWT Expiry Leeway (Seconds)',
317
+ name: 'jwtLeeway',
318
+ type: 'number',
319
+ typeOptions: { minValue: 0 },
320
+ default: constants_2.DEFAULT_JWT_LEEWAY_SECONDS,
321
+ description: 'Seconds a JWT is still accepted after its expiry. Evolution signs each event once (valid 600 s) and reuses the token for retries that can arrive about 20 minutes later; the signature is always verified.',
322
+ },
323
+ {
324
+ displayName: 'Keep API Key Field',
325
+ name: 'keepApiKey',
326
+ type: 'boolean',
327
+ default: false,
328
+ description: 'Whether to keep the "apikey" field of the payload. Evolution puts the instance token there when AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true; it is removed by default so it is not stored in the executions.',
329
+ },
330
+ {
331
+ displayName: 'Message Types',
332
+ name: 'messageTypes',
333
+ type: 'multiOptions',
334
+ options: constants_2.MESSAGE_TYPE_OPTIONS,
335
+ default: [],
336
+ description: 'Only start the workflow for these message types (data.messageType). Events without a message type are not affected. Leave empty for every type.',
337
+ },
338
+ {
339
+ displayName: 'Only Instances',
340
+ name: 'instanceNames',
341
+ type: 'string',
342
+ default: '',
343
+ placeholder: 'e.g. sales, support',
344
+ description: 'Comma-separated instance names; events of other instances are ignored. Useful with the global webhook, which delivers the events of every instance.',
345
+ },
346
+ {
347
+ displayName: 'Output Media as Binary',
348
+ name: 'binaryOutput',
349
+ type: 'boolean',
350
+ default: true,
351
+ description: 'Whether to convert the embedded media (data.message.base64) into n8n binary data and remove the base64 string from the JSON',
352
+ },
353
+ ],
354
+ },
355
+ ],
356
+ };
357
+ this.methods = {
358
+ listSearch: { searchInstances: GenericFunctions_1.searchInstances },
359
+ };
360
+ this.webhookMethods = {
361
+ default: {
362
+ async checkExists() {
363
+ if (getTriggerMode(this) === 'manual') {
364
+ const manual = getManualVerification(this);
365
+ if ('error' in manual) {
366
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), manual.error);
367
+ }
368
+ if (!manual.config.jwtSecret && !manual.config.secretHeader) {
369
+ this.logger.warn(`Evolution API Trigger: Manual mode without authentication accepts any request to ${getWebhookUrl(this)}`);
370
+ }
371
+ return true;
372
+ }
373
+ const webhookUrl = getWebhookUrl(this);
374
+ const instanceName = await getInstanceName(this);
375
+ const registration = (0, registration_1.getRegistrations)(this.getWorkflowStaticData('node'))[webhookUrl];
376
+ if (!registration ||
377
+ registration.instanceName !== instanceName ||
378
+ registration.auth !== getAutomaticAuth(this)) {
379
+ return false;
380
+ }
381
+ const found = await registration_1.findWebhook.call(this, encodeURIComponent(instanceName));
382
+ return (found.url === webhookUrl &&
383
+ found.enabled === true &&
384
+ found.webhookByEvents !== true &&
385
+ (0, registration_1.hasRegistrationHeaders)(found, registration));
386
+ },
387
+ async create() {
388
+ var _a;
389
+ if (getTriggerMode(this) === 'manual')
390
+ return true;
391
+ const webhookUrl = getWebhookUrl(this);
392
+ const instanceName = await getInstanceName(this);
393
+ const instance = encodeURIComponent(instanceName);
394
+ const events = getSelectedEvents(this);
395
+ const auth = getAutomaticAuth(this);
396
+ const options = this.getNodeParameter('options', {});
397
+ const newerEvents = events.filter((event) => constants_2.TRIGGER_24_ONLY_EVENTS.includes(event));
398
+ if (newerEvents.length > 0) {
399
+ const version = await registration_1.getServerVersion.call(this);
400
+ if (version && (0, registration_1.isVersionBelow)(version, 2, 4)) {
401
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Event ${newerEvents.join(', ')} requires Evolution API 2.4+ (this server runs ${version})`, { description: 'Remove it from Events or upgrade Evolution API.' });
402
+ }
403
+ }
404
+ const isTest = this.getMode() === 'manual';
405
+ const staticData = this.getWorkflowStaticData('node');
406
+ const registrations = (0, registration_1.getRegistrations)(staticData);
407
+ const existing = (_a = registrations[webhookUrl]) !== null && _a !== void 0 ? _a : (0, registration_1.getRecoveryRegistration)(this, webhookUrl);
408
+ const found = await registration_1.findWebhook.call(this, instance);
409
+ if (!isTest &&
410
+ (existing === null || existing === void 0 ? void 0 : existing.instanceName) !== instanceName &&
411
+ (0, registration_1.isOtherEndpointOfNode)(found.url, webhookUrl, this.getNode().webhookId)) {
412
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "A 'Listen for test event' session currently holds the instance webhook; stop it and activate again", {
413
+ description: 'Its original webhook snapshot is in the test session. Stop that session so it can restore the original before activation.',
414
+ });
415
+ }
416
+ let previous;
417
+ if (found.url === webhookUrl ||
418
+ (!isTest &&
419
+ (existing === null || existing === void 0 ? void 0 : existing.instanceName) === instanceName &&
420
+ (0, registration_1.isOtherEndpointOfNode)(found.url, webhookUrl, this.getNode().webhookId))) {
421
+ previous = (existing === null || existing === void 0 ? void 0 : existing.instanceName) === instanceName ? existing.previous : null;
422
+ }
423
+ else {
424
+ previous = (0, registration_1.snapshotWebhook)(found);
425
+ if (previous === null || previous === void 0 ? void 0 : previous.url) {
426
+ this.logger.info(`Evolution API Trigger: replacing the webhook of instance "${instanceName}" (${String(previous.url)}); it will be restored when the workflow is deactivated`);
427
+ }
428
+ }
429
+ if (existing && existing.instanceName !== instanceName) {
430
+ this.logger.warn(`Evolution API Trigger: the webhook of instance "${existing.instanceName}" was not restored before switching to "${instanceName}"; check it in Evolution API`);
431
+ }
432
+ const registration = {
433
+ instanceName,
434
+ auth,
435
+ ...(auth !== 'header' ? { jwtSecret: (0, auth_1.generateSecret)() } : {}),
436
+ ...(auth !== 'jwt' ? { headerSecret: (0, auth_1.generateSecret)() } : {}),
437
+ previous,
438
+ registeredAt: new Date().toISOString(),
439
+ ...(isTest ? { test: true } : {}),
440
+ };
441
+ (0, registration_1.rememberRegistration)(this, webhookUrl, registration);
442
+ await registration_1.setWebhook.call(this, instance, (0, registration_1.buildSetBody)({
443
+ url: webhookUrl,
444
+ enabled: true,
445
+ events,
446
+ headers: (0, registration_1.buildAuthHeaders)(registration),
447
+ byEvents: false,
448
+ base64: options.webhookBase64 === true,
449
+ }));
450
+ registrations[webhookUrl] = registration;
451
+ (0, registration_1.saveRegistrations)(staticData, registrations);
452
+ return true;
453
+ },
454
+ async delete() {
455
+ const webhookUrl = this.getNodeWebhookUrl('default');
456
+ const staticData = this.getWorkflowStaticData('node');
457
+ const registrations = (0, registration_1.getRegistrations)(staticData);
458
+ if (!webhookUrl)
459
+ return true;
460
+ const persisted = registrations[webhookUrl];
461
+ const registration = persisted !== null && persisted !== void 0 ? persisted : (0, registration_1.getRecoveryRegistration)(this, webhookUrl);
462
+ if (!registration) {
463
+ if (getTriggerMode(this) === 'manual')
464
+ return true;
465
+ try {
466
+ const instanceName = await getInstanceName(this);
467
+ const instance = encodeURIComponent(instanceName);
468
+ const found = await registration_1.findWebhook.call(this, instance);
469
+ if (found.url === webhookUrl && (0, registration_1.hasTriggerHeaders)(found)) {
470
+ await registration_1.setWebhook.call(this, instance, (0, registration_1.buildDisableBody)(webhookUrl));
471
+ this.logger.error(`Evolution API Trigger: disabled the orphaned webhook of instance "${instanceName}"; its original configuration could not be recovered`);
472
+ }
473
+ return true;
474
+ }
475
+ catch (error) {
476
+ this.logger.error('Evolution API Trigger: could not clean up an unregistered webhook', {
477
+ error: error.message,
478
+ });
479
+ return false;
480
+ }
481
+ }
482
+ const instance = encodeURIComponent(registration.instanceName);
483
+ try {
484
+ const found = await registration_1.findWebhook.call(this, instance);
485
+ if (!persisted &&
486
+ (found.url !== webhookUrl || !(0, registration_1.hasRegistrationHeaders)(found, registration))) {
487
+ (0, registration_1.forgetRegistration)(this, webhookUrl);
488
+ this.logger.info(`Evolution API Trigger: the webhook of instance "${registration.instanceName}" no longer matches the pending registration; left untouched`);
489
+ return true;
490
+ }
491
+ if (found.url === webhookUrl ||
492
+ (registration.test !== true &&
493
+ (0, registration_1.isOtherEndpointOfNode)(found.url, webhookUrl, this.getNode().webhookId))) {
494
+ await registration_1.setWebhook.call(this, instance, registration.previous
495
+ ? (0, registration_1.buildRestoreBody)(registration.previous)
496
+ : (0, registration_1.buildDisableBody)(webhookUrl));
497
+ }
498
+ else {
499
+ this.logger.info(`Evolution API Trigger: the webhook of instance "${registration.instanceName}" no longer points to n8n; left untouched`);
500
+ }
501
+ }
502
+ catch (error) {
503
+ this.logger.error(`Evolution API Trigger: could not restore the webhook of instance "${registration.instanceName}"`, { error: error.message });
504
+ if (persisted && registration.previous) {
505
+ try {
506
+ await registration_1.setWebhook.call(this, instance, (0, registration_1.buildDisableBody)(webhookUrl));
507
+ }
508
+ catch (disableError) {
509
+ this.logger.error(`Evolution API Trigger: could not disable the webhook of instance "${registration.instanceName}"`, { error: disableError.message });
510
+ }
511
+ }
512
+ return false;
513
+ }
514
+ delete registrations[webhookUrl];
515
+ (0, registration_1.saveRegistrations)(staticData, registrations);
516
+ (0, registration_1.forgetRegistration)(this, webhookUrl);
517
+ return true;
518
+ },
519
+ },
520
+ };
521
+ }
522
+ async webhook() {
523
+ var _a, _b, _c, _d, _e, _f, _g;
524
+ const options = this.getNodeParameter('options', {});
525
+ const headers = this.getHeaderData();
526
+ const webhookUrl = (_a = this.getNodeWebhookUrl('default')) !== null && _a !== void 0 ? _a : '';
527
+ const staticData = this.getWorkflowStaticData('node');
528
+ const leeway = Number((_b = options.jwtLeeway) !== null && _b !== void 0 ? _b : constants_2.DEFAULT_JWT_LEEWAY_SECONDS);
529
+ const timing = {
530
+ jwtLeewaySeconds: Number.isFinite(leeway) ? leeway : constants_2.DEFAULT_JWT_LEEWAY_SECONDS,
531
+ nowSeconds: Math.floor(Date.now() / 1000),
532
+ };
533
+ let result;
534
+ if (getTriggerMode(this) === 'manual') {
535
+ const manual = getManualVerification(this);
536
+ if ('error' in manual) {
537
+ this.logger.error(`Evolution API Trigger: ${manual.error}`);
538
+ return respond(this, 401, 'Unauthorized');
539
+ }
540
+ result = (0, auth_1.verifyWebhookRequest)(headers, { ...manual.config, ...timing });
541
+ }
542
+ else {
543
+ const registrations = getRequestRegistrations(this, staticData, webhookUrl).filter((registration) => registration.jwtSecret || registration.headerSecret);
544
+ if (registrations.length === 0) {
545
+ this.logger.warn('Evolution API Trigger: request rejected, this webhook is not registered (deactivate and activate the workflow again)');
546
+ this.getResponseObject().setHeader('Retry-After', '5');
547
+ return respond(this, 503, 'Webhook registration is not ready; retry later');
548
+ }
549
+ const attempts = registrations.map((registration) => (0, auth_1.verifyWebhookRequest)(headers, {
550
+ ...(registration.jwtSecret ? { jwtSecret: registration.jwtSecret } : {}),
551
+ ...(registration.headerSecret
552
+ ? { secretHeader: { name: constants_2.SECRET_HEADER_NAME, value: registration.headerSecret } }
553
+ : {}),
554
+ ...timing,
555
+ }));
556
+ result = (_c = attempts.find((attempt) => attempt.valid)) !== null && _c !== void 0 ? _c : attempts[0];
557
+ }
558
+ if (!result.valid) {
559
+ this.logger.warn(`Evolution API Trigger: request rejected (${result.reason})`);
560
+ return respond(this, 401, 'Unauthorized');
561
+ }
562
+ const body = this.getBodyData();
563
+ if (!(0, GenericFunctions_1.isPlainObject)(body) || typeof body.event !== 'string' || body.event === '') {
564
+ return respond(this, 400, 'Not an Evolution API webhook event');
565
+ }
566
+ const fields = (0, payload_1.getMessageFields)(body.data);
567
+ const reason = (0, payload_1.getFilterReason)(body, fields, {
568
+ events: getSelectedEvents(this),
569
+ instanceNames: (0, payload_1.parseList)(options.instanceNames),
570
+ ignoreFromMe: options.ignoreFromMe === true,
571
+ ignoreGroups: options.ignoreGroups === true,
572
+ ignoreNewsletters: options.ignoreNewsletters === true,
573
+ ignoreBroadcasts: options.ignoreBroadcasts === true,
574
+ messageTypes: Array.isArray(options.messageTypes) ? options.messageTypes.map(String) : [],
575
+ });
576
+ if (reason)
577
+ return { webhookResponse: { received: true, ignored: reason } };
578
+ let delivery;
579
+ if (options.deduplicate !== false) {
580
+ const endpoint = (_d = getServedWebhookUrl(this)) !== null && _d !== void 0 ? _d : `${webhookUrl}:${this.getMode()}`;
581
+ const scope = `${String((_e = this.getWorkflow().id) !== null && _e !== void 0 ? _e : '')}:${this.getNode().id}:${endpoint}`;
582
+ delivery = { scope, key: (0, dedupe_1.getDeliveryKey)(body) };
583
+ if ((0, dedupe_1.isDuplicateDelivery)(staticData, scope, delivery.key, Date.now())) {
584
+ return { webhookResponse: { received: true, ignored: 'duplicate delivery' } };
585
+ }
586
+ }
587
+ const json = { ...body };
588
+ if (options.keepApiKey !== true)
589
+ delete json.apikey;
590
+ json.eventType = (0, payload_1.normalizeEventName)(body.event);
591
+ json.timestamp = (0, payload_1.getEventTimestamp)((0, auth_1.getHeaderValue)(headers, 'x-timestamp'), body.data);
592
+ if (fields)
593
+ Object.assign(json, fields);
594
+ const item = { json };
595
+ if (options.binaryOutput !== false) {
596
+ const media = (0, payload_1.findWebhookMedia)(body.data, (_f = fields === null || fields === void 0 ? void 0 : fields.messageId) !== null && _f !== void 0 ? _f : null);
597
+ if (media) {
598
+ const property = String((_g = options.binaryPropertyName) !== null && _g !== void 0 ? _g : 'data').trim() || 'data';
599
+ item.binary = {
600
+ [property]: await this.helpers.prepareBinaryData(Buffer.from(media.data, 'base64'), media.fileName, media.mimeType),
601
+ };
602
+ json.data = (0, payload_1.withoutMediaBase64)(body.data);
603
+ }
604
+ }
605
+ if (delivery) {
606
+ if ((0, dedupe_1.isDuplicateDelivery)(staticData, delivery.scope, delivery.key, Date.now())) {
607
+ return { webhookResponse: { received: true, ignored: 'duplicate delivery' } };
608
+ }
609
+ (0, dedupe_1.rememberDelivery)(staticData, delivery.scope, delivery.key, Date.now());
610
+ }
611
+ return { workflowData: [[item]] };
612
+ }
613
+ }
614
+ exports.EvolutionApiTrigger = EvolutionApiTrigger;
615
+ //# sourceMappingURL=EvolutionApiTrigger.node.js.map