@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.
- package/LICENSE +21 -0
- package/README.md +330 -0
- package/dist/credentials/EvolutionApi.credentials.d.ts +10 -0
- package/dist/credentials/EvolutionApi.credentials.js +84 -0
- package/dist/credentials/EvolutionApi.credentials.js.map +1 -0
- package/dist/nodes/EvolutionApi/EvolutionApi.node.d.ts +19 -0
- package/dist/nodes/EvolutionApi/EvolutionApi.node.js +180 -0
- package/dist/nodes/EvolutionApi/EvolutionApi.node.js.map +1 -0
- package/dist/nodes/EvolutionApi/EvolutionApi.node.json +22 -0
- package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.d.ts +18 -0
- package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.js +615 -0
- package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.js.map +1 -0
- package/dist/nodes/EvolutionApi/EvolutionApiTrigger.node.json +19 -0
- package/dist/nodes/EvolutionApi/GenericFunctions.d.ts +114 -0
- package/dist/nodes/EvolutionApi/GenericFunctions.js +681 -0
- package/dist/nodes/EvolutionApi/GenericFunctions.js.map +1 -0
- package/dist/nodes/EvolutionApi/constants.d.ts +7 -0
- package/dist/nodes/EvolutionApi/constants.js +77 -0
- package/dist/nodes/EvolutionApi/constants.js.map +1 -0
- package/dist/nodes/EvolutionApi/evolution.svg +11 -0
- package/dist/nodes/EvolutionApi/resources/call/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/call/index.js +62 -0
- package/dist/nodes/EvolutionApi/resources/call/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/call/offer.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/call/offer.operation.js +56 -0
- package/dist/nodes/EvolutionApi/resources/call/offer.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/archive.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/archive.operation.js +44 -0
- package/dist/nodes/EvolutionApi/resources/chat/archive.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/checkNumbers.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/checkNumbers.operation.js +28 -0
- package/dist/nodes/EvolutionApi/resources/chat/checkNumbers.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/deleteMessage.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/deleteMessage.operation.js +68 -0
- package/dist/nodes/EvolutionApi/resources/chat/deleteMessage.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/downloadMedia.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/chat/downloadMedia.operation.js +143 -0
- package/dist/nodes/EvolutionApi/resources/chat/downloadMedia.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/editMessage.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/editMessage.operation.js +49 -0
- package/dist/nodes/EvolutionApi/resources/chat/editMessage.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/get.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/get.operation.js +28 -0
- package/dist/nodes/EvolutionApi/resources/chat/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/getChannels.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/getChannels.operation.js +23 -0
- package/dist/nodes/EvolutionApi/resources/chat/getChannels.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/getContacts.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/getContacts.operation.js +55 -0
- package/dist/nodes/EvolutionApi/resources/chat/getContacts.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/getMany.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/chat/getMany.operation.js +74 -0
- package/dist/nodes/EvolutionApi/resources/chat/getMany.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/getMessages.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/getMessages.operation.js +124 -0
- package/dist/nodes/EvolutionApi/resources/chat/getMessages.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/getPollVotes.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/getPollVotes.operation.js +36 -0
- package/dist/nodes/EvolutionApi/resources/chat/getPollVotes.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/getStatusUpdates.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/getStatusUpdates.operation.js +57 -0
- package/dist/nodes/EvolutionApi/resources/chat/getStatusUpdates.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/helpers.d.ts +25 -0
- package/dist/nodes/EvolutionApi/resources/chat/helpers.js +219 -0
- package/dist/nodes/EvolutionApi/resources/chat/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/chat/index.js +209 -0
- package/dist/nodes/EvolutionApi/resources/chat/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/markAsPlayed.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/markAsPlayed.operation.js +49 -0
- package/dist/nodes/EvolutionApi/resources/chat/markAsPlayed.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/markAsRead.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/markAsRead.operation.js +48 -0
- package/dist/nodes/EvolutionApi/resources/chat/markAsRead.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/markUnread.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/markUnread.operation.js +35 -0
- package/dist/nodes/EvolutionApi/resources/chat/markUnread.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/sendPresence.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/sendPresence.operation.js +53 -0
- package/dist/nodes/EvolutionApi/resources/chat/sendPresence.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chat/updateBlockStatus.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chat/updateBlockStatus.operation.js +44 -0
- package/dist/nodes/EvolutionApi/resources/chat/updateBlockStatus.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/changeStatus.operation.d.ts +31 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/changeStatus.operation.js +73 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/changeStatus.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/create.operation.d.ts +38 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/create.operation.js +251 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/create.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/createCredential.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/createCredential.operation.js +44 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/createCredential.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/delete.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/delete.operation.js +19 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/delete.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/deleteCredential.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/deleteCredential.operation.js +30 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/deleteCredential.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/fields.d.ts +10 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/fields.js +229 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/fields.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/get.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/get.operation.js +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getCredentials.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getCredentials.operation.js +17 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getCredentials.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getMany.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getMany.operation.js +18 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getMany.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getModels.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getModels.operation.js +39 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getModels.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getSessions.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getSessions.operation.js +69 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getSessions.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getSettings.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getSettings.operation.js +17 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/getSettings.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/helpers.d.ts +24 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/helpers.js +273 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/ignoreJid.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/ignoreJid.operation.js +35 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/ignoreJid.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/index.d.ts +6 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/index.js +210 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/methods.d.ts +2 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/methods.js +58 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/methods.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/setSettings.operation.d.ts +33 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/setSettings.operation.js +133 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/setSettings.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/start.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/start.operation.js +112 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/start.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/update.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/update.operation.js +191 -0
- package/dist/nodes/EvolutionApi/resources/chatbot/update.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/get.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/get.operation.js +25 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/helpers.d.ts +4 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/helpers.js +26 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/index.js +70 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/set.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/set.operation.js +252 -0
- package/dist/nodes/EvolutionApi/resources/chatwoot/set.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/acceptInvite.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/acceptInvite.operation.js +25 -0
- package/dist/nodes/EvolutionApi/resources/group/acceptInvite.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/create.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/create.operation.js +68 -0
- package/dist/nodes/EvolutionApi/resources/group/create.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/get.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/get.operation.js +15 -0
- package/dist/nodes/EvolutionApi/resources/group/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/getInviteCode.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/getInviteCode.operation.js +15 -0
- package/dist/nodes/EvolutionApi/resources/group/getInviteCode.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/getInviteInfo.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/getInviteInfo.operation.js +25 -0
- package/dist/nodes/EvolutionApi/resources/group/getInviteInfo.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/getMany.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/getMany.operation.js +72 -0
- package/dist/nodes/EvolutionApi/resources/group/getMany.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/getParticipants.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/getParticipants.operation.js +21 -0
- package/dist/nodes/EvolutionApi/resources/group/getParticipants.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/helpers.d.ts +8 -0
- package/dist/nodes/EvolutionApi/resources/group/helpers.js +139 -0
- package/dist/nodes/EvolutionApi/resources/group/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/index.d.ts +7 -0
- package/dist/nodes/EvolutionApi/resources/group/index.js +216 -0
- package/dist/nodes/EvolutionApi/resources/group/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/leave.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/leave.operation.js +15 -0
- package/dist/nodes/EvolutionApi/resources/group/leave.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/revokeInviteCode.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/revokeInviteCode.operation.js +20 -0
- package/dist/nodes/EvolutionApi/resources/group/revokeInviteCode.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/sendInvite.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/sendInvite.operation.js +48 -0
- package/dist/nodes/EvolutionApi/resources/group/sendInvite.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/toggleEphemeral.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/toggleEphemeral.operation.js +43 -0
- package/dist/nodes/EvolutionApi/resources/group/toggleEphemeral.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/updateDescription.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/updateDescription.operation.js +34 -0
- package/dist/nodes/EvolutionApi/resources/group/updateDescription.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/updateMemberAddMode.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/updateMemberAddMode.operation.js +47 -0
- package/dist/nodes/EvolutionApi/resources/group/updateMemberAddMode.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/updateParticipants.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/updateParticipants.operation.js +67 -0
- package/dist/nodes/EvolutionApi/resources/group/updateParticipants.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/updatePicture.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/updatePicture.operation.js +99 -0
- package/dist/nodes/EvolutionApi/resources/group/updatePicture.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/updateSetting.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/updateSetting.operation.js +57 -0
- package/dist/nodes/EvolutionApi/resources/group/updateSetting.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/group/updateSubject.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/group/updateSubject.operation.js +31 -0
- package/dist/nodes/EvolutionApi/resources/group/updateSubject.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/index.d.ts +6 -0
- package/dist/nodes/EvolutionApi/resources/index.js +144 -0
- package/dist/nodes/EvolutionApi/resources/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/connect.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/instance/connect.operation.js +40 -0
- package/dist/nodes/EvolutionApi/resources/instance/connect.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/create.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/instance/create.operation.js +519 -0
- package/dist/nodes/EvolutionApi/resources/instance/create.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/delete.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/instance/delete.operation.js +11 -0
- package/dist/nodes/EvolutionApi/resources/instance/delete.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/getConnectionState.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/instance/getConnectionState.operation.js +11 -0
- package/dist/nodes/EvolutionApi/resources/instance/getConnectionState.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/getMany.operation.d.ts +31 -0
- package/dist/nodes/EvolutionApi/resources/instance/getMany.operation.js +149 -0
- package/dist/nodes/EvolutionApi/resources/instance/getMany.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/helpers.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/instance/helpers.js +60 -0
- package/dist/nodes/EvolutionApi/resources/instance/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/index.d.ts +6 -0
- package/dist/nodes/EvolutionApi/resources/instance/index.js +128 -0
- package/dist/nodes/EvolutionApi/resources/instance/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/logout.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/instance/logout.operation.js +11 -0
- package/dist/nodes/EvolutionApi/resources/instance/logout.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/restart.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/instance/restart.operation.js +13 -0
- package/dist/nodes/EvolutionApi/resources/instance/restart.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/instance/setPresence.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/instance/setPresence.operation.js +24 -0
- package/dist/nodes/EvolutionApi/resources/instance/setPresence.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/label/addToChat.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/label/addToChat.operation.js +11 -0
- package/dist/nodes/EvolutionApi/resources/label/addToChat.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/label/getMany.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/label/getMany.operation.js +12 -0
- package/dist/nodes/EvolutionApi/resources/label/getMany.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/label/helpers.d.ts +4 -0
- package/dist/nodes/EvolutionApi/resources/label/helpers.js +69 -0
- package/dist/nodes/EvolutionApi/resources/label/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/label/index.d.ts +6 -0
- package/dist/nodes/EvolutionApi/resources/label/index.js +88 -0
- package/dist/nodes/EvolutionApi/resources/label/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/label/removeFromChat.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/label/removeFromChat.operation.js +11 -0
- package/dist/nodes/EvolutionApi/resources/label/removeFromChat.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/generateMessageId.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/generateMessageId.operation.js +21 -0
- package/dist/nodes/EvolutionApi/resources/message/generateMessageId.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/helpers.d.ts +39 -0
- package/dist/nodes/EvolutionApi/resources/message/helpers.js +566 -0
- package/dist/nodes/EvolutionApi/resources/message/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/index.d.ts +6 -0
- package/dist/nodes/EvolutionApi/resources/message/index.js +192 -0
- package/dist/nodes/EvolutionApi/resources/message/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendAudio.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendAudio.operation.js +36 -0
- package/dist/nodes/EvolutionApi/resources/message/sendAudio.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendButtons.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendButtons.operation.js +114 -0
- package/dist/nodes/EvolutionApi/resources/message/sendButtons.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendCarousel.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/message/sendCarousel.operation.js +162 -0
- package/dist/nodes/EvolutionApi/resources/message/sendCarousel.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendContact.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendContact.operation.js +105 -0
- package/dist/nodes/EvolutionApi/resources/message/sendContact.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendList.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/message/sendList.operation.js +197 -0
- package/dist/nodes/EvolutionApi/resources/message/sendList.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendLocation.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendLocation.operation.js +70 -0
- package/dist/nodes/EvolutionApi/resources/message/sendLocation.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendMedia.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendMedia.operation.js +142 -0
- package/dist/nodes/EvolutionApi/resources/message/sendMedia.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendPoll.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendPoll.operation.js +67 -0
- package/dist/nodes/EvolutionApi/resources/message/sendPoll.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendPtv.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendPtv.operation.js +22 -0
- package/dist/nodes/EvolutionApi/resources/message/sendPtv.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendReaction.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendReaction.operation.js +81 -0
- package/dist/nodes/EvolutionApi/resources/message/sendReaction.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendStatus.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendStatus.operation.js +147 -0
- package/dist/nodes/EvolutionApi/resources/message/sendStatus.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendSticker.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendSticker.operation.js +41 -0
- package/dist/nodes/EvolutionApi/resources/message/sendSticker.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendTemplate.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendTemplate.operation.js +92 -0
- package/dist/nodes/EvolutionApi/resources/message/sendTemplate.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/message/sendText.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/message/sendText.operation.js +38 -0
- package/dist/nodes/EvolutionApi/resources/message/sendText.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/get.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/profile/get.operation.js +27 -0
- package/dist/nodes/EvolutionApi/resources/profile/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/getBusinessProfile.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/profile/getBusinessProfile.operation.js +24 -0
- package/dist/nodes/EvolutionApi/resources/profile/getBusinessProfile.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/getPicture.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/profile/getPicture.operation.js +27 -0
- package/dist/nodes/EvolutionApi/resources/profile/getPicture.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/getPrivacySettings.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/profile/getPrivacySettings.operation.js +11 -0
- package/dist/nodes/EvolutionApi/resources/profile/getPrivacySettings.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/profile/index.js +136 -0
- package/dist/nodes/EvolutionApi/resources/profile/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/removePicture.operation.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/profile/removePicture.operation.js +11 -0
- package/dist/nodes/EvolutionApi/resources/profile/removePicture.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/updateName.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/profile/updateName.operation.js +27 -0
- package/dist/nodes/EvolutionApi/resources/profile/updateName.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/updatePicture.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/profile/updatePicture.operation.js +86 -0
- package/dist/nodes/EvolutionApi/resources/profile/updatePicture.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/updatePrivacySettings.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/profile/updatePrivacySettings.operation.js +133 -0
- package/dist/nodes/EvolutionApi/resources/profile/updatePrivacySettings.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/profile/updateStatus.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/profile/updateStatus.operation.js +28 -0
- package/dist/nodes/EvolutionApi/resources/profile/updateStatus.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/proxy/get.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/proxy/get.operation.js +25 -0
- package/dist/nodes/EvolutionApi/resources/proxy/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/proxy/helpers.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/proxy/helpers.js +28 -0
- package/dist/nodes/EvolutionApi/resources/proxy/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/proxy/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/proxy/index.js +70 -0
- package/dist/nodes/EvolutionApi/resources/proxy/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/proxy/set.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/proxy/set.operation.js +137 -0
- package/dist/nodes/EvolutionApi/resources/proxy/set.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/settings/get.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/settings/get.operation.js +25 -0
- package/dist/nodes/EvolutionApi/resources/settings/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/settings/helpers.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/settings/helpers.js +37 -0
- package/dist/nodes/EvolutionApi/resources/settings/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/settings/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/settings/index.js +70 -0
- package/dist/nodes/EvolutionApi/resources/settings/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/settings/set.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/settings/set.operation.js +128 -0
- package/dist/nodes/EvolutionApi/resources/settings/set.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/create.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/template/create.operation.js +97 -0
- package/dist/nodes/EvolutionApi/resources/template/create.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/delete.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/template/delete.operation.js +50 -0
- package/dist/nodes/EvolutionApi/resources/template/delete.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/getCatalog.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/template/getCatalog.operation.js +48 -0
- package/dist/nodes/EvolutionApi/resources/template/getCatalog.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/getCollections.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/template/getCollections.operation.js +41 -0
- package/dist/nodes/EvolutionApi/resources/template/getCollections.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/getMany.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/template/getMany.operation.js +109 -0
- package/dist/nodes/EvolutionApi/resources/template/getMany.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/helpers.d.ts +3 -0
- package/dist/nodes/EvolutionApi/resources/template/helpers.js +32 -0
- package/dist/nodes/EvolutionApi/resources/template/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/template/index.js +109 -0
- package/dist/nodes/EvolutionApi/resources/template/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/template/update.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/template/update.operation.js +89 -0
- package/dist/nodes/EvolutionApi/resources/template/update.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/webhook/get.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/webhook/get.operation.js +25 -0
- package/dist/nodes/EvolutionApi/resources/webhook/get.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/webhook/getTransport.operation.d.ts +30 -0
- package/dist/nodes/EvolutionApi/resources/webhook/getTransport.operation.js +49 -0
- package/dist/nodes/EvolutionApi/resources/webhook/getTransport.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/webhook/helpers.d.ts +17 -0
- package/dist/nodes/EvolutionApi/resources/webhook/helpers.js +144 -0
- package/dist/nodes/EvolutionApi/resources/webhook/helpers.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/webhook/index.d.ts +5 -0
- package/dist/nodes/EvolutionApi/resources/webhook/index.js +91 -0
- package/dist/nodes/EvolutionApi/resources/webhook/index.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/webhook/set.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/webhook/set.operation.js +174 -0
- package/dist/nodes/EvolutionApi/resources/webhook/set.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/resources/webhook/setTransport.operation.d.ts +29 -0
- package/dist/nodes/EvolutionApi/resources/webhook/setTransport.operation.js +159 -0
- package/dist/nodes/EvolutionApi/resources/webhook/setTransport.operation.js.map +1 -0
- package/dist/nodes/EvolutionApi/trigger/auth.d.ts +26 -0
- package/dist/nodes/EvolutionApi/trigger/auth.js +96 -0
- package/dist/nodes/EvolutionApi/trigger/auth.js.map +1 -0
- package/dist/nodes/EvolutionApi/trigger/constants.d.ts +10 -0
- package/dist/nodes/EvolutionApi/trigger/constants.js +154 -0
- package/dist/nodes/EvolutionApi/trigger/constants.js.map +1 -0
- package/dist/nodes/EvolutionApi/trigger/dedupe.d.ts +5 -0
- package/dist/nodes/EvolutionApi/trigger/dedupe.js +87 -0
- package/dist/nodes/EvolutionApi/trigger/dedupe.js.map +1 -0
- package/dist/nodes/EvolutionApi/trigger/payload.d.ts +48 -0
- package/dist/nodes/EvolutionApi/trigger/payload.js +265 -0
- package/dist/nodes/EvolutionApi/trigger/payload.js.map +1 -0
- package/dist/nodes/EvolutionApi/trigger/registration.d.ts +36 -0
- package/dist/nodes/EvolutionApi/trigger/registration.js +156 -0
- package/dist/nodes/EvolutionApi/trigger/registration.js.map +1 -0
- package/dist/nodes/EvolutionApi/types.d.ts +44 -0
- package/dist/nodes/EvolutionApi/types.js +3 -0
- package/dist/nodes/EvolutionApi/types.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.methods = void 0;
|
|
4
|
+
const GenericFunctions_1 = require("../../GenericFunctions");
|
|
5
|
+
const helpers_1 = require("./helpers");
|
|
6
|
+
async function currentInstance() {
|
|
7
|
+
return await GenericFunctions_1.resolveInstanceNameFromValue.call(this, this.getCurrentNodeParameter('instanceName', { extractValue: true }));
|
|
8
|
+
}
|
|
9
|
+
async function listBots() {
|
|
10
|
+
const botType = (0, helpers_1.parseBotType)(this.getNode(), this.getCurrentNodeParameter('botType'));
|
|
11
|
+
const instance = await currentInstance.call(this);
|
|
12
|
+
return (0, GenericFunctions_1.toArray)(await GenericFunctions_1.evolutionApiRequest.call(this, 'GET', `/${botType.value}/find/${instance}`));
|
|
13
|
+
}
|
|
14
|
+
function botLabel(bot) {
|
|
15
|
+
var _a;
|
|
16
|
+
const name = String(bot.description || bot.id || '').trim();
|
|
17
|
+
const trigger = bot.triggerValue
|
|
18
|
+
? `${String(bot.triggerType)}: ${String(bot.triggerValue)}`
|
|
19
|
+
: String((_a = bot.triggerType) !== null && _a !== void 0 ? _a : '');
|
|
20
|
+
const disabled = bot.enabled === false ? ', disabled' : '';
|
|
21
|
+
return trigger || disabled ? `${name} (${trigger}${disabled})` : name;
|
|
22
|
+
}
|
|
23
|
+
exports.methods = {
|
|
24
|
+
listSearch: {
|
|
25
|
+
async chatbotSearchBots(filter) {
|
|
26
|
+
const needle = (filter !== null && filter !== void 0 ? filter : '').trim().toLowerCase();
|
|
27
|
+
const results = (await listBots.call(this))
|
|
28
|
+
.filter((bot) => bot.id)
|
|
29
|
+
.map((bot) => ({ name: botLabel(bot), value: String(bot.id) }))
|
|
30
|
+
.filter((bot) => !needle ||
|
|
31
|
+
bot.name.toLowerCase().includes(needle) ||
|
|
32
|
+
bot.value.toLowerCase().includes(needle))
|
|
33
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
34
|
+
return { results };
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
loadOptions: {
|
|
38
|
+
async chatbotGetBots() {
|
|
39
|
+
const bots = (await listBots.call(this))
|
|
40
|
+
.filter((bot) => bot.id)
|
|
41
|
+
.map((bot) => ({ name: botLabel(bot), value: String(bot.id) }))
|
|
42
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
43
|
+
return [{ name: 'None', value: '', description: 'No fallback bot' }, ...bots];
|
|
44
|
+
},
|
|
45
|
+
async chatbotGetOpenaiCredentials() {
|
|
46
|
+
const instance = await currentInstance.call(this);
|
|
47
|
+
const credentials = (0, GenericFunctions_1.toArray)(await GenericFunctions_1.evolutionApiRequest.call(this, 'GET', `/openai/creds/${instance}`));
|
|
48
|
+
return credentials
|
|
49
|
+
.filter((credential) => credential.id)
|
|
50
|
+
.map((credential) => ({
|
|
51
|
+
name: String(credential.name || credential.id),
|
|
52
|
+
value: String(credential.id),
|
|
53
|
+
}))
|
|
54
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../../../../nodes/EvolutionApi/resources/chatbot/methods.ts"],"names":[],"mappings":";;;AAOA,6DAAoG;AAEpG,uCAAyC;AAEzC,KAAK,UAAU,eAAe;IAC5B,OAAO,MAAM,+CAA4B,CAAC,IAAI,CAC5C,IAAI,EACJ,IAAI,CAAC,uBAAuB,C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,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAChD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAChF,CAAC;QAGD,KAAK,CAAC,2BAA2B;YAG/B,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClD,MAAM,WAAW,GAAG,IAAA,0BAAO,EACzB,MAAM,sCAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAAQ,EAAE,CAAC,CACzE,CAAC;YACF,OAAO,WAAW;iBACf,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;iBACrC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBACpB,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,EAAE,CAAC;gBAC9C,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;aAC7B,CAAC,CAAC;iBACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import type { BotType } from './helpers';
|
|
3
|
+
export declare const description: {
|
|
4
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
5
|
+
displayName: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
8
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
9
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
10
|
+
description?: string;
|
|
11
|
+
hint?: string;
|
|
12
|
+
builderHint?: import("n8n-workflow").IParameterBuilderHint;
|
|
13
|
+
disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
14
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
isNodeSetting?: boolean;
|
|
17
|
+
noDataExpression?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
20
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
21
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
22
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
23
|
+
requiresDataPath?: "single" | "multiple";
|
|
24
|
+
doNotInherit?: boolean;
|
|
25
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
26
|
+
ignoreValidationDuringExecution?: boolean;
|
|
27
|
+
allowArbitraryValues?: boolean;
|
|
28
|
+
resolvableField?: boolean;
|
|
29
|
+
}[];
|
|
30
|
+
export declare function buildSettingsBody(current: IDataObject, changes: IDataObject, botType: BotType): IDataObject;
|
|
31
|
+
export declare function resolveFallbackId(current: IDataObject, changes: IDataObject): string | null;
|
|
32
|
+
export declare function planSettingsRequests(current: IDataObject, changes: IDataObject, botType: BotType): IDataObject[];
|
|
33
|
+
export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.buildSettingsBody = buildSettingsBody;
|
|
5
|
+
exports.resolveFallbackId = resolveFallbackId;
|
|
6
|
+
exports.planSettingsRequests = planSettingsRequests;
|
|
7
|
+
exports.execute = execute;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
const GenericFunctions_1 = require("../../GenericFunctions");
|
|
10
|
+
const fields_1 = require("./fields");
|
|
11
|
+
const helpers_1 = require("./helpers");
|
|
12
|
+
const properties = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Settings to Change',
|
|
15
|
+
name: 'updateFields',
|
|
16
|
+
type: 'collection',
|
|
17
|
+
placeholder: 'Add Setting',
|
|
18
|
+
default: {},
|
|
19
|
+
description: 'Only the settings added here change; the node reads the current default settings first and resends the others, because Evolution API requires all of them. They apply to every bot of this type that does not set its own value.',
|
|
20
|
+
options: (0, fields_1.sortOptions)([
|
|
21
|
+
...fields_1.BEHAVIOR_OPTIONS,
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Fallback Bot Name or ID',
|
|
24
|
+
name: 'fallbackId',
|
|
25
|
+
type: 'options',
|
|
26
|
+
typeOptions: {
|
|
27
|
+
loadOptionsMethod: 'chatbotGetBots',
|
|
28
|
+
loadOptionsDependsOn: ['botType', 'instanceName.value'],
|
|
29
|
+
},
|
|
30
|
+
default: '',
|
|
31
|
+
description: 'Bot of this type that answers when no trigger matches. Choose "None" to remove it. Evolution API 2.3.7 and v2.4 never use the fallback of n8n and Dify bots (they read a field that is not stored). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'OpenAI Credential Name or ID',
|
|
35
|
+
name: 'openaiCredsId',
|
|
36
|
+
type: 'options',
|
|
37
|
+
typeOptions: {
|
|
38
|
+
loadOptionsMethod: 'chatbotGetOpenaiCredentials',
|
|
39
|
+
loadOptionsDependsOn: ['instanceName.value'],
|
|
40
|
+
},
|
|
41
|
+
default: '',
|
|
42
|
+
displayOptions: { show: { '/botType': ['openai'] } },
|
|
43
|
+
description: 'Default OpenAI API key of the instance, also used by Get OpenAI Models and speech to text. Required for OpenAI settings. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Speech to Text',
|
|
47
|
+
name: 'speechToText',
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
default: false,
|
|
50
|
+
displayOptions: { show: { '/botType': ['openai'] } },
|
|
51
|
+
description: 'Whether to transcribe audio messages with OpenAI Whisper. The text is added to the message as "speechToText" (webhooks, stored messages and bots).',
|
|
52
|
+
},
|
|
53
|
+
]),
|
|
54
|
+
},
|
|
55
|
+
helpers_1.secretsOptionsProperty,
|
|
56
|
+
];
|
|
57
|
+
exports.description = (0, n8n_workflow_1.updateDisplayOptions)({ show: { resource: ['chatbot'], operation: ['setSettings'] } }, properties);
|
|
58
|
+
const NOT_EMPTY_KEYS = ['keywordFinish', 'unknownMessage'];
|
|
59
|
+
function buildSettingsBody(current, changes, botType) {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
const converted = (0, helpers_1.collectBotFields)(changes, botType);
|
|
62
|
+
const body = {};
|
|
63
|
+
for (const [key, fallback] of Object.entries(helpers_1.SETTINGS_DEFAULTS)) {
|
|
64
|
+
body[key] = converted[key] !== undefined ? converted[key] : ((_a = current[key]) !== null && _a !== void 0 ? _a : fallback);
|
|
65
|
+
}
|
|
66
|
+
if (botType === 'openai') {
|
|
67
|
+
const credsId = (_b = converted.openaiCredsId) !== null && _b !== void 0 ? _b : current.openaiCredsId;
|
|
68
|
+
if (typeof credsId === 'string' && credsId)
|
|
69
|
+
body.openaiCredsId = credsId;
|
|
70
|
+
const speechToText = (_c = converted.speechToText) !== null && _c !== void 0 ? _c : current.speechToText;
|
|
71
|
+
if (typeof speechToText === 'boolean')
|
|
72
|
+
body.speechToText = speechToText;
|
|
73
|
+
}
|
|
74
|
+
return body;
|
|
75
|
+
}
|
|
76
|
+
function resolveFallbackId(current, changes) {
|
|
77
|
+
const value = changes.fallbackId !== undefined ? changes.fallbackId : current.fallbackId;
|
|
78
|
+
const fallbackId = typeof value === 'string' ? value.trim() : '';
|
|
79
|
+
return fallbackId || null;
|
|
80
|
+
}
|
|
81
|
+
function planSettingsRequests(current, changes, botType) {
|
|
82
|
+
const body = buildSettingsBody(current, changes, botType);
|
|
83
|
+
const fallbackId = resolveFallbackId(current, changes);
|
|
84
|
+
if (botType === 'openai') {
|
|
85
|
+
if (changes.fallbackId === undefined)
|
|
86
|
+
return [body];
|
|
87
|
+
return [body, { ...body, openaiCredsId: '', fallbackId }];
|
|
88
|
+
}
|
|
89
|
+
const exists = typeof current.id === 'string' && current.id !== '';
|
|
90
|
+
if (exists)
|
|
91
|
+
return [{ ...body, fallbackId }];
|
|
92
|
+
const hasEmpty = NOT_EMPTY_KEYS.some((key) => body[key] === '');
|
|
93
|
+
if (fallbackId === null && !hasEmpty)
|
|
94
|
+
return [body];
|
|
95
|
+
const first = { ...body };
|
|
96
|
+
for (const key of NOT_EMPTY_KEYS) {
|
|
97
|
+
if (first[key] === '')
|
|
98
|
+
first[key] = helpers_1.SETTINGS_DEFAULTS[key];
|
|
99
|
+
}
|
|
100
|
+
return [first, { ...body, fallbackId }];
|
|
101
|
+
}
|
|
102
|
+
async function execute(itemIndex) {
|
|
103
|
+
const node = this.getNode();
|
|
104
|
+
const instance = await GenericFunctions_1.resolveInstanceName.call(this, itemIndex);
|
|
105
|
+
const botType = (0, helpers_1.parseBotType)(node, this.getNodeParameter('botType', itemIndex), itemIndex);
|
|
106
|
+
const changes = this.getNodeParameter('updateFields', itemIndex, {});
|
|
107
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
108
|
+
if (Object.keys(changes).length === 0) {
|
|
109
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'Add at least one setting to change', {
|
|
110
|
+
itemIndex,
|
|
111
|
+
description: 'Use "Settings to Change" to pick the default settings to update.',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const current = (await GenericFunctions_1.evolutionApiRequest.call(this, 'GET', `/${botType.value}/fetchSettings/${instance}`, {}, {}, { itemIndex }));
|
|
115
|
+
const bodies = planSettingsRequests(current, changes, botType.value);
|
|
116
|
+
if (botType.value === 'openai' && !bodies[0].openaiCredsId) {
|
|
117
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'OpenAI Credential is required for OpenAI settings', {
|
|
118
|
+
itemIndex,
|
|
119
|
+
description: 'Add "OpenAI Credential" under "Settings to Change" (create one with Create OpenAI Credential).',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
let settings = {};
|
|
123
|
+
for (const body of bodies) {
|
|
124
|
+
try {
|
|
125
|
+
settings = (await GenericFunctions_1.evolutionApiRequest.call(this, 'POST', `/${botType.value}/settings/${instance}`, body, {}, { itemIndex }));
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
throw (0, helpers_1.withChatbotHint)(error, `Check that the fallback bot is a ${botType.info.label} bot of this instance${botType.value === 'openai' ? ' and that the OpenAI credential exists' : ''}.`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return options.includeSecrets === true ? settings : (0, helpers_1.redactBotSecrets)(settings);
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=setSettings.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setSettings.operation.js","sourceRoot":"","sources":["../../../../../nodes/EvolutionApi/resources/chatbot/setSettings.operation.ts"],"names":[],"mappings":";;;AA+EA,8CAmBC;AAGD,8CAIC;AAgBD,oDAwBC;AAOD,0BAqDC;AA5MD,+CAAwE;AAExE,6DAAkF;AAClF,qCAAyD;AAEzD,uCAOmB;AAEnB,MAAM,UAAU,GAAsB;IACpC;QACE,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,aAAa;QAC1B,OAAO,EAAE,EAAE;QACX,WAAW,EACT,kOAAkO;QACpO,OAAO,EAAE,IAAA,oBAAW,EAAC;YACnB,GAAG,yBAAgB;YAC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IAAI,OAAO,CAAC,KAAK,aAAa,QAAQ,EAAE,EACxC,IAAI,EACJ,EAAE,EACF,EAAE,SAAS,EAAE,CACd,CAAgB,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAA,yBAAe,EACnB,KAAK,EACL,oCAAoC,OAAO,CAAC,IAAI,CAAC,KAAK,wBACpD,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,EAC1E,GAAG,CACJ,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,0BAAgB,EAAC,QAAQ,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const description: {
|
|
3
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
4
|
+
displayName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
7
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
8
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
9
|
+
description?: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
builderHint?: import("n8n-workflow").IParameterBuilderHint;
|
|
12
|
+
disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
13
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
isNodeSetting?: boolean;
|
|
16
|
+
noDataExpression?: boolean;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
19
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
20
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
21
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
22
|
+
requiresDataPath?: "single" | "multiple";
|
|
23
|
+
doNotInherit?: boolean;
|
|
24
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
25
|
+
ignoreValidationDuringExecution?: boolean;
|
|
26
|
+
allowArbitraryValues?: boolean;
|
|
27
|
+
resolvableField?: boolean;
|
|
28
|
+
}[];
|
|
29
|
+
export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const GenericFunctions_1 = require("../../GenericFunctions");
|
|
7
|
+
const changeStatus_operation_1 = require("./changeStatus.operation");
|
|
8
|
+
const helpers_1 = require("./helpers");
|
|
9
|
+
const properties = [
|
|
10
|
+
(0, changeStatus_operation_1.remoteJidProperty)('Contact that receives the flow: phone number with country code or full JID (…@s.whatsapp.net, …@g.us, …@lid)'),
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Typebot URL',
|
|
13
|
+
name: 'typebotUrl',
|
|
14
|
+
type: 'string',
|
|
15
|
+
required: true,
|
|
16
|
+
default: '',
|
|
17
|
+
placeholder: 'https://typebot.example.com',
|
|
18
|
+
description: 'Base URL of the Typebot viewer (the server that serves the published bot)',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Typebot Public ID',
|
|
22
|
+
name: 'typebotPublicId',
|
|
23
|
+
type: 'string',
|
|
24
|
+
required: true,
|
|
25
|
+
default: '',
|
|
26
|
+
placeholder: 'my-typebot-abc123',
|
|
27
|
+
description: 'Public ID of the published Typebot (Share > the last part of the link)',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
displayName: 'Start Session',
|
|
31
|
+
name: 'typebotStartSession',
|
|
32
|
+
type: 'boolean',
|
|
33
|
+
default: false,
|
|
34
|
+
description: "Whether to start a tracked session so the contact's replies continue the flow: Evolution finds (or creates) a Typebot bot for this URL and public ID and deletes the contact's other bot sessions on this instance. When off, Evolution only sends the first messages of the flow.",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
displayName: 'Variables',
|
|
38
|
+
name: 'typebotVariables',
|
|
39
|
+
type: 'fixedCollection',
|
|
40
|
+
typeOptions: { multipleValues: true },
|
|
41
|
+
placeholder: 'Add Variable',
|
|
42
|
+
default: {},
|
|
43
|
+
description: 'Prefilled variables of the flow',
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Variable',
|
|
47
|
+
name: 'variable',
|
|
48
|
+
values: [
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Name',
|
|
51
|
+
name: 'name',
|
|
52
|
+
type: 'string',
|
|
53
|
+
default: '',
|
|
54
|
+
description: 'Variable name as defined in Typebot',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
displayName: 'Value',
|
|
58
|
+
name: 'value',
|
|
59
|
+
type: 'string',
|
|
60
|
+
default: '',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
exports.description = (0, n8n_workflow_1.updateDisplayOptions)({ show: { resource: ['chatbot'], operation: ['start'] } }, properties);
|
|
68
|
+
async function execute(itemIndex) {
|
|
69
|
+
var _a;
|
|
70
|
+
const node = this.getNode();
|
|
71
|
+
const instance = await GenericFunctions_1.resolveInstanceName.call(this, itemIndex);
|
|
72
|
+
const remoteJid = changeStatus_operation_1.getRemoteJid.call(this, itemIndex);
|
|
73
|
+
const url = String(this.getNodeParameter('typebotUrl', itemIndex, '')).trim();
|
|
74
|
+
const typebot = String(this.getNodeParameter('typebotPublicId', itemIndex, '')).trim();
|
|
75
|
+
if (!url || !typebot) {
|
|
76
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'Typebot URL and Typebot Public ID are required', {
|
|
77
|
+
itemIndex,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const variables = ((_a = this.getNodeParameter('typebotVariables.variable', itemIndex, [])) !== null && _a !== void 0 ? _a : [])
|
|
81
|
+
.map((variable) => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return ({
|
|
84
|
+
name: String((_a = variable.name) !== null && _a !== void 0 ? _a : '').trim(),
|
|
85
|
+
value: String((_b = variable.value) !== null && _b !== void 0 ? _b : ''),
|
|
86
|
+
});
|
|
87
|
+
})
|
|
88
|
+
.filter((variable) => variable.name);
|
|
89
|
+
const body = {
|
|
90
|
+
remoteJid,
|
|
91
|
+
url,
|
|
92
|
+
typebot,
|
|
93
|
+
startSession: this.getNodeParameter('typebotStartSession', itemIndex, false) === true,
|
|
94
|
+
};
|
|
95
|
+
if (variables.length > 0)
|
|
96
|
+
body.variables = variables;
|
|
97
|
+
let response;
|
|
98
|
+
try {
|
|
99
|
+
response = (await GenericFunctions_1.evolutionApiRequest.call(this, 'POST', `/typebot/start/${instance}`, body, {}, { itemIndex }));
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
throw (0, helpers_1.withChatbotHint)(error, 'Save the Typebot default settings first (Set Settings with Bot Type "Typebot").');
|
|
103
|
+
}
|
|
104
|
+
if (Object.keys(response).length === 0) {
|
|
105
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'Evolution API could not start the Typebot flow', {
|
|
106
|
+
itemIndex,
|
|
107
|
+
description: 'The Typebot server rejected the request or is unreachable from Evolution API. Check the Typebot URL and public ID (see the Evolution API logs).',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return response;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=start.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.operation.js","sourceRoot":"","sources":["../../../../../nodes/EvolutionApi/resources/chatbot/start.operation.ts"],"names":[],"mappings":";;;AAiFA,0BAuDC;AAvID,+CAAwE;AAExE,6DAAkF;AAClF,qEAA2E;AAC3E,uCAA4C;AAE5C,MAAM,UAAU,GAAsB;IACpC,IAAA,0CAAiB,EACf,8GAA8G,CAC/G;IACD;QACE,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE,2EAA2E;KACzF;IACD;QACE,WAAW,EAAE,mBAAmB;QAChC,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,mBAAmB;QAChC,WAAW,EAAE,wEAAwE;KACtF;IACD;QACE,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,WAAW,EACT,oRAAoR;KACvR;IACD;QACE,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;QACrC,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,iCAAiC;QAC9C,OAAO,EAAE;YACP;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE;oBACN;wBACE,WAAW,EAAE,MAAM;wBACnB,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,qCAAqC;qBACnD;oBACD;wBACE,WAAW,EAAE,OAAO;wBACpB,IAAI,EAAE,OAAO;wBACb,IA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MAAA,QAAQ,CAAC,KAAK,mCAAI,EAAE,CAAC;SACpC,CAAC,CAAA;KAAA,CAAC;SACF,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEvC,MAAM,IAAI,GAAgB;QACxB,SAAS;QAET,GAAG;QACH,OAAO;QACP,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,IAAI;KACtF,CAAC;IACF,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAErD,IAAI,QAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,QAAQ,GAAG,CAAC,MAAM,sCAAmB,CAAC,IAAI,CACxC,IAAI,EACJ,MAAM,EACN,kBAAkB,QAAQ,EAAE,EAC5B,IAAI,EACJ,EAAE,EACF,EAAE,SAAS,EAAE,CACd,CAAgB,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAA,yBAAe,EACnB,KAAK,EACL,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,iCAAkB,CAAC,IAAI,EAAE,gDAAgD,EAAE;YACnF,SAAS;YACT,WAAW,EACT,iJAAiJ;SACpJ,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const description: {
|
|
3
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
4
|
+
displayName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
7
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
8
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
9
|
+
description?: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
builderHint?: import("n8n-workflow").IParameterBuilderHint;
|
|
12
|
+
disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
13
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
isNodeSetting?: boolean;
|
|
16
|
+
noDataExpression?: boolean;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
19
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
20
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
21
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
22
|
+
requiresDataPath?: "single" | "multiple";
|
|
23
|
+
doNotInherit?: boolean;
|
|
24
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
25
|
+
ignoreValidationDuringExecution?: boolean;
|
|
26
|
+
allowArbitraryValues?: boolean;
|
|
27
|
+
resolvableField?: boolean;
|
|
28
|
+
}[];
|
|
29
|
+
export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const GenericFunctions_1 = require("../../GenericFunctions");
|
|
7
|
+
const create_operation_1 = require("./create.operation");
|
|
8
|
+
const fields_1 = require("./fields");
|
|
9
|
+
const get_operation_1 = require("./get.operation");
|
|
10
|
+
const helpers_1 = require("./helpers");
|
|
11
|
+
const only = (...botTypes) => ({ show: { '/botType': botTypes } });
|
|
12
|
+
const properties = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Update Fields',
|
|
15
|
+
name: 'updateFields',
|
|
16
|
+
type: 'collection',
|
|
17
|
+
placeholder: 'Add Field',
|
|
18
|
+
default: {},
|
|
19
|
+
description: 'Only the fields added here change; the node reads the bot first and resends every other field, because Evolution validates updates like a new bot',
|
|
20
|
+
options: (0, fields_1.sortOptions)([
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Description',
|
|
23
|
+
name: 'description',
|
|
24
|
+
type: 'string',
|
|
25
|
+
default: '',
|
|
26
|
+
description: 'Name shown for the bot in the Evolution manager and in bot lists',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
displayName: 'Enabled',
|
|
30
|
+
name: 'enabled',
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
default: true,
|
|
33
|
+
description: 'Whether the bot answers messages',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Trigger Type',
|
|
37
|
+
name: 'triggerType',
|
|
38
|
+
type: 'options',
|
|
39
|
+
options: fields_1.TRIGGER_TYPE_OPTIONS,
|
|
40
|
+
default: 'keyword',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Trigger Operator',
|
|
44
|
+
name: 'triggerOperator',
|
|
45
|
+
type: 'options',
|
|
46
|
+
options: fields_1.TRIGGER_OPERATOR_OPTIONS,
|
|
47
|
+
default: 'contains',
|
|
48
|
+
description: 'Used with Trigger Type "Keyword"',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Trigger Value',
|
|
52
|
+
name: 'triggerValue',
|
|
53
|
+
type: 'string',
|
|
54
|
+
default: '',
|
|
55
|
+
description: 'Keyword ("Keyword") or filter ("Advanced") that starts the bot',
|
|
56
|
+
},
|
|
57
|
+
...fields_1.BEHAVIOR_OPTIONS,
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Typebot URL',
|
|
60
|
+
name: 'typebotUrl',
|
|
61
|
+
type: 'string',
|
|
62
|
+
default: '',
|
|
63
|
+
displayOptions: only('typebot'),
|
|
64
|
+
description: 'Base URL of the Typebot viewer',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Typebot Public ID',
|
|
68
|
+
name: 'typebotPublicId',
|
|
69
|
+
type: 'string',
|
|
70
|
+
default: '',
|
|
71
|
+
displayOptions: only('typebot'),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: 'OpenAI Credential Name or ID',
|
|
75
|
+
name: 'openaiCredsId',
|
|
76
|
+
type: 'options',
|
|
77
|
+
typeOptions: {
|
|
78
|
+
loadOptionsMethod: 'chatbotGetOpenaiCredentials',
|
|
79
|
+
loadOptionsDependsOn: ['instanceName.value'],
|
|
80
|
+
},
|
|
81
|
+
default: '',
|
|
82
|
+
displayOptions: only('openai'),
|
|
83
|
+
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
displayName: 'OpenAI Bot Type',
|
|
87
|
+
name: 'openaiBotType',
|
|
88
|
+
type: 'options',
|
|
89
|
+
options: create_operation_1.OPENAI_BOT_TYPE_OPTIONS,
|
|
90
|
+
default: 'chatCompletion',
|
|
91
|
+
displayOptions: only('openai'),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Assistant ID',
|
|
95
|
+
name: 'assistantId',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
displayOptions: only('openai'),
|
|
99
|
+
description: 'ID of the OpenAI Assistant (OpenAI Bot Type "Assistant")',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
displayName: 'Model',
|
|
103
|
+
name: 'model',
|
|
104
|
+
type: 'string',
|
|
105
|
+
default: '',
|
|
106
|
+
displayOptions: only('openai'),
|
|
107
|
+
description: 'OpenAI model ID (OpenAI Bot Type "Chat Completion")',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
displayName: 'Max Tokens',
|
|
111
|
+
name: 'maxTokens',
|
|
112
|
+
type: 'number',
|
|
113
|
+
typeOptions: { minValue: 1 },
|
|
114
|
+
default: 500,
|
|
115
|
+
displayOptions: only('openai'),
|
|
116
|
+
description: 'Maximum number of tokens of each reply (OpenAI Bot Type "Chat Completion")',
|
|
117
|
+
},
|
|
118
|
+
...fields_1.OPENAI_MESSAGE_OPTIONS,
|
|
119
|
+
{
|
|
120
|
+
displayName: 'Dify Bot Type',
|
|
121
|
+
name: 'difyBotType',
|
|
122
|
+
type: 'options',
|
|
123
|
+
options: create_operation_1.DIFY_BOT_TYPE_OPTIONS,
|
|
124
|
+
default: 'chatBot',
|
|
125
|
+
displayOptions: only('dify'),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
displayName: 'API URL',
|
|
129
|
+
name: 'apiUrl',
|
|
130
|
+
type: 'string',
|
|
131
|
+
default: '',
|
|
132
|
+
displayOptions: only('dify', 'flowise', 'evolutionBot'),
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
displayName: 'API Key',
|
|
136
|
+
name: 'apiKey',
|
|
137
|
+
type: 'string',
|
|
138
|
+
typeOptions: { password: true },
|
|
139
|
+
default: '',
|
|
140
|
+
displayOptions: only('dify', 'flowise', 'evolutionBot', 'evoai'),
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
displayName: 'Agent URL',
|
|
144
|
+
name: 'agentUrl',
|
|
145
|
+
type: 'string',
|
|
146
|
+
default: '',
|
|
147
|
+
displayOptions: only('evoai'),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Webhook URL',
|
|
151
|
+
name: 'webhookUrl',
|
|
152
|
+
type: 'string',
|
|
153
|
+
default: '',
|
|
154
|
+
displayOptions: only('n8n'),
|
|
155
|
+
description: 'Production URL of the n8n Webhook node that receives the messages',
|
|
156
|
+
},
|
|
157
|
+
...fields_1.N8N_AUTH_OPTIONS,
|
|
158
|
+
]),
|
|
159
|
+
},
|
|
160
|
+
helpers_1.secretsOptionsProperty,
|
|
161
|
+
];
|
|
162
|
+
exports.description = (0, n8n_workflow_1.updateDisplayOptions)({ show: { resource: ['chatbot'], operation: ['update'] } }, properties);
|
|
163
|
+
async function execute(itemIndex) {
|
|
164
|
+
const node = this.getNode();
|
|
165
|
+
const instance = await GenericFunctions_1.resolveInstanceName.call(this, itemIndex);
|
|
166
|
+
const botType = (0, helpers_1.parseBotType)(node, this.getNodeParameter('botType', itemIndex), itemIndex);
|
|
167
|
+
const botId = String(this.getNodeParameter('botId', itemIndex, '', { extractValue: true })).trim();
|
|
168
|
+
const changes = this.getNodeParameter('updateFields', itemIndex, {});
|
|
169
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
170
|
+
if (Object.keys(changes).length === 0) {
|
|
171
|
+
throw new n8n_workflow_1.NodeOperationError(node, 'Add at least one field to update', {
|
|
172
|
+
itemIndex,
|
|
173
|
+
description: 'Use "Update Fields" to choose what to change in the bot.',
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const current = await get_operation_1.fetchBot.call(this, itemIndex, instance);
|
|
177
|
+
const body = {
|
|
178
|
+
...(0, helpers_1.pickBotBody)(current, botType.value),
|
|
179
|
+
...(0, helpers_1.collectBotFields)(changes, botType.value),
|
|
180
|
+
};
|
|
181
|
+
(0, helpers_1.validateBotBody)(node, body, botType.value, itemIndex);
|
|
182
|
+
let bot;
|
|
183
|
+
try {
|
|
184
|
+
bot = (await GenericFunctions_1.evolutionApiRequest.call(this, 'PUT', `/${botType.value}/update/${(0, GenericFunctions_1.encodePathSegment)(botId, 'Bot ID')}/${instance}`, body, {}, { itemIndex }));
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
throw (0, helpers_1.withChatbotHint)(error, `Evolution rejects a second enabled "All" ${botType.info.label} bot, a trigger used by another bot and a duplicate bot (same URL and key).`);
|
|
188
|
+
}
|
|
189
|
+
return options.includeSecrets === true ? bot : (0, helpers_1.redactBotSecrets)(bot);
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=update.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../../nodes/EvolutionApi/resources/chatbot/update.operation.ts"],"names":[],"mappings":";;;AAkMA,0BAyCC;AA1OD,+CAAwE;AAExE,6DAIgC;AAChC,yDAAoF;AACpF,qCAOkB;AAClB,mDAA2C;AAC3C,uCAQmB;AAEnB,MAAM,IAAI,GAAG,CAAC,GAAG,QAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;AAE7E,MAAM,UAAU,GAAsB;IACpC;QACE,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,EAAE;QACX,WAAW,EACT,mJAAmJ;QACrJ,OAAO,EAAE,IAAA,oBAAW,EAAC;YACnB;gBACE,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,kEAAkE;aAChF;YACD;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,kCAAkC;aAChD;YACD;gBACE,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,6BAAoB;gBAC7B,OAAO,EAAE,SAAS;aACnB;YACD;gBACE,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,iCAAwB;gBACjC,OAAO,EAAE,UAA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