import deepline from 'deepline'; export const config = { description: 'Enrich inbound leads', compatibility: { authoringContract: 'explicit-freshness' }, webhook: { auth: { type: 'standard-webhooks', headerFamily: 'standard', signingSecrets: ['INBOUND_RELAY_WEBHOOK_SECRET'], toleranceSeconds: 300, }, }, }; export default async function (lead: { email: string; company_domain?: string; source?: string; }) { const domain = lead.company_domain ?? lead.email.split('@')[1] ?? ''; const company = await deepline.tools.execute({ id: 'company_context', tool: 'test_rate_limit', input: { key: domain }, description: 'Add company context before routing the inbound lead.', staleAfterSeconds: 0, }); return { email: lead.email, domain, source: lead.source ?? 'webhook', company_status: company.status, }; }