import { definePlay } from 'deepline';
type InboundLead = {
email: string;
company_domain?: string;
};
export default definePlay('inbound-lead', async (ctx, input: InboundLead) => {
const domain = input.company_domain ?? input.email.split('@')[1] ?? '';
const company = await ctx.tools.execute({
id: 'company_context',
tool: 'test_rate_limit',
input: { key: domain },
description: 'Add company context before routing the inbound lead.',
});
return { email: input.email, domain, company_status: company.status };
}, {
webhook: {
hmac: {
secretEnv: 'HUBSPOT_WEBHOOK_SECRET',
header: 'x-hubspot-signature-v3',
algorithm: 'sha256',
},
},
});