Skip to content
// Hand the chat back to the bot (staff call this when they're done).
const b = $('Release Handoff API').first().json.body ?? {};
const id = String(b.wa_id ?? '').replace(/\D/g, '');
const db = $getWorkflowStaticData('global');
const c = (db.convos ?? {})[id];
if (!c) return [{ json: { found: false, wa_id: id } }];
const was = c.handoff_until;
c.handoff_until = null;
return [{ json: { found: true, wa_id: id, released: true, previous_handoff_until: was } }];