n8n: throw on FAILED memory events (was silently returned), poll on any non-terminal status (PENDING or RUNNING), use top_k (not limit) for search, coerce search/getAll responses to arrays, guard invalid-JSON metadata, reject empty updates, mark user_id required; lint clean. Zapier: coerce boolean fields (String(x) !== 'false') + boolean defaults so "Wait"/"Infer = No" are honored, throw on HTTP >= 400 (was silent empty/fake-success), throw on FAILED events, use top_k, numeric coercion with clamping, mark user_id required.
32 lines
780 B
JavaScript
32 lines
780 B
JavaScript
'use strict';
|
|
|
|
// Custom (API key) authentication for Mem0.
|
|
// The key is sent as "Authorization: Token <apiKey>" (matches Mem0's SDKs).
|
|
const test = (z, _bundle) =>
|
|
z.request({ url: '/v1/ping/', method: 'GET' });
|
|
|
|
module.exports = {
|
|
type: 'custom',
|
|
test,
|
|
fields: [
|
|
{
|
|
key: 'apiKey',
|
|
label: 'Mem0 API Key',
|
|
type: 'string',
|
|
required: true,
|
|
helpText:
|
|
'Your Mem0 API key (starts with `m0-`). Create one at [app.mem0.ai](https://app.mem0.ai) → Settings → API Keys.',
|
|
},
|
|
{
|
|
key: 'baseUrl',
|
|
label: 'Base URL',
|
|
type: 'string',
|
|
required: false,
|
|
default: 'https://api.mem0.ai',
|
|
helpText: 'Override only for self-hosted or non-default deployments.',
|
|
},
|
|
],
|
|
// Shown on the connection label in the Zap editor.
|
|
connectionLabel: 'Mem0',
|
|
};
|