# Campaign QA Checklist

Check an email campaign draft for broken links, missing or inconsistent UTM (Urchin Tracking Module — the query parameters used to track click sources in analytics) parameters, and unresolved merge fields, then report every defect back to the sender so they can fix it before send.

## When to use

- Before a campaign is scheduled or sent, when a draft is ready for review.
- When a sender asks for a QA (quality assurance) pass on an email draft.
- After a template or merge-field change, to catch regressions before the next send.
- When a prior QA report flagged issues and the sender says a revision is ready for re-check.

## Tools

- `read-file` — load the campaign draft (HTML/text body, subject line, and merge-field manifest) from the artifact the sender produced.
- `shell-execute` — run a small script to extract all links, parse UTM query parameters, and find merge-field tokens (e.g. `{{first_name}}`) in the draft.
- `write-file` — save the QA findings (defect list: broken links, missing/inconsistent UTMs, unresolved merge fields) as a report artifact.
- `send-message` — notify the sender that QA is complete and flag defects for fixes, or confirm the draft is clean.

## Playbook

1. Identify the draft artifact to review; use `read-file` to load its full contents (body, subject, any merge-field data file).
2. Use `shell-execute` to run a short script extracting every URL from the draft body.
3. For each extracted link, use `shell-execute` to check it has the expected UTM parameters (`utm_source`, `utm_medium`, `utm_campaign` at minimum) and that values are consistent with the campaign name.
4. Use `shell-execute` to scan the draft for merge-field tokens (e.g. `{{first_name}}`, `{{company}}`) and cross-check each against the field list in the merge-field manifest, flagging any token with no matching field or any field that appears literally unresolved.
5. Compile every defect found — broken/dead links, missing or mismatched UTM parameters, unresolved or unmapped merge fields — into a single structured list with the exact location (link text or line) of each.
6. Use `write-file` to save this defect list as a QA report artifact, or note explicitly that no defects were found.
7. Use `send-message` to notify the sender: summarize the defect count and severity, point to the QA report artifact, and ask for a fixed draft if defects exist.
8. If the sender supplies a revised draft, repeat steps 1-6 against the new version and confirm which defects were resolved.
9. Once a draft passes with zero defects, use `send-message` to confirm the campaign is QA-clean and ready to schedule.

## Failure modes

- 401/403 on any dependency the draft references -> missing Integration, escalate via `send-message` to a human naming the service and required scopes.
- Empty result when extracting links or merge fields -> verify you are reading the correct file/section with `read-file`, and re-check the parsing logic in `shell-execute` before concluding the draft is clean.
- Rate limit encountered while probing external link targets -> back off and note the limitation in the QA report rather than marking links as verified.
- Draft format or merge-field syntax has changed from what the script expects -> fall back to a manual read of the file via `read-file` and note the format change in the report for the sender.

## Done when

- A QA report artifact exists (via `write-file`) listing every broken link, UTM defect, and unresolved merge field, or explicitly stating none were found.
- The sender has been notified via `send-message` with the defect summary and a link/reference to the report.
- Any revised draft has been re-checked and the report reflects which defects are resolved versus still open.