Skip to content
// Read-only view of one lead's record (for checking the drip and debugging).
const q = $('Lead Status API').first().json.query ?? {};
let phone = String(q.phone ?? '').replace(/[^\d+]/g, '');
if (/^\d{10}$/.test(phone)) phone = '+1' + phone;
const key = String(q.email ?? '').trim().toLowerCase() || phone;
const lead = ($getWorkflowStaticData('global').leads ?? {})[key];
return [{ json: lead ? { found: true, ...lead } : { found: false, key } }];