From 1de6499b8abf7cc560025e41098c2718b247f9dc Mon Sep 17 00:00:00 2001 From: Himanshu <104683257+Himanshu-Sangshetti@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:53:06 +0530 Subject: [PATCH] fix(integrations/zapier): address Zapier publishing review (#6985) --- .../zapier-mem0/src/authentication.ts | 6 ++- .../zapier-mem0/src/creates/add_memory.ts | 7 ++-- .../zapier-mem0/src/creates/delete_memory.ts | 2 +- .../zapier-mem0/src/searches/get_memories.ts | 7 +--- .../src/searches/search_memories.ts | 7 +--- integrations/zapier-mem0/src/telemetry.ts | 39 ------------------- integrations/zapier-mem0/test/setup.ts | 7 ++-- 7 files changed, 16 insertions(+), 59 deletions(-) delete mode 100644 integrations/zapier-mem0/src/telemetry.ts diff --git a/integrations/zapier-mem0/src/authentication.ts b/integrations/zapier-mem0/src/authentication.ts index 19d325220..0df88638a 100644 --- a/integrations/zapier-mem0/src/authentication.ts +++ b/integrations/zapier-mem0/src/authentication.ts @@ -26,6 +26,8 @@ export default { helpText: 'Override only for self-hosted or non-default deployments.', }, ], - // Shown on the connection label in the Zap editor. - connectionLabel: 'Mem0', + // Shown on the connection label in the Zap editor. Uses the account email + // from the /v1/ping/ test response so users with multiple Mem0 connections + // can tell them apart. + connectionLabel: '{{user_email}}', }; diff --git a/integrations/zapier-mem0/src/creates/add_memory.ts b/integrations/zapier-mem0/src/creates/add_memory.ts index d0e27a034..b019cbf8b 100644 --- a/integrations/zapier-mem0/src/creates/add_memory.ts +++ b/integrations/zapier-mem0/src/creates/add_memory.ts @@ -1,5 +1,4 @@ import type { ZObject, Bundle, AddResponse, EventResponse } from '../types'; -import { captureEvent } from '../telemetry'; const POLL_INTERVAL_MS = 1500; // Bounded to a 60s poll budget, under Zapier's per-step execution timeout. @@ -38,6 +37,8 @@ const perform = async (z: ZObject, bundle: Bundle): Promise = { messages: [{ role: bundle.inputData.role || 'user', content: bundle.inputData.content }], infer, + // Attribution is recorded server-side by Mem0 from this source tag. + source: 'ZAPIER', }; if (bundle.inputData.user_id) body.user_id = bundle.inputData.user_id; if (bundle.inputData.agent_id) body.agent_id = bundle.inputData.agent_id; @@ -69,8 +70,6 @@ const perform = async (z: ZObject, bundle: Bundle): Promise => { const body: Record = {}; if (bundle.inputData.user_id) body.filters = { user_id: bundle.inputData.user_id }; - captureEvent('zapier.get_memories', bundle.authData?.apiKey); - const response = await z.request({ url: '/v3/memories/', method: 'POST', @@ -25,8 +22,8 @@ export default { key: 'get_memories', noun: 'Memory', display: { - label: 'Get Memories', - description: 'List stored memories for a user.', + label: 'Find Memories by User', + description: 'Finds all stored memories for a user.', }, operation: { perform, diff --git a/integrations/zapier-mem0/src/searches/search_memories.ts b/integrations/zapier-mem0/src/searches/search_memories.ts index f2f834e45..ee9eef774 100644 --- a/integrations/zapier-mem0/src/searches/search_memories.ts +++ b/integrations/zapier-mem0/src/searches/search_memories.ts @@ -1,5 +1,4 @@ import type { ZObject, Bundle, Memory } from '../types'; -import { captureEvent } from '../telemetry'; const perform = async (z: ZObject, bundle: Bundle): Promise => { const body: Record = { @@ -9,8 +8,6 @@ const perform = async (z: ZObject, bundle: Bundle): Promise => { }; if (bundle.inputData.user_id) body.filters = { user_id: bundle.inputData.user_id }; - captureEvent('zapier.search_memories', bundle.authData?.apiKey); - const response = await z.request({ url: '/v3/memories/search/', method: 'POST', @@ -25,8 +22,8 @@ export default { key: 'search_memories', noun: 'Memory', display: { - label: 'Search Memories', - description: 'Semantic search over stored memories.', + label: 'Find Memories', + description: 'Finds memories matching a semantic query.', }, operation: { perform, diff --git a/integrations/zapier-mem0/src/telemetry.ts b/integrations/zapier-mem0/src/telemetry.ts deleted file mode 100644 index 46e2b994f..000000000 --- a/integrations/zapier-mem0/src/telemetry.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { createHash } from 'crypto'; - -// Anonymous usage telemetry via PostHog, mirroring the Mem0 CLI / plugins. -// Fire-and-forget: never awaited, never throws, so it can neither slow down -// nor break an action. Opt out with MEM0_TELEMETRY=false. -const POSTHOG_API_KEY = 'phc_hgJkUVJFYtmaJqrvf6CYN67TIQ8yhXAkWzUn9AMU4yX'; -const POSTHOG_HOST = 'https://us.i.posthog.com/i/v0/e/'; - -export function captureEvent( - event: string, - apiKey: string | undefined, - properties: Record = {}, -): void { - if (process.env.MEM0_TELEMETRY === 'false') return; - try { - // Hash the API key so events are attributable to one account without - // ever transmitting the key itself. - const distinctId = apiKey ? createHash('md5').update(apiKey).digest('hex') : 'zapier-anon'; - const payload = { - api_key: POSTHOG_API_KEY, - event, - distinct_id: distinctId, - properties: { - source: 'ZAPIER', - $process_person_profile: false, - ...properties, - }, - }; - void fetch(POSTHOG_HOST, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(payload), - }).catch(() => { - /* swallow — telemetry must never surface to the user */ - }); - } catch { - /* swallow — telemetry must never break the action */ - } -} diff --git a/integrations/zapier-mem0/test/setup.ts b/integrations/zapier-mem0/test/setup.ts index 3c9be90ae..18aa050c9 100644 --- a/integrations/zapier-mem0/test/setup.ts +++ b/integrations/zapier-mem0/test/setup.ts @@ -1,3 +1,4 @@ -// Disable telemetry during tests so runs never fire real PostHog events -// (and so the fire-and-forget fetch cannot leave an open handle after tests). -process.env.MEM0_TELEMETRY = 'false'; +// Jest setup file. Usage attribution is recorded server-side by the Mem0 API +// from the `source: "ZAPIER"` tag on writes (see src/creates/add_memory.ts), so +// there is nothing to disable here during tests. +export {};