Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

fix(integrations/zapier): address Zapier publishing review (#6985)

Himanshu1de6499b8abf
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<AddResponse | EventR
const body: Record<string, unknown> = {
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<AddResponse | EventR
if (bundle.inputData.includes) body.includes = bundle.inputData.includes;
if (bundle.inputData.excludes) body.excludes = bundle.inputData.excludes;
- captureEvent('zapier.add_memory', bundle.authData?.apiKey, { infer, wait });
-
const response = await z.request({
url: '/v3/memories/add/',
method: 'POST',
@@ -97,7 +96,7 @@ export default {
noun: 'Memory',
display: {
label: 'Add Memory',
- description: 'Extract and store memories from a message.',
+ description: 'Extracts and stores memories from a message.',
},
operation: {
perform,
diff --git a/integrations/zapier-mem0/src/creates/delete_memory.ts b/integrations/zapier-mem0/src/creates/delete_memory.ts
index 73cac1880..42a225e14 100644
--- a/integrations/zapier-mem0/src/creates/delete_memory.ts
+++ b/integrations/zapier-mem0/src/creates/delete_memory.ts
@@ -14,7 +14,7 @@ export default {
noun: 'Memory',
display: {
label: 'Delete Memory',
- description: 'Delete a single memory by its ID.',
+ description: 'Deletes a memory by its ID.',
},
operation: {
perform,
diff --git a/integrations/zapier-mem0/src/searches/get_memories.ts b/integrations/zapier-mem0/src/searches/get_memories.ts
index 96df8d3ee..bae9423c6 100644
--- a/integrations/zapier-mem0/src/searches/get_memories.ts
+++ b/integrations/zapier-mem0/src/searches/get_memories.ts
@@ -1,12 +1,9 @@
import type { ZObject, Bundle, Memory } from '../types';
-import { captureEvent } from '../telemetry';
const perform = async (z: ZObject, bundle: Bundle): Promise<Memory[]> => {
const body: Record<string, unknown> = {};
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<Memory[]> => {
const body: Record<string, unknown> = {
@@ -9,8 +8,6 @@ const perform = async (z: ZObject, bundle: Bundle): Promise<Memory[]> => {
};
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<string, unknown> = {},
-): 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 {};