CLI & Troubleshooting
Campaign ships seven processwire-console commands under the campaign:* namespace. Every command supports --json for structured output in CI/CD pipelines and cron scripts.
CLI Command Reference
Section titled “CLI Command Reference”1. campaign:doctor
Section titled “1. campaign:doctor”Verifies database schema health across all 5 managed SQL tables, Entries blueprints, Contacts availability, active WireMail transport, webhook secrets, and sibling integrations.
php vendor/bin/wire campaign:doctor --json2. campaign:seed
Section titled “2. campaign:seed”Seeds starter Campaign Types, Mailing Lists, Campaigns, Segments, and Sendouts idempotently.
php vendor/bin/wire campaign:seed \ --mode=skip \ --only=types,lists,campaigns,segments,sendouts \ --with-demo \ --dry-run \ --json| Flag | Values / Behavior |
|---|---|
--mode=skip|upsert |
skip preserves existing records; upsert updates matching handles in place. |
--only=... |
Comma-separated subset of types,lists,campaigns,segments,sendouts. |
--with-demo |
Includes realistic sample campaigns, lists, and sendouts. |
--dry-run |
Previews changes without writing to the database. |
--json |
Emits machine-readable JSON output. |
3. campaign:send
Section titled “3. campaign:send”Dispatches a specific sendout by UUID or processes all due scheduled and recurring sendouts.
# Dispatch one sendout asynchronously via ProcessSendoutBatchQueuephp vendor/bin/wire campaign:send --sendout=<uuid> --json
# Process all due scheduled/recurring sendouts synchronously (dry-run first)php vendor/bin/wire campaign:send --due --sync --dry-run --json| Flag | Behavior |
|---|---|
--sendout=<uuid> |
Targets a single sendout entry by UUID. |
--due |
Evaluates and dispatches all due scheduled and recurring sendouts. |
--sync |
Sends batches inline in the current CLI process instead of queuing ProcessSendoutBatchQueue. |
--dry-run |
Resolves recipients and reports counts without sending any email. |
--json |
Emits JSON summary. |
4. campaign:sync-roles
Section titled “4. campaign:sync-roles”Synchronizes ProcessWire user roles configured on Mailing Lists (sync_user_roles) into campaign_subscriptions.
php vendor/bin/wire campaign:sync-roles --list=aegean-voyages --dry-run --json| Flag | Behavior |
|---|---|
--list=<id|handle> |
Limits synchronization to one mailing list (omit to sync all role-linked lists). |
--dry-run |
Reports additions and removals without mutating subscriptions. |
--json |
Emits JSON summary. |
5. campaign:import
Section titled “5. campaign:import”Imports subscribers from a UTF-8 CSV file into a target mailing list via TransferService.
php vendor/bin/wire campaign:import \ --list=aegean-voyages \ --file=/path/to/subscribers.csv \ --confirm \ --dry-run \ --json| Flag | Behavior |
|---|---|
--list=<id|handle> |
Target mailing list ID or handle (required). |
--file=<path> |
Path to the CSV file containing an email column (required). |
--confirm |
Marks imported rows subscribed immediately instead of pending Double Opt-In. |
--dry-run |
Validates rows, checks suppressions, and prints counts without writing. |
--json |
Emits JSON summary. |
6. campaign:export
Section titled “6. campaign:export”Exports subscribers from a mailing list to a formula-safe UTF-8 CSV file.
php vendor/bin/wire campaign:export \ --list=aegean-voyages \ --status=subscribed \ --output-file=/path/to/export.csv \ --force \ --json| Flag | Behavior |
|---|---|
--list=<id|handle> |
Source mailing list ID or handle (required). |
--status=... |
One of all, subscribed, pending, unsubscribed, bounced, complained. |
--output-file=<path> |
Destination CSV file path. |
--force |
Overwrites --output-file if it already exists. |
--json |
Emits JSON metadata. |
7. campaign:anonymize
Section titled “7. campaign:anonymize”Scrubs PII from historical campaign records for GDPR erasure or retention enforcement.
# Anonymize records older than 365 daysphp vendor/bin/wire campaign:anonymize --older-than=365 --dry-run --json
# Anonymize a specific contact immediatelyphp vendor/bin/wire campaign:anonymize --contact=<uuid> --force --json| Flag | Behavior |
|---|---|
--older-than=<days> |
Targets tracking/recipient records older than the given number of days. |
--contact=<uuid> |
Targets all campaign records belonging to a specific Contacts UUID. |
--dry-run |
Reports affected row counts without modifying data. |
--force |
Executes the irreversible anonymization without interactive confirmation. |
--json |
Emits JSON summary. |
Queue Workers & Cron Setup
Section titled “Queue Workers & Cron Setup”In production, keep both the queue worker and the task scheduler running via processwire-console:
# Cron entry (runs every minute to trigger ProcessScheduledSendoutsTask and PruneCampaignDataTask)* * * * * cd /path/to/processwire && php vendor/bin/wire schedule:run >> /dev/null 2>&1
# Supervised worker (processes ProcessSendoutBatchQueue and SyncUserRolesQueue)php vendor/bin/wire queue:work --sleep=3 --tries=3Troubleshooting
Section titled “Troubleshooting”Scheduled Sendouts Stay in Scheduled State
Section titled “Scheduled Sendouts Stay in Scheduled State”- Confirm your system cron executes
php vendor/bin/wire schedule:runevery minute. - Verify
ProcessScheduledSendoutsTaskis registered by runningphp vendor/bin/wire schedule:list --json. - Test manually with
php vendor/bin/wire campaign:send --due --dry-run --json.
Images Appear Broken in Recipient Inboxes
Section titled “Images Appear Broken in Recipient Inboxes”- Set Site Base URL (
site_base_url) under Setup > Campaigns > Settings > General & Brand to your publichttps://origin. CampaignRendererabsolutizes root-relative<img src="/site/assets/...">paths usingsite_base_url; if your site runs behind a local hostname during CLI queue dispatch,$config->httpHostalone may resolve tolocalhost.
Inbound ESP Webhooks Return 401 or 403
Section titled “Inbound ESP Webhooks Return 401 or 403”- Verify the provider secret in Setup > Campaigns > Settings > Provider Webhooks matches your ESP dashboard exactly (watch for trailing whitespace).
- For Mailgun and Resend, verify server clock synchronization (NTP), because signature verification enforces a strict timestamp replay window.
- Ensure no reverse proxy or WAF strips
X-Campaign-Secret,X-Postmark-Token,svix-signature, orAuthorizationheaders, and that request bodies stay under the 2 MiB limit.
Subscribers Are Missing From a Sendout
Section titled “Subscribers Are Missing From a Sendout”- Check Setup > Campaigns > Subscribers: contacts in
pendingstate have not clicked their Double Opt-In confirmation link yet. - Check Setup > Campaigns > Suppressions: addresses listed as
hard_bounce,complaint, ormanualare excluded from every sendout automatically. - Run
php vendor/bin/wire campaign:send --sendout=<uuid> --dry-run --jsonto inspect the resolved recipient count before dispatching.