MolKit logo
Tools

Step 5 of 10

Map and validate lead data

Normalize and validate the raw form data before it reaches the AI step, ensuring only clean, safe inputs are processed.

Why this matters

The AI step will generate a reply based on whatever data it receives. If the Name field contains 'JOHN DOE' or the Message contains 50 lines of pasted HTML, the reply quality drops and the email may look unprofessional. This step catches malformed inputs early and routes problem records to manual review instead of auto-sending a bad reply.

Build instructions

Add a Formatter step for text normalization

Zapier Formatter transforms raw text values before passing them to later steps.

  1. Step 1

    Click the '+' button below the trigger step in the Zap editor. Search for 'Formatter by Zapier' and select it.

  2. Step 2

    Under 'Choose action event', select 'Text'. Then under 'Transform', select 'Capitalize'. In the 'Input' field, click inside and select 'Full Name' from the trigger's output fields.

  3. Step 3

    This converts 'john doe', 'JOHN DOE', or 'John doe' into 'John Doe' - aconsistent format for the greeting line in the email.

  4. Step 4

    Click 'Continue' and 'Test step' to verify the output. You should see the name in Title Case.

Add a filter to catch invalid email addresses

Zapier's Filter step stops the Zap and prevents any further actions from running when a condition is not met.

  1. Step 1

    Click '+' to add another step. Search for 'Filter by Zapier'. Under 'Only continue if...', set the field to 'Email Address' from the trigger output.

  2. Step 2

    Set the condition to 'Text' → 'Contains'. Type '@' in the value field. This is a simple but effective check - avalid email must contain an @ symbol.

  3. Step 3

    Enable 'If the filter does not pass, the Zap should...' and set it to stop. Optionally, you can route failures to a separate path that writes 'needs-review' to the sheet, but for now, simply stopping prevents bad emails from proceeding.

  4. Step 4

    Test the filter with both valid and invalid email values to confirm it works in both cases.

Create fallback values for optional content

  1. Step 1

    Add another Formatter step. This time use the 'Utilities' action with 'Default Value' transform. Set the Input to the 'Message' field.

  2. Step 2

    Set the Default value to 'No message provided.' This ensures the AI step always receives a string even if Message was somehow empty.

  3. Step 3

    Apply the same pattern for any other fields that are not marked required in the form.

Trim the Message to a safe length

  1. Step 1

    Add one more Formatter step. Use 'Text' action with 'Truncate' transform. Set Input to the Message field (or the output of the default-value step).

  2. Step 2

    Set Max Length to 500. This prevents a lead who pastes a 3000-word essay from sending an excessively long prompt to the AI, which wastes tokens and risks malformed output.

  3. Step 3

    Name this step '3. Formatter: Truncate message' for clarity.

Common mistakes

  • Passing the raw trigger output directly to the AI step without any normalization. The AI will still work, but reply quality suffers when the name is all-caps or the message has leading/trailing whitespace.
  • Using a complex regex filter for email validation. Zapier's Filter step does not support regex natively. Use 'Contains @' as a lightweight check, your real defense is the form-level validation you set up in Step 1.
  • Not naming each Formatter step clearly. When you have three Formatter steps in a row, generic names like 'Formatter 1', 'Formatter 2' make debugging impossible. Name each one by what it transforms.

Pro tips

  • Use the Zapier step editor's 'Data' panel on the right to see exactly what value each output field holds after each transformation. This is your primary debugging tool.
  • Add a comment to each step using the 'Notes' feature (the notepad icon in the step header). Write one sentence about what the step does and why. Future you will be grateful.

Before you continue

Run a test through all three formatter/filter steps using both valid and invalid data. Confirm: a valid email + clean name passes through all steps. A missing @ in the email stops at the filter. The Message is truncated to 500 characters or less.

Step result

Only clean, validated, normalized inputs reach the AI generation step. Malformed records are stopped and can be routed to manual review.