# Pipedream Lead Qualification Workflow Recipe

## Trigger

Create a Pipedream workflow with an HTTP / Webhook trigger. Send lead data such as contact name, company, email, campaign, and message.

## Decision Step

Use a Node.js code step to normalize the payload and return structured fields. The proof workflow used synthetic data and returned:

```json
{
  "ai_score": 88,
  "lead_tier": "Hot",
  "routing_priority": "High",
  "suggested_owner": "Sales Ops queue",
  "next_best_action": "Book a discovery call"
}
```

## Required Output Fields

- `ai_score`
- `lead_tier`
- `fit_reason`
- `missing_info`
- `suggested_owner`
- `next_best_action`
- `follow_up_draft`
- `routing_priority`

## Jodoo Writeback

Send the structured output to an approved Jodoo writeback endpoint or middleware layer. The test run returned a Jodoo data ID, confirming that the Pipedream workflow created a lead record in Jodoo.

## Production Notes

- Keep the webhook payload schema stable.
- Add retries and error handling before production traffic.
- Store the original agent or workflow output for auditability.
- Use secrets or a secure middleware layer for Jodoo credentials.
