Skip to content

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.

Verifies database schema health across all 5 managed SQL tables, Entries blueprints, Contacts availability, active WireMail transport, webhook secrets, and sibling integrations.

Terminal window
php vendor/bin/wire campaign:doctor --json

Seeds starter Campaign Types, Mailing Lists, Campaigns, Segments, and Sendouts idempotently.

Terminal window
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.

Dispatches a specific sendout by UUID or processes all due scheduled and recurring sendouts.

Terminal window
# Dispatch one sendout asynchronously via ProcessSendoutBatchQueue
php 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.

Synchronizes ProcessWire user roles configured on Mailing Lists (sync_user_roles) into campaign_subscriptions.

Terminal window
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.

Imports subscribers from a UTF-8 CSV file into a target mailing list via TransferService.

Terminal window
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.

Exports subscribers from a mailing list to a formula-safe UTF-8 CSV file.

Terminal window
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.

Scrubs PII from historical campaign records for GDPR erasure or retention enforcement.

Terminal window
# Anonymize records older than 365 days
php vendor/bin/wire campaign:anonymize --older-than=365 --dry-run --json
# Anonymize a specific contact immediately
php 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.

In production, keep both the queue worker and the task scheduler running via processwire-console:

Terminal window
# 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=3

Scheduled Sendouts Stay in Scheduled State

Section titled “Scheduled Sendouts Stay in Scheduled State”
  • Confirm your system cron executes php vendor/bin/wire schedule:run every minute.
  • Verify ProcessScheduledSendoutsTask is registered by running php vendor/bin/wire schedule:list --json.
  • Test manually with php vendor/bin/wire campaign:send --due --dry-run --json.
  • Set Site Base URL (site_base_url) under Setup > Campaigns > Settings > General & Brand to your public https:// origin.
  • CampaignRenderer absolutizes root-relative <img src="/site/assets/..."> paths using site_base_url; if your site runs behind a local hostname during CLI queue dispatch, $config->httpHost alone may resolve to localhost.
  • 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, or Authorization headers, and that request bodies stay under the 2 MiB limit.
  • Check Setup > Campaigns > Subscribers: contacts in pending state have not clicked their Double Opt-In confirmation link yet.
  • Check Setup > Campaigns > Suppressions: addresses listed as hard_bounce, complaint, or manual are excluded from every sendout automatically.
  • Run php vendor/bin/wire campaign:send --sendout=<uuid> --dry-run --json to inspect the resolved recipient count before dispatching.

Next steps