n8n-nodes-stevomanager 1.0.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.md +19 -0
- package/README.md +254 -0
- package/dist/credentials/StevoManager.credentials.d.ts +9 -0
- package/dist/credentials/StevoManager.credentials.js +50 -0
- package/dist/credentials/StevoManager.credentials.js.map +1 -0
- package/dist/credentials/StevoManagerApi.credentials.d.ts +9 -0
- package/dist/credentials/StevoManagerApi.credentials.js +50 -0
- package/dist/credentials/StevoManagerApi.credentials.js.map +1 -0
- package/dist/nodes/StevoManager/StevoManager.node.d.ts +5 -0
- package/dist/nodes/StevoManager/StevoManager.node.js +54 -0
- package/dist/nodes/StevoManager/StevoManager.node.js.map +1 -0
- package/dist/nodes/StevoManager/StevoManager.node.json +21 -0
- package/dist/nodes/StevoManager/execute/chat/blockContact.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/blockContact.js +51 -0
- package/dist/nodes/StevoManager/execute/chat/blockContact.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/checkNumber.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/checkNumber.js +50 -0
- package/dist/nodes/StevoManager/execute/chat/checkNumber.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/deleteMessage.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/deleteMessage.js +62 -0
- package/dist/nodes/StevoManager/execute/chat/deleteMessage.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/fetchProfilePicture.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/fetchProfilePicture.js +49 -0
- package/dist/nodes/StevoManager/execute/chat/fetchProfilePicture.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/findChats.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/findChats.js +57 -0
- package/dist/nodes/StevoManager/execute/chat/findChats.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/findContacts.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/findContacts.js +55 -0
- package/dist/nodes/StevoManager/execute/chat/findContacts.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/findMessages.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/findMessages.js +57 -0
- package/dist/nodes/StevoManager/execute/chat/findMessages.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/findStatusMessages.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/findStatusMessages.js +58 -0
- package/dist/nodes/StevoManager/execute/chat/findStatusMessages.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/getMediaBase64.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/getMediaBase64.js +55 -0
- package/dist/nodes/StevoManager/execute/chat/getMediaBase64.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/manageArchive.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/manageArchive.js +60 -0
- package/dist/nodes/StevoManager/execute/chat/manageArchive.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/markChatUnread.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/markChatUnread.js +58 -0
- package/dist/nodes/StevoManager/execute/chat/markChatUnread.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/readMessages.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/readMessages.js +57 -0
- package/dist/nodes/StevoManager/execute/chat/readMessages.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/sendPresence.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/sendPresence.js +53 -0
- package/dist/nodes/StevoManager/execute/chat/sendPresence.js.map +1 -0
- package/dist/nodes/StevoManager/execute/chat/updateMessage.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/chat/updateMessage.js +57 -0
- package/dist/nodes/StevoManager/execute/chat/updateMessage.js.map +1 -0
- package/dist/nodes/StevoManager/execute/events/setProxy.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/events/setProxy.js +63 -0
- package/dist/nodes/StevoManager/execute/events/setProxy.js.map +1 -0
- package/dist/nodes/StevoManager/execute/events/setRabbitMQ.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/events/setRabbitMQ.js +83 -0
- package/dist/nodes/StevoManager/execute/events/setRabbitMQ.js.map +1 -0
- package/dist/nodes/StevoManager/execute/events/setWebhook.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/events/setWebhook.js +89 -0
- package/dist/nodes/StevoManager/execute/events/setWebhook.js.map +1 -0
- package/dist/nodes/StevoManager/execute/evolutionRequest.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/evolutionRequest.js +18 -0
- package/dist/nodes/StevoManager/execute/evolutionRequest.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/createGroup.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/createGroup.js +54 -0
- package/dist/nodes/StevoManager/execute/groups/createGroup.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/fetchGroups.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/fetchGroups.js +69 -0
- package/dist/nodes/StevoManager/execute/groups/fetchGroups.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/fetchInviteCode.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/fetchInviteCode.js +45 -0
- package/dist/nodes/StevoManager/execute/groups/fetchInviteCode.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/findParticipants.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/findParticipants.js +45 -0
- package/dist/nodes/StevoManager/execute/groups/findParticipants.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/joinGroup.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/joinGroup.js +45 -0
- package/dist/nodes/StevoManager/execute/groups/joinGroup.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/leaveGroup.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/leaveGroup.js +45 -0
- package/dist/nodes/StevoManager/execute/groups/leaveGroup.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/revokeInviteCode.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/revokeInviteCode.js +45 -0
- package/dist/nodes/StevoManager/execute/groups/revokeInviteCode.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/sendInviteLink.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/sendInviteLink.js +54 -0
- package/dist/nodes/StevoManager/execute/groups/sendInviteLink.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/toggleEphemeral.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/toggleEphemeral.js +50 -0
- package/dist/nodes/StevoManager/execute/groups/toggleEphemeral.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupDescription.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupDescription.js +50 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupDescription.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupName.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupName.js +50 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupName.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupPicture.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupPicture.js +50 -0
- package/dist/nodes/StevoManager/execute/groups/updateGroupPicture.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/updateParticipants.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/updateParticipants.js +53 -0
- package/dist/nodes/StevoManager/execute/groups/updateParticipants.js.map +1 -0
- package/dist/nodes/StevoManager/execute/groups/updateSettings.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/groups/updateSettings.js +50 -0
- package/dist/nodes/StevoManager/execute/groups/updateSettings.js.map +1 -0
- package/dist/nodes/StevoManager/execute/index.d.ts +8 -0
- package/dist/nodes/StevoManager/execute/index.js +148 -0
- package/dist/nodes/StevoManager/execute/index.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/createInstanceBasic.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/instance/createInstanceBasic.js +104 -0
- package/dist/nodes/StevoManager/execute/instance/createInstanceBasic.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/deleteInstance.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/instance/deleteInstance.js +48 -0
- package/dist/nodes/StevoManager/execute/instance/deleteInstance.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/fetchInstances.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/instance/fetchInstances.js +52 -0
- package/dist/nodes/StevoManager/execute/instance/fetchInstances.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/instanceConnect.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/instance/instanceConnect.js +56 -0
- package/dist/nodes/StevoManager/execute/instance/instanceConnect.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/instanceSettings.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/instance/instanceSettings.js +71 -0
- package/dist/nodes/StevoManager/execute/instance/instanceSettings.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/logoutInstance.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/instance/logoutInstance.js +52 -0
- package/dist/nodes/StevoManager/execute/instance/logoutInstance.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/restartInstance.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/instance/restartInstance.js +48 -0
- package/dist/nodes/StevoManager/execute/instance/restartInstance.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/setPresence.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/instance/setPresence.js +55 -0
- package/dist/nodes/StevoManager/execute/instance/setPresence.js.map +1 -0
- package/dist/nodes/StevoManager/execute/instance/setProxy.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/instance/setProxy.js +89 -0
- package/dist/nodes/StevoManager/execute/instance/setProxy.js.map +1 -0
- package/dist/nodes/StevoManager/execute/integrations/setChatwoot.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/integrations/setChatwoot.js +108 -0
- package/dist/nodes/StevoManager/execute/integrations/setChatwoot.js.map +1 -0
- package/dist/nodes/StevoManager/execute/integrations/setDifyBot.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/integrations/setDifyBot.js +169 -0
- package/dist/nodes/StevoManager/execute/integrations/setDifyBot.js.map +1 -0
- package/dist/nodes/StevoManager/execute/integrations/setEvolutionBot.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/integrations/setEvolutionBot.js +178 -0
- package/dist/nodes/StevoManager/execute/integrations/setEvolutionBot.js.map +1 -0
- package/dist/nodes/StevoManager/execute/integrations/setFlowiseBot.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/integrations/setFlowiseBot.js +178 -0
- package/dist/nodes/StevoManager/execute/integrations/setFlowiseBot.js.map +1 -0
- package/dist/nodes/StevoManager/execute/integrations/setTypebot.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/integrations/setTypebot.js +194 -0
- package/dist/nodes/StevoManager/execute/integrations/setTypebot.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendAudio.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendAudio.js +82 -0
- package/dist/nodes/StevoManager/execute/messages/sendAudio.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendButtons.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendButtons.js +35 -0
- package/dist/nodes/StevoManager/execute/messages/sendButtons.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendContact.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendContact.js +83 -0
- package/dist/nodes/StevoManager/execute/messages/sendContact.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendDocument.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendDocument.js +95 -0
- package/dist/nodes/StevoManager/execute/messages/sendDocument.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendImage.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendImage.js +95 -0
- package/dist/nodes/StevoManager/execute/messages/sendImage.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendList.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendList.js +35 -0
- package/dist/nodes/StevoManager/execute/messages/sendList.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendPix.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendPix.js +35 -0
- package/dist/nodes/StevoManager/execute/messages/sendPix.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendPoll.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendPoll.js +89 -0
- package/dist/nodes/StevoManager/execute/messages/sendPoll.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendReaction.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendReaction.js +74 -0
- package/dist/nodes/StevoManager/execute/messages/sendReaction.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendStories.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendStories.js +35 -0
- package/dist/nodes/StevoManager/execute/messages/sendStories.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendText.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendText.js +88 -0
- package/dist/nodes/StevoManager/execute/messages/sendText.js.map +1 -0
- package/dist/nodes/StevoManager/execute/messages/sendVideo.d.ts +2 -0
- package/dist/nodes/StevoManager/execute/messages/sendVideo.js +95 -0
- package/dist/nodes/StevoManager/execute/messages/sendVideo.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/fetchBusinessProfile.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/fetchBusinessProfile.js +49 -0
- package/dist/nodes/StevoManager/execute/profile/fetchBusinessProfile.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/fetchPrivacySettings.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/fetchPrivacySettings.js +44 -0
- package/dist/nodes/StevoManager/execute/profile/fetchPrivacySettings.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/fetchProfile.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/fetchProfile.js +49 -0
- package/dist/nodes/StevoManager/execute/profile/fetchProfile.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/removeProfilePicture.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/removeProfilePicture.js +44 -0
- package/dist/nodes/StevoManager/execute/profile/removeProfilePicture.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/updatePrivacySettings.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/updatePrivacySettings.js +59 -0
- package/dist/nodes/StevoManager/execute/profile/updatePrivacySettings.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfileName.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfileName.js +49 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfileName.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfilePicture.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfilePicture.js +49 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfilePicture.js.map +1 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfileStatus.d.ts +27 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfileStatus.js +49 -0
- package/dist/nodes/StevoManager/execute/profile/updateProfileStatus.js.map +1 -0
- package/dist/nodes/StevoManager/properties/chat.fields.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/chat.fields.js +575 -0
- package/dist/nodes/StevoManager/properties/chat.fields.js.map +1 -0
- package/dist/nodes/StevoManager/properties/chat.operations.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/chat.operations.js +102 -0
- package/dist/nodes/StevoManager/properties/chat.operations.js.map +1 -0
- package/dist/nodes/StevoManager/properties/events.fields.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/events.fields.js +336 -0
- package/dist/nodes/StevoManager/properties/events.fields.js.map +1 -0
- package/dist/nodes/StevoManager/properties/events.operations.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/events.operations.js +30 -0
- package/dist/nodes/StevoManager/properties/events.operations.js.map +1 -0
- package/dist/nodes/StevoManager/properties/groups.fields.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/groups.fields.js +481 -0
- package/dist/nodes/StevoManager/properties/groups.fields.js.map +1 -0
- package/dist/nodes/StevoManager/properties/groups.operations.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/groups.operations.js +102 -0
- package/dist/nodes/StevoManager/properties/groups.operations.js.map +1 -0
- package/dist/nodes/StevoManager/properties/index.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/index.js +72 -0
- package/dist/nodes/StevoManager/properties/index.js.map +1 -0
- package/dist/nodes/StevoManager/properties/instances.fields.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/instances.fields.js +798 -0
- package/dist/nodes/StevoManager/properties/instances.fields.js.map +1 -0
- package/dist/nodes/StevoManager/properties/instances.operations.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/instances.operations.js +72 -0
- package/dist/nodes/StevoManager/properties/instances.operations.js.map +1 -0
- package/dist/nodes/StevoManager/properties/integrations.fields.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/integrations.fields.js +1697 -0
- package/dist/nodes/StevoManager/properties/integrations.fields.js.map +1 -0
- package/dist/nodes/StevoManager/properties/integrations.operations.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/integrations.operations.js +48 -0
- package/dist/nodes/StevoManager/properties/integrations.operations.js.map +1 -0
- package/dist/nodes/StevoManager/properties/messages.fields.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/messages.fields.js +1628 -0
- package/dist/nodes/StevoManager/properties/messages.fields.js.map +1 -0
- package/dist/nodes/StevoManager/properties/messages.operations.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/messages.operations.js +90 -0
- package/dist/nodes/StevoManager/properties/messages.operations.js.map +1 -0
- package/dist/nodes/StevoManager/properties/profile.fields.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/profile.fields.js +241 -0
- package/dist/nodes/StevoManager/properties/profile.fields.js.map +1 -0
- package/dist/nodes/StevoManager/properties/profile.operations.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/profile.operations.js +66 -0
- package/dist/nodes/StevoManager/properties/profile.operations.js.map +1 -0
- package/dist/nodes/StevoManager/properties/resources.d.ts +2 -0
- package/dist/nodes/StevoManager/properties/resources.js +41 -0
- package/dist/nodes/StevoManager/properties/resources.js.map +1 -0
- package/dist/nodes/StevoManager/stevomanager.png +0 -0
- package/dist/package.json +69 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +0 -0
- package/package.json +69 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setTypebot = setTypebot;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
6
|
+
async function setTypebot(ef) {
|
|
7
|
+
try {
|
|
8
|
+
const instanceName = ef.getNodeParameter('instanceName', 0);
|
|
9
|
+
const resourceForTypebot = ef.getNodeParameter('resourceForTypebot', 0);
|
|
10
|
+
let options;
|
|
11
|
+
if (resourceForTypebot === 'createTypebot') {
|
|
12
|
+
const url = ef.getNodeParameter('url', 0);
|
|
13
|
+
const typebot = ef.getNodeParameter('typebot', 0);
|
|
14
|
+
const triggerType = ef.getNodeParameter('triggerType', 0);
|
|
15
|
+
const triggerOperator = ef.getNodeParameter('triggerOperator', 0);
|
|
16
|
+
const triggerValue = ef.getNodeParameter('triggerValue', 0);
|
|
17
|
+
const expire = ef.getNodeParameter('expire', 0);
|
|
18
|
+
const keywordFinish = ef.getNodeParameter('keywordFinish', 0);
|
|
19
|
+
const delayMessage = ef.getNodeParameter('delayMessage', 0);
|
|
20
|
+
const unknownMessage = ef.getNodeParameter('unknownMessage', 0);
|
|
21
|
+
const listeningFromMe = ef.getNodeParameter('listeningFromMe', 0);
|
|
22
|
+
const stopBotFromMe = ef.getNodeParameter('stopBotFromMe', 0);
|
|
23
|
+
const keepOpen = ef.getNodeParameter('keepOpen', 0);
|
|
24
|
+
const debounceTime = ef.getNodeParameter('debounceTime', 0);
|
|
25
|
+
const body = {
|
|
26
|
+
enabled: true,
|
|
27
|
+
url,
|
|
28
|
+
typebot,
|
|
29
|
+
triggerType,
|
|
30
|
+
triggerOperator,
|
|
31
|
+
triggerValue,
|
|
32
|
+
expire,
|
|
33
|
+
keywordFinish,
|
|
34
|
+
delayMessage,
|
|
35
|
+
unknownMessage,
|
|
36
|
+
listeningFromMe,
|
|
37
|
+
stopBotFromMe,
|
|
38
|
+
keepOpen,
|
|
39
|
+
debounceTime
|
|
40
|
+
};
|
|
41
|
+
options = {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
uri: `/typebot/create/${instanceName}`,
|
|
44
|
+
body,
|
|
45
|
+
json: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else if (resourceForTypebot === 'findTypebot') {
|
|
49
|
+
const typebotId = ef.getNodeParameter('typebotId', 0);
|
|
50
|
+
options = {
|
|
51
|
+
method: 'GET',
|
|
52
|
+
uri: typebotId
|
|
53
|
+
? `/typebot/fetch/${typebotId}/${instanceName}`
|
|
54
|
+
: `/typebot/find/${instanceName}`,
|
|
55
|
+
json: true,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else if (resourceForTypebot === 'updateTypebot') {
|
|
59
|
+
const typebotId = ef.getNodeParameter('typebotId', 0);
|
|
60
|
+
const url = ef.getNodeParameter('url', 0);
|
|
61
|
+
const typebot = ef.getNodeParameter('typebot', 0);
|
|
62
|
+
const expire = ef.getNodeParameter('expire', 0);
|
|
63
|
+
const keywordFinish = ef.getNodeParameter('keywordFinish', 0);
|
|
64
|
+
const delayMessage = ef.getNodeParameter('delayMessage', 0);
|
|
65
|
+
const unknownMessage = ef.getNodeParameter('unknownMessage', 0);
|
|
66
|
+
const listeningFromMe = ef.getNodeParameter('listeningFromMe', 0);
|
|
67
|
+
const stopBotFromMe = ef.getNodeParameter('stopBotFromMe', 0);
|
|
68
|
+
const keepOpen = ef.getNodeParameter('keepOpen', 0);
|
|
69
|
+
const debounceTime = ef.getNodeParameter('debounceTime', 0);
|
|
70
|
+
const triggerType = ef.getNodeParameter('triggerType', 0);
|
|
71
|
+
const triggerOperator = ef.getNodeParameter('triggerOperator', 0);
|
|
72
|
+
const triggerValue = ef.getNodeParameter('triggerValue', 0);
|
|
73
|
+
const body = {
|
|
74
|
+
enabled: true,
|
|
75
|
+
url,
|
|
76
|
+
typebot,
|
|
77
|
+
expire,
|
|
78
|
+
keywordFinish,
|
|
79
|
+
delayMessage,
|
|
80
|
+
unknownMessage,
|
|
81
|
+
listeningFromMe,
|
|
82
|
+
stopBotFromMe,
|
|
83
|
+
keepOpen,
|
|
84
|
+
debounceTime,
|
|
85
|
+
triggerType,
|
|
86
|
+
triggerOperator,
|
|
87
|
+
triggerValue
|
|
88
|
+
};
|
|
89
|
+
options = {
|
|
90
|
+
method: 'PUT',
|
|
91
|
+
uri: `/typebot/update/${typebotId}/${instanceName}`,
|
|
92
|
+
body,
|
|
93
|
+
json: true,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else if (resourceForTypebot === 'deleteTypebot') {
|
|
97
|
+
const typebotId = ef.getNodeParameter('typebotId', 0);
|
|
98
|
+
options = {
|
|
99
|
+
method: 'DELETE',
|
|
100
|
+
uri: `/typebot/delete/${typebotId}/${instanceName}`,
|
|
101
|
+
json: true,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
else if (resourceForTypebot === 'fetchSessionsTypebot') {
|
|
105
|
+
const typebotId = ef.getNodeParameter('typebotId', 0);
|
|
106
|
+
options = {
|
|
107
|
+
method: 'GET',
|
|
108
|
+
uri: `/typebot/fetchSessions/${typebotId}/${instanceName}`,
|
|
109
|
+
json: true,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
else if (resourceForTypebot === 'changeStatusTypebot') {
|
|
113
|
+
const remoteJid = ef.getNodeParameter('remoteJid', 0);
|
|
114
|
+
const status = ef.getNodeParameter('status', 0);
|
|
115
|
+
options = {
|
|
116
|
+
method: 'POST',
|
|
117
|
+
uri: `/typebot/changeStatus/${instanceName}`,
|
|
118
|
+
body: {
|
|
119
|
+
remoteJid,
|
|
120
|
+
status,
|
|
121
|
+
},
|
|
122
|
+
json: true,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
else if (resourceForTypebot === 'startTypebot') {
|
|
126
|
+
const url = ef.getNodeParameter('url', 0);
|
|
127
|
+
const typebot = ef.getNodeParameter('typebot', 0);
|
|
128
|
+
const remoteJid = ef.getNodeParameter('remoteJid', 0);
|
|
129
|
+
const startSession = ef.getNodeParameter('startSession', 0);
|
|
130
|
+
const variables = ef.getNodeParameter('variables', 0);
|
|
131
|
+
const body = {
|
|
132
|
+
url,
|
|
133
|
+
typebot,
|
|
134
|
+
remoteJid,
|
|
135
|
+
startSession,
|
|
136
|
+
...((variables === null || variables === void 0 ? void 0 : variables.length) && { variables }),
|
|
137
|
+
};
|
|
138
|
+
options = {
|
|
139
|
+
method: 'POST',
|
|
140
|
+
uri: `/typebot/start/${instanceName}`,
|
|
141
|
+
body,
|
|
142
|
+
json: true,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const errorData = {
|
|
147
|
+
success: false,
|
|
148
|
+
error: {
|
|
149
|
+
message: 'Operação do Typebot não reconhecida',
|
|
150
|
+
details: 'A operação solicitada não é válida para o recurso do Typebot',
|
|
151
|
+
code: 'INVALID_OPERATION',
|
|
152
|
+
timestamp: new Date().toISOString(),
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), errorData.error.message, {
|
|
156
|
+
message: errorData.error.message,
|
|
157
|
+
description: errorData.error.details,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, options);
|
|
161
|
+
return {
|
|
162
|
+
json: {
|
|
163
|
+
success: true,
|
|
164
|
+
data: response,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
const errorData = {
|
|
170
|
+
success: false,
|
|
171
|
+
error: {
|
|
172
|
+
message: error.message.includes('Could not get parameter')
|
|
173
|
+
? 'Parâmetros inválidos ou ausentes'
|
|
174
|
+
: 'Erro ao configurar Typebot',
|
|
175
|
+
details: error.message.includes('Could not get parameter')
|
|
176
|
+
? 'Verifique se todos os campos obrigatórios foram preenchidos corretamente'
|
|
177
|
+
: error.message,
|
|
178
|
+
code: error.code || 'UNKNOWN_ERROR',
|
|
179
|
+
timestamp: new Date().toISOString(),
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
if (!ef.continueOnFail()) {
|
|
183
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), error.message, {
|
|
184
|
+
message: errorData.error.message,
|
|
185
|
+
description: errorData.error.details,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
json: errorData,
|
|
190
|
+
error: errorData,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=setTypebot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTypebot.js","sourceRoot":"","sources":["../../../../../nodes/StevoManager/execute/integrations/setTypebot.ts"],"names":[],"mappings":";;AAQA,gCAkMC;AA1MD,+CAKsB;AACtB,0DAAuD;AAEhD,KAAK,UAAU,UAAU,CAAC,EAAqB;IACrD,IAAI,CAAC;QACJ,MAAM,YAAY,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAA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CAAC,CAAC,0EAA0E;oBAC5E,CAAC,CAAC,KAAK,CAAC,OAAO;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,eAAe;gBACnC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACnC;SACD,CAAC;QAEF,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC;YAC1B,MAAM,IAAI,iCAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE;gBACzD,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,OAAO;gBAChC,WAAW,EAAE,SAAS,CAAC,KAAK,CAAC,OAAO;aACpC,CAAC,CAAC;QACJ,CAAC;QAED,OAAO;YACN,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;SAChB,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendAudio = sendAudio;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
6
|
+
async function sendAudio(ef) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const items = ef.getInputData();
|
|
9
|
+
const returnData = [];
|
|
10
|
+
for (let i = 0; i < items.length; i++) {
|
|
11
|
+
try {
|
|
12
|
+
const remoteJid = ef.getNodeParameter('remoteJid', i);
|
|
13
|
+
const media = ef.getNodeParameter('media', i);
|
|
14
|
+
const fileName = ef.getNodeParameter('fileName', i, 'audio.mp3') || 'audio.mp3';
|
|
15
|
+
const options = ef.getNodeParameter('options_message', i, {});
|
|
16
|
+
const body = {
|
|
17
|
+
number: remoteJid,
|
|
18
|
+
type: 'audio',
|
|
19
|
+
url: media,
|
|
20
|
+
filename: fileName,
|
|
21
|
+
};
|
|
22
|
+
if (options.delay) {
|
|
23
|
+
body.delay = options.delay;
|
|
24
|
+
}
|
|
25
|
+
if ((_b = (_a = options.quoted) === null || _a === void 0 ? void 0 : _a.messageQuoted) === null || _b === void 0 ? void 0 : _b.messageId) {
|
|
26
|
+
body.quoted = {
|
|
27
|
+
messageId: options.quoted.messageQuoted.messageId,
|
|
28
|
+
};
|
|
29
|
+
if (options.quoted.messageQuoted.participant) {
|
|
30
|
+
body.quoted.participant = options.quoted.messageQuoted.participant;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const requestOptions = {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
headers: {
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
},
|
|
38
|
+
uri: '/send/media',
|
|
39
|
+
body,
|
|
40
|
+
json: true,
|
|
41
|
+
};
|
|
42
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, requestOptions);
|
|
43
|
+
returnData.push({
|
|
44
|
+
json: {
|
|
45
|
+
success: true,
|
|
46
|
+
data: response,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const errorMessage = error.message.includes('Could not get parameter')
|
|
52
|
+
? 'Parâmetros inválidos ou ausentes'
|
|
53
|
+
: 'Erro ao enviar áudio';
|
|
54
|
+
const errorDetails = error.message.includes('Could not get parameter')
|
|
55
|
+
? 'Verifique se todos os campos obrigatórios foram preenchidos corretamente'
|
|
56
|
+
: error.message;
|
|
57
|
+
if (!ef.continueOnFail()) {
|
|
58
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
59
|
+
message: errorMessage,
|
|
60
|
+
description: errorDetails,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
returnData.push({
|
|
64
|
+
json: {
|
|
65
|
+
success: false,
|
|
66
|
+
error: {
|
|
67
|
+
message: errorMessage,
|
|
68
|
+
details: errorDetails,
|
|
69
|
+
code: error.code || 'UNKNOWN_ERROR',
|
|
70
|
+
timestamp: new Date().toISOString(),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
error: new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
74
|
+
message: errorMessage,
|
|
75
|
+
description: errorDetails,
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return returnData;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=sendAudio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendAudio.js","sourceRoot":"","sources":["../../../../../nodes/StevoManager/execute/messages/sendAudio.ts"],"names":[],"mappings":";;AASA,8BA4FC;AArGD,+CAMsB;AACtB,0DAAuD;AAEhD,KAAK,UAAU,SAAS,CAAC,EAAqB;;IACpD,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC;IAChC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC;YACJ,MAAM,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;YAChE,MAAM,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAW,CAAC;YACxD,MAAM,QAAQ,GAAI,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,EAAE,WAAW,CAAY,IAAI,WAAW,CAAC;YAE5F,MAAM,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,EAAE,EAAE,CAQ3D,CAAC;YAEF,MAAM,IAAI,GAAQ;gBACjB,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,KAAK;gBACV,QAAQ,EAAE,QAAQ;aAClB,CAAC;YAEF,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;g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C,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE;oBACxD,OAAO,EAAE,YAAY;oBACrB,WAAW,EAAE,YAAY;iBACzB,CAAC,CAAC;YACJ,CAAC;YAED,UAAU,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE;wBACN,OAAO,EAAE,YAAY;wBACrB,OAAO,EAAE,YAAY;wBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,eAAe;wBACnC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;qBACnC;iBACD;gBACD,KAAK,EAAE,IAAI,iCAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE;oBACzD,OAAO,EAAE,YAAY;oBACrB,WAAW,EAAE,YAAY;iBACzB,CAAC;aACF,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendButtons = sendButtons;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
async function sendButtons(ef) {
|
|
6
|
+
const items = ef.getInputData();
|
|
7
|
+
const returnData = [];
|
|
8
|
+
for (let i = 0; i < items.length; i++) {
|
|
9
|
+
const errorMessage = 'Funcionalidade não disponível';
|
|
10
|
+
const errorDetails = 'O envio de botões não é suportado pela API StevoManager';
|
|
11
|
+
if (!ef.continueOnFail()) {
|
|
12
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
13
|
+
message: errorMessage,
|
|
14
|
+
description: errorDetails,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
returnData.push({
|
|
18
|
+
json: {
|
|
19
|
+
success: false,
|
|
20
|
+
error: {
|
|
21
|
+
message: errorMessage,
|
|
22
|
+
details: errorDetails,
|
|
23
|
+
code: 'NOT_SUPPORTED',
|
|
24
|
+
timestamp: new Date().toISOString(),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
error: new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
28
|
+
message: errorMessage,
|
|
29
|
+
description: errorDetails,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return returnData;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=sendButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendButtons.js","sourceRoot":"","sources":["../../../../../nodes/StevoManager/execute/messages/sendButtons.ts"],"names":[],"mappings":";;AAQA,kCAiCC;AAzCD,+CAIsB;AAIf,KAAK,UAAU,WAAW,CAAC,EAAqB;IACtD,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC;IAChC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,YAAY,GAAG,+BAA+B,CAAC;QACrD,MAAM,YAAY,GAAG,yDAAyD,CAAC;QAE/E,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC;YAC1B,MAAM,IAAI,iCAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE;gBACxD,OAAO,EAAE,YAAY;gBACrB,WAAW,EAAE,YAAY;aACzB,CAAC,CAAC;QACJ,CAAC;QAED,UAAU,CAAC,IAAI,CAAC;YACf,IAAI,EAAE;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACN,OAAO,EAAE,YAAY;oBACrB,OAAO,EAAE,YAAY;oBACrB,IAAI,EAAE,eAAe;oBACrB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACnC;aACD;YACD,KAAK,EAAE,IAAI,iCAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE;gBACzD,OAAO,EAAE,YAAY;gBACrB,WAAW,EAAE,YAAY;aACzB,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendContact = sendContact;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
6
|
+
async function sendContact(ef) {
|
|
7
|
+
const items = ef.getInputData();
|
|
8
|
+
const returnData = [];
|
|
9
|
+
for (let i = 0; i < items.length; i++) {
|
|
10
|
+
try {
|
|
11
|
+
const remoteJid = ef.getNodeParameter('remoteJid', i);
|
|
12
|
+
const contacts = ef.getNodeParameter('contacts.contactValues', i);
|
|
13
|
+
if (!Array.isArray(contacts) || contacts.length === 0) {
|
|
14
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), 'Lista de contatos inválida', {
|
|
15
|
+
message: 'Lista de contatos inválida',
|
|
16
|
+
description: 'É necessário fornecer pelo menos um contato',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const options = ef.getNodeParameter('options_message', i, {});
|
|
20
|
+
const body = {
|
|
21
|
+
number: remoteJid,
|
|
22
|
+
contact: contacts.map(contact => ({
|
|
23
|
+
fullName: contact.fullName,
|
|
24
|
+
wuid: contact.wuid,
|
|
25
|
+
phoneNumber: contact.phoneNumber,
|
|
26
|
+
...(contact.organization && { organization: contact.organization }),
|
|
27
|
+
...(contact.email && { email: contact.email }),
|
|
28
|
+
...(contact.url && { url: contact.url }),
|
|
29
|
+
})),
|
|
30
|
+
};
|
|
31
|
+
if (options.delay) {
|
|
32
|
+
body.delay = options.delay;
|
|
33
|
+
}
|
|
34
|
+
const requestOptions = {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: {
|
|
37
|
+
'Content-Type': 'application/json',
|
|
38
|
+
},
|
|
39
|
+
uri: '/send/contact',
|
|
40
|
+
body,
|
|
41
|
+
json: true,
|
|
42
|
+
};
|
|
43
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, requestOptions);
|
|
44
|
+
returnData.push({
|
|
45
|
+
json: {
|
|
46
|
+
success: true,
|
|
47
|
+
data: response,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const errorMessage = error.message.includes('Could not get parameter')
|
|
53
|
+
? 'Parâmetros inválidos ou ausentes'
|
|
54
|
+
: 'Erro ao enviar contato';
|
|
55
|
+
const errorDetails = error.message.includes('Could not get parameter')
|
|
56
|
+
? 'Verifique se todos os campos obrigatórios foram preenchidos corretamente'
|
|
57
|
+
: error.message;
|
|
58
|
+
if (!ef.continueOnFail()) {
|
|
59
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
60
|
+
message: errorMessage,
|
|
61
|
+
description: errorDetails,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
returnData.push({
|
|
65
|
+
json: {
|
|
66
|
+
success: false,
|
|
67
|
+
error: {
|
|
68
|
+
message: errorMessage,
|
|
69
|
+
details: errorDetails,
|
|
70
|
+
code: error.code || 'UNKNOWN_ERROR',
|
|
71
|
+
timestamp: new Date().toISOString(),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
error: new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
75
|
+
message: errorMessage,
|
|
76
|
+
description: errorDetails,
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return returnData;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=sendContact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendContact.js","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J,CAAC;YAED,UAAU,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE;wBACN,OAAO,EAAE,YAAY;wBACrB,OAAO,EAAE,YAAY;wBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,eAAe;wBACnC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;qBACnC;iBACD;gBACD,KAAK,EAAE,IAAI,iCAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE;oBACzD,OAAO,EAAE,YAAY;oBACrB,WAAW,EAAE,YAAY;iBACzB,CAAC;aACF,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendDocument = sendDocument;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
6
|
+
async function sendDocument(ef) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
const items = ef.getInputData();
|
|
9
|
+
const returnData = [];
|
|
10
|
+
for (let i = 0; i < items.length; i++) {
|
|
11
|
+
try {
|
|
12
|
+
const remoteJid = ef.getNodeParameter('remoteJid', i);
|
|
13
|
+
const media = ef.getNodeParameter('media', i);
|
|
14
|
+
const caption = ef.getNodeParameter('caption', i, '');
|
|
15
|
+
const fileName = ef.getNodeParameter('fileName', i, 'document.pdf') || 'document.pdf';
|
|
16
|
+
const options = ef.getNodeParameter('options_message', i, {});
|
|
17
|
+
const body = {
|
|
18
|
+
number: remoteJid,
|
|
19
|
+
type: 'document',
|
|
20
|
+
url: media,
|
|
21
|
+
filename: fileName,
|
|
22
|
+
};
|
|
23
|
+
if (caption) {
|
|
24
|
+
body.caption = caption;
|
|
25
|
+
}
|
|
26
|
+
if (options.delay) {
|
|
27
|
+
body.delay = options.delay;
|
|
28
|
+
}
|
|
29
|
+
if ((_b = (_a = options.quoted) === null || _a === void 0 ? void 0 : _a.messageQuoted) === null || _b === void 0 ? void 0 : _b.messageId) {
|
|
30
|
+
body.quoted = {
|
|
31
|
+
messageId: options.quoted.messageQuoted.messageId,
|
|
32
|
+
};
|
|
33
|
+
if (options.quoted.messageQuoted.participant) {
|
|
34
|
+
body.quoted.participant = options.quoted.messageQuoted.participant;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if ((_c = options.mentions) === null || _c === void 0 ? void 0 : _c.mentionsSettings) {
|
|
38
|
+
const { mentionsEveryOne, mentioned } = options.mentions.mentionsSettings;
|
|
39
|
+
if (mentionsEveryOne) {
|
|
40
|
+
body.mentionAll = true;
|
|
41
|
+
}
|
|
42
|
+
else if (mentioned) {
|
|
43
|
+
body.mentionedJid = mentioned;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: {
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
},
|
|
51
|
+
uri: '/send/media',
|
|
52
|
+
body,
|
|
53
|
+
json: true,
|
|
54
|
+
};
|
|
55
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, requestOptions);
|
|
56
|
+
returnData.push({
|
|
57
|
+
json: {
|
|
58
|
+
success: true,
|
|
59
|
+
data: response,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const errorMessage = error.message.includes('Could not get parameter')
|
|
65
|
+
? 'Parâmetros inválidos ou ausentes'
|
|
66
|
+
: 'Erro ao enviar documento';
|
|
67
|
+
const errorDetails = error.message.includes('Could not get parameter')
|
|
68
|
+
? 'Verifique se todos os campos obrigatórios foram preenchidos corretamente'
|
|
69
|
+
: error.message;
|
|
70
|
+
if (!ef.continueOnFail()) {
|
|
71
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
72
|
+
message: errorMessage,
|
|
73
|
+
description: errorDetails,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
returnData.push({
|
|
77
|
+
json: {
|
|
78
|
+
success: false,
|
|
79
|
+
error: {
|
|
80
|
+
message: errorMessage,
|
|
81
|
+
details: errorDetails,
|
|
82
|
+
code: error.code || 'UNKNOWN_ERROR',
|
|
83
|
+
timestamp: new Date().toISOString(),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
error: new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
87
|
+
message: errorMessage,
|
|
88
|
+
description: errorDetails,
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return returnData;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=sendDocument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendDocument.js","sourceRoot":"","sources":["../../../../../nodes/StevoManager/execute/messages/sendDocument.ts"],"names":[],"mappings":";;AASA,oCAiHC;AA1HD,+CAMsB;AACtB,0DAAuD;AAEhD,KAAK,UAAU,YAAY,CAAC,EAAqB;;IACvD,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC;IAChC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC;YACJ,MAAM,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;YAChE,MAAM,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAW,CAAC;YACxD,MAAM,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE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I,iCAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE;oBACzD,OAAO,EAAE,YAAY;oBACrB,WAAW,EAAE,YAAY;iBACzB,CAAC;aACF,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendImage = sendImage;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
6
|
+
async function sendImage(ef) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
const items = ef.getInputData();
|
|
9
|
+
const returnData = [];
|
|
10
|
+
for (let i = 0; i < items.length; i++) {
|
|
11
|
+
try {
|
|
12
|
+
const remoteJid = ef.getNodeParameter('remoteJid', i);
|
|
13
|
+
const media = ef.getNodeParameter('media', i);
|
|
14
|
+
const caption = ef.getNodeParameter('caption', i, '');
|
|
15
|
+
const fileName = ef.getNodeParameter('fileName', i, 'image.jpg') || 'image.jpg';
|
|
16
|
+
const options = ef.getNodeParameter('options_message', i, {});
|
|
17
|
+
const body = {
|
|
18
|
+
number: remoteJid,
|
|
19
|
+
type: 'image',
|
|
20
|
+
url: media,
|
|
21
|
+
filename: fileName,
|
|
22
|
+
};
|
|
23
|
+
if (caption) {
|
|
24
|
+
body.caption = caption;
|
|
25
|
+
}
|
|
26
|
+
if (options.delay) {
|
|
27
|
+
body.delay = options.delay;
|
|
28
|
+
}
|
|
29
|
+
if ((_b = (_a = options.quoted) === null || _a === void 0 ? void 0 : _a.messageQuoted) === null || _b === void 0 ? void 0 : _b.messageId) {
|
|
30
|
+
body.quoted = {
|
|
31
|
+
messageId: options.quoted.messageQuoted.messageId,
|
|
32
|
+
};
|
|
33
|
+
if (options.quoted.messageQuoted.participant) {
|
|
34
|
+
body.quoted.participant = options.quoted.messageQuoted.participant;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if ((_c = options.mentions) === null || _c === void 0 ? void 0 : _c.mentionsSettings) {
|
|
38
|
+
const { mentionsEveryOne, mentioned } = options.mentions.mentionsSettings;
|
|
39
|
+
if (mentionsEveryOne) {
|
|
40
|
+
body.mentionAll = true;
|
|
41
|
+
}
|
|
42
|
+
else if (mentioned) {
|
|
43
|
+
body.mentionedJid = mentioned;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: {
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
},
|
|
51
|
+
uri: '/send/media',
|
|
52
|
+
body,
|
|
53
|
+
json: true,
|
|
54
|
+
};
|
|
55
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, requestOptions);
|
|
56
|
+
returnData.push({
|
|
57
|
+
json: {
|
|
58
|
+
success: true,
|
|
59
|
+
data: response,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const errorMessage = error.message.includes('Could not get parameter')
|
|
65
|
+
? 'Parâmetros inválidos ou ausentes'
|
|
66
|
+
: 'Erro ao enviar imagem';
|
|
67
|
+
const errorDetails = error.message.includes('Could not get parameter')
|
|
68
|
+
? 'Verifique se todos os campos obrigatórios foram preenchidos corretamente'
|
|
69
|
+
: error.message;
|
|
70
|
+
if (!ef.continueOnFail()) {
|
|
71
|
+
throw new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
72
|
+
message: errorMessage,
|
|
73
|
+
description: errorDetails,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
returnData.push({
|
|
77
|
+
json: {
|
|
78
|
+
success: false,
|
|
79
|
+
error: {
|
|
80
|
+
message: errorMessage,
|
|
81
|
+
details: errorDetails,
|
|
82
|
+
code: error.code || 'UNKNOWN_ERROR',
|
|
83
|
+
timestamp: new Date().toISOString(),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
error: new n8n_workflow_1.NodeOperationError(ef.getNode(), errorMessage, {
|
|
87
|
+
message: errorMessage,
|
|
88
|
+
description: errorDetails,
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return returnData;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=sendImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendImage.js","sourceRoot":"","sources":["../../../../../nodes/StevoManager/execute/messages/sendImage.ts"],"names":[],"mappings":";;AASA,8BAuHC;AAhID,+CAMsB;AACtB,0DAAuD;AAEhD,KAAK,UAAU,SAAS,CAAC,EAAqB;;IACpD,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC;IAChC,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC;YAEJ,MAAM,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;YAChE,MAAM,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAW,CAAC;YAGxD,MAAM,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;YAChE,MAAM,QAAQ,GAAI,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,EAAE,WAAW,CAAY,IAAI,WAAW,CAAC;YAG5F,MAAM,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,EAAE,EAAE,CAc3D,CAAC;YAEF,MAAM,IAAI,GAAQ;gBACjB,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE,OAAO;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