feat(integrations): add Zapier app for Mem0
A Zapier Platform CLI app (TypeScript) wrapping the hosted Mem0 v3 REST API: Add / Search / Get Memories / Delete actions with custom API-key auth. - Written in TypeScript, compiles to dist/; offline unit tests (mocked z.request) plus live E2E; `zapier validate` clean - Add supports custom_instructions, custom_categories, includes, excludes; Wait-for-Completion defaults off (extraction can exceed Zapier's 30s step limit) - Middleware surfaces non-2xx as errors (no silent empty results) - Anonymous opt-out telemetry (MEM0_TELEMETRY=false) - Docs page + docs.json/llms.txt entry, ci-gate wiring, AGENTS.md rows Split out of #6057 per review (separate PRs per integration).
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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> = {
|
||||
query: bundle.inputData.query,
|
||||
output_format: 'v1.1',
|
||||
top_k: Math.max(1, Math.floor(Number(bundle.inputData.limit) || 50)),
|
||||
};
|
||||
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',
|
||||
body,
|
||||
});
|
||||
// Searches must return an array.
|
||||
const data = response.data as Memory[] | { results?: Memory[] };
|
||||
return Array.isArray(data) ? data : data.results || [];
|
||||
};
|
||||
|
||||
export default {
|
||||
key: 'search_memories',
|
||||
noun: 'Memory',
|
||||
display: {
|
||||
label: 'Search Memories',
|
||||
description: 'Semantic search over stored memories.',
|
||||
},
|
||||
operation: {
|
||||
perform,
|
||||
inputFields: [
|
||||
{ key: 'query', label: 'Query', type: 'string', required: true },
|
||||
{ key: 'user_id', label: 'User ID', type: 'string', required: true },
|
||||
{ key: 'limit', label: 'Limit', type: 'integer', default: '50' },
|
||||
],
|
||||
sample: { id: '00000000-0000-0000-0000-000000000000', memory: 'User loves hiking' },
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user