n8n-nodes-evolution-message-search 1.1.1 → 1.1.3
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.
|
@@ -57,21 +57,19 @@ class SearchMessages {
|
|
|
57
57
|
],
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
async supplyData(
|
|
61
|
-
const
|
|
62
|
-
const credentials = await context.getCredentials('evolutionApi');
|
|
60
|
+
async supplyData(itemIndex) {
|
|
61
|
+
const credentials = await this.getCredentials('evolutionApi');
|
|
63
62
|
const serverUrl = credentials['server-url'];
|
|
64
63
|
const apiKey = credentials.apikey;
|
|
65
|
-
const instanceName =
|
|
66
|
-
const userConversationId =
|
|
67
|
-
const allowModelSetConversation =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
async _call(input) {
|
|
64
|
+
const instanceName = this.getNodeParameter('instanceName', itemIndex);
|
|
65
|
+
const userConversationId = this.getNodeParameter('conversationId', itemIndex) || '';
|
|
66
|
+
const allowModelSetConversation = this.getNodeParameter('allowModelSetConversation', itemIndex);
|
|
67
|
+
const node = this.getNode();
|
|
68
|
+
const ctx = this;
|
|
69
|
+
const tool = {
|
|
70
|
+
name: (0, n8n_workflow_1.nodeNameToToolName)(node),
|
|
71
|
+
description: 'Search WhatsApp message history. Input: {"keywords":"text","dateFrom":"ISO","dateTo":"ISO","page":1,"pageSize":10,"conversationId":"jid"}',
|
|
72
|
+
_call: async function (input) {
|
|
75
73
|
const params = typeof input === 'string' ? JSON.parse(input) : input;
|
|
76
74
|
let conversationId = userConversationId;
|
|
77
75
|
if (!conversationId && allowModelSetConversation && params.conversationId) {
|
|
@@ -80,7 +78,7 @@ class SearchMessages {
|
|
|
80
78
|
const keywords = params.keywords || '';
|
|
81
79
|
const dateFrom = params.dateFrom || '';
|
|
82
80
|
const dateTo = params.dateTo || '';
|
|
83
|
-
const pageSize = params.pageSize || 10;
|
|
81
|
+
const pageSize = params.pageSize || ctx.getNodeParameter('pageSize', 0) || 10;
|
|
84
82
|
const page = params.page || 1;
|
|
85
83
|
const whereClause = {};
|
|
86
84
|
if (conversationId) whereClause['key.remote'] = conversationId;
|
|
@@ -97,7 +95,7 @@ class SearchMessages {
|
|
|
97
95
|
orderBy: { timestamp: 'desc' },
|
|
98
96
|
};
|
|
99
97
|
const cleanUrl = serverUrl.replace(/\/$/, '');
|
|
100
|
-
const response = await
|
|
98
|
+
const response = await ctx.helpers.request({
|
|
101
99
|
method: 'POST',
|
|
102
100
|
uri: `${cleanUrl}/chat/findMessages/${instanceName}`,
|
|
103
101
|
body,
|
|
@@ -111,9 +109,12 @@ class SearchMessages {
|
|
|
111
109
|
pageSize,
|
|
112
110
|
records: messages.records || [],
|
|
113
111
|
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
},
|
|
113
|
+
invoke: async function (input) {
|
|
114
|
+
return this._call(input);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
return { response: tool };
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
exports.SearchMessages = SearchMessages;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-evolution-message-search",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Evolution API - Search Messages node for n8n. Search WhatsApp message history by keywords, dates, and conversation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|