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: {
auth: {
type: 'standard-webhooks',
headerFamily: 'standard',
signingSecrets: ['INBOUND_RELAY_WEBHOOK_SECRET'],
toleranceSeconds: 300,
},
},
},
);