n8n-nodes-msteams-botframework 1.2.3 → 1.2.4

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.
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MsTeamsBotFrameworkTrigger = void 0;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
5
  const botbuilder_1 = require("botbuilder");
6
+ // Track processed activity IDs to prevent duplicates
7
+ const processedActivities = new Map();
8
+ // Clean up old entries every 5 minutes
9
+ setInterval(() => {
10
+ const fiveMinutesAgo = Date.now() - 5 * 60 * 1000;
11
+ for (const [id, timestamp] of processedActivities.entries()) {
12
+ if (timestamp < fiveMinutesAgo) {
13
+ processedActivities.delete(id);
14
+ }
15
+ }
16
+ }, 5 * 60 * 1000);
6
17
  class MsTeamsBotFrameworkTrigger {
7
18
  constructor() {
8
19
  this.description = {
@@ -192,6 +203,13 @@ class MsTeamsBotFrameworkTrigger {
192
203
  await adapter.processActivity(req, req.res, async (context) => {
193
204
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
194
205
  const activity = context.activity;
206
+ // Check for duplicate activity
207
+ const activityKey = `${activity.id}_${activity.timestamp}`;
208
+ if (processedActivities.has(activityKey)) {
209
+ // Already processed this activity, skip
210
+ shouldTrigger = false;
211
+ return;
212
+ }
195
213
  // Check if we should process this activity type
196
214
  if (!events.includes(activity.type)) {
197
215
  shouldTrigger = false;
@@ -202,6 +220,8 @@ class MsTeamsBotFrameworkTrigger {
202
220
  shouldTrigger = false;
203
221
  return;
204
222
  }
223
+ // Mark this activity as processed
224
+ processedActivities.set(activityKey, Date.now());
205
225
  shouldTrigger = true;
206
226
  // Send typing indicator if auto reply is enabled
207
227
  if (options.autoReply && activity.type === 'message') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-msteams-botframework",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "n8n node for MS Teams Azure Bot Framework",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",