Zapier Platform CLI app (zapier-mem0) with Add Memory / Delete Memory
creates and Search Memories / Get Memories searches against the Mem0 v3
API. Custom API-key auth (Authorization: Token), base-URL + auth
injected via beforeRequest middleware, non-2xx surfaced as errors.
Add Memory polls GET /v1/event/{id}/ for async extraction. Includes an
E2E test suite via createAppTester.
33 lines
820 B
JavaScript
33 lines
820 B
JavaScript
'use strict';
|
|
|
|
const perform = async (z, bundle) => {
|
|
const body = {};
|
|
if (bundle.inputData.user_id) body.filters = { user_id: bundle.inputData.user_id };
|
|
|
|
const response = await z.request({
|
|
url: '/v3/memories/',
|
|
method: 'POST',
|
|
params: { page: 1, page_size: bundle.inputData.limit || 50 },
|
|
body,
|
|
});
|
|
const data = response.data;
|
|
return Array.isArray(data) ? data : data.results || [];
|
|
};
|
|
|
|
module.exports = {
|
|
key: 'get_memories',
|
|
noun: 'Memory',
|
|
display: {
|
|
label: 'Get Memories',
|
|
description: 'List stored memories for a user.',
|
|
},
|
|
operation: {
|
|
perform,
|
|
inputFields: [
|
|
{ key: 'user_id', label: 'User ID', type: 'string' },
|
|
{ key: 'limit', label: 'Limit', type: 'integer', default: '50' },
|
|
],
|
|
sample: { id: '00000000-0000-0000-0000-000000000000', memory: 'User loves hiking' },
|
|
},
|
|
};
|