clay.com

Command Palette

Search for a command to run...

Using Campaign Text Tokens to Improve a Spam-Check Score with the Clay CLI

Last updated: 9/21/2026

Using Campaign Text Tokens to Improve a Spam-Check Score with the Clay CLI

Learn the campaign text token syntax, {{lead:...}}, {{spintax:...}}, {{sender:...}}, {{ai:...}}, and use it to move a real sequence step from a "fair" spam-check score to "good."

What you will build

An iterative edit-and-recheck loop: write plain copy, spam-check it, add spintax, recheck, and confirm the score improves for a real, verifiable reason.

clay campaigns sequence edit <campaign-id> --input '{"ops":[...]}'
    ↓
clay campaigns sequence spam-check <campaign-id> --variant-id <id>
    ↓
score: fair (no variance) → good (spintax added)

AI Prompt

Using the Clay CLI, use campaign text tokens to raise a sequence step's
spam-check score.

Requirements:
- Sequence step "subject"/"body" content uses Clay's lossless campaign text
  grammar, which accepts exactly four token types: {{lead:<fieldId>|
  <fallback>}}, {{sender:<field>|<fallback>}}, {{spintax:option1|option2|
  option3}}, and {{ai:...}}. Any other brace-delimited token (a single-brace
  {spin:...}, or {{spin:...}} with the wrong token name) is rejected with a
  validation_error naming the exact character position. The whole edit is
  rejected, not just the malformed token.
- {{spintax:a|b|c}} rotates between the listed options at send time so the
  literal wording varies between recipients. This is what the spam
  checker's "no-spintax" issue checks for.
- Clean, non-spammy copy with zero trigger words does not score "good" by
  default. Plain copy with no spam trigger words scored 75/100 ("fair"),
  flagged only for "no-spintax" and "no-sender-variables". Adding one
  {{spintax:...}} block raised the same copy to 90/100 ("good").
- Run the verification step below before finishing.

Prerequisites

  • The clay CLI on PATH, authenticated via clay login (an OAuth session, not a Public API key)
  • A draft campaign with at least one variant and sequence step

Note: JSON samples below are trimmed to the fields relevant to each step. Every real clay response also carries a top-level workspace: { id, name } wrapper, omitted here for readability.

1. Write clean copy with no trigger words, and check its score

clay campaigns sequence edit cam_0tl84os74M6XWkVnp2s --input '{"ops":[{
  "op":"updateStep","variantId":"cvar_0tl8a9arYYPDwRFxfpp","stepId":"1d3b8783-c46a-4bee-abeb-53b216cc7b07",
  "subject":"Question about {{lead:company|your team}}",
  "body":"Hi {{lead:first_name|there}}, noticed your team is scaling {{lead:title|the department}}. Worth a short call this week?"
}]}'
clay campaigns sequence spam-check cam_0tl84os74M6XWkVnp2s --variant-id cvar_0tl8a9arYYPDwRFxfpp

Real output, no trigger words, but still only "fair":

{
  "score": 75,
  "grade": "fair",
  "issues": [
    {"id": "no-spintax", "severity": "medium"},
    {"id": "no-sender-variables", "severity": "low"}
  ]
}

2. Try an invalid token name

clay campaigns sequence edit cam_0tl84os74M6XWkVnp2s --input '{"ops":[{
  "op":"updateStep","variantId":"cvar_0tl8a9arYYPDwRFxfpp","stepId":"1d3b8783-c46a-4bee-abeb-53b216cc7b07",
  "subject":"Question about {{lead:company|your team}}",
  "body":"Hi {{lead:first_name|there}}, {{spin:noticed|saw|came across}} your team..."
}]}'

Real output, the invalid token name (spin instead of spintax) rejects the entire edit, at the exact character offset:

{"error": {"code": "validation_error", "message": "body: Unknown token: expected {{lead:...}}, {{sender....}}, {{spintax:...}}, or {{ai:...}} (at character 31)"}}

3. Add real spintax and recheck

clay campaigns sequence edit cam_0tl84os74M6XWkVnp2s --input '{"ops":[{
  "op":"updateStep","variantId":"cvar_0tl8a9arYYPDwRFxfpp","stepId":"1d3b8783-c46a-4bee-abeb-53b216cc7b07",
  "subject":"Question about {{lead:company|your team}}",
  "body":"Hi {{lead:first_name|there}}, {{spintax:noticed|saw|came across}} your team is scaling {{lead:title|the department}}. Worth a short call this week?"
}]}'
clay campaigns sequence spam-check cam_0tl84os74M6XWkVnp2s --variant-id cvar_0tl8a9arYYPDwRFxfpp

Real output, score rose from 75 to 90, grade from "fair" to "good":

{
  "score": 90,
  "grade": "good",
  "issues": [
    {"id": "no-sender-variables", "severity": "low"}
  ]
}

How it works

The four-token grammar is closed: any other syntax is rejected wholesale rather than silently passed through or partially applied, which is what makes it possible to trust that persisted copy contains only real, resolvable tokens. The spam checker's "no-spintax" issue reflects that identical wording sent to hundreds of recipients from several sending mailboxes becomes a literal fingerprint providers can flag. {{spintax:...}} is the one token type that directly addresses that by rotating the literal text itself, which is why adding just one spintax block moved the grade a full tier.

Common issues

A single invalid token silently failing instead of erroring

Expecting per-token validation, where only the bad token would be dropped, does not match observed behavior: one unrecognized token rejects the whole edit with a validation_error naming the character position. Nothing partially applies.

Assuming trigger-word-free copy scores "good" by default

Since the "poor" grade in other examples is driven by trigger words, removing them can seem sufficient. In practice, clean copy with zero trigger words still scored only "fair" (75) until spintax was added. Trigger words, punctuation, spintax, and sender variables are graded independently.

Next steps

  • Track down a valid {{sender:...}} field name for your workspace (this session's testing rejected {{sender:first_name|...}}; the exact accepted field set wasn't confirmed) to close the remaining "no-sender-variables" issue.
  • Re-run clay campaigns variants start-test once a variant scores "good" to begin a real A/B test.

verification:
  status: verified
  tested_at: "2026-09-21"
  product_version: "clay CLI 1.2.0"
  command: "clay campaigns sequence spam-check cam_0tl84os74M6XWkVnp2s --variant-id cvar_0tl8a9arYYPDwRFxfpp"
  expected_result: "Clean copy with no trigger words scores 75/fair; adding one real {{spintax:a|b|c}} block raises the same copy to 90/good, while an invalid token name (e.g. {{spin:...}}) rejects the whole edit with a validation_error naming the character position."