Skip to main content

CLI, cron and queues

Overview​

WebForms adds console commands under the webforms: namespace, cron jobs in Magento's default group and in a group of its own, and one message queue for integration add-ons. Run the commands from the Magento root as the user that owns the files:

php bin/magento list webforms
php bin/magento webforms:audit:export --help

There are ten commands: eight from MageMe_WebForms, webforms:legacy from MageMe_WebFormsMigration and webforms:api:connect from MageMe_WebFormsApi. Six of them group several actions, and the action is a word after the command, separated by a space: webforms:report, webforms:backfill, webforms:upgrade:migrate, webforms:files, webforms:notifications and webforms:legacy. Run without an action, each of them lists its actions and changes nothing:

php bin/magento webforms:files
php bin/magento webforms:files status

The Writes column says whether a command changes data. No means it only reads. Take a database backup before you run a command that writes on a live store.

Commands​

Reports​

webforms:report <name> prints one read-only report. Without a name it lists the reports.

Command What it reports Options Writes
webforms:report field-codes Field codes that break the code rules, repeat another code on the same form, differ only in letter case, or match a reserved name. — No
webforms:report reference-numbers Reference numbers held by more than one submission, and numbers stored as an empty string. Either one stops the unique index on reference numbers. — No
webforms:report legacy-values Field values, store view overrides and On Load scripts that still use 3.x template variables such as {{var customer.email}}. — No
webforms:report templates Renders the popup fragment of every active form in every store view and lists the executable scripts each fragment carries. --form=<id> No
webforms:report snapshots Submissions with a missing or out-of-date snapshot, and file rows without a value row. Repair with webforms:backfill snapshots --repair. — No
webforms:files status Where stored submission files are, against the configured storage root, and rows that point at a missing file. --from=<root> No
webforms:upgrade:check Whether notifications are ready for an upgrade window, or have recovered from one. Prints READY, READY WITH WARNINGS or NOT READY and exits with 0 (also with warnings) or 1. After an upgrade from 3.x, the forms that can't deliver a Form Submitted email are split into those that had one in 3.x that isn't active now, those that had none in 3.x either, and those created after the upgrade. Each quarantined notification cause is printed as Quarantined (N): <cause>. A notification that still sends from a custom From address carried over from 3.x is listed in an information line that starts Custom From carried over from 3.x: and doesn't change READY. --window, --json, --no-legacy, --record, --acknowledge, --checklist (prints the 3.x email settings that moved into notifications, as a checklist of what to set up by hand, instead of the check) No, unless --record or --acknowledge. --record first recomputes and stores each form's email readiness flag and the list of forms that stopped sending after the upgrade, the work of the webforms_email_readiness_refresh job, and cleans the config cache. --acknowledge dismisses the "forms without notifications" admin notice.
webforms:legacy status What WebForms 1 and 2 data is present and whether it can be migrated safely. From the MageMe_WebFormsMigration module. — No

webforms:audit:export​

Prints the WebForms audit log as JSON Lines, one event per line, oldest first, to standard output. It reads the mm_webforms_audit table in batches of 1000 rows and changes nothing.

Option Effect
--since="<Y-m-d H:i:s>" Only events created at or after this time, in UTC.
--after-id=<id> Only events with an audit_id greater than this. Default 0. Pass the last id you exported to continue from there.
--event=<type> Only this event type, for example restore_version or result_status.
php bin/magento webforms:audit:export --event=restore_version > webforms-audit.jsonl

Each line holds the columns of one row, with context_json decoded:

{"audit_id":"5631","event":"restore_version","actor_type":"integration","actor_id":"5","actor_name":"WebForms MCP","request_id":"b46-restore-001","object_type":"form","object_id":"995542","outcome":"ok","context_json":{"version_id":995546,"draft_id":995547},"created_at":"2026-10-05 20:19:10"}

The webforms_audit_retention job deletes rows older than Audit Log Retention (Days). Export them first if you keep the log elsewhere. What the log records is described for store owners on Audit log.

Repair and backfill​

webforms:backfill <step> fills in what earlier submissions lack. Without a step it lists the steps and what each has left, and changes nothing; --all runs the upgrade steps inbox, snapshots and typed-values in order. Every step takes --dry-run.

Command What it does Options Writes
webforms:notifications repair Gives forms that send nothing the admin notification they are missing. Asks before writing. --form-id=<ids>, --dry-run, --yes (required without a terminal) Yes, unless --dry-run
webforms:notifications retry Hands notification targets back to delivery. --held renders the targets held without a body. --dead returns dead targets to the queue, with a fresh attempt budget, once the cause is gone, for example after Magento's Disable Email Communications is set back to No. The delivery cron then sends them. --dead refuses to run without --dispatch, --form or --since. --held, --dead, --dispatch=<id>, --form=<id>, --since=<date> (YYYY-MM-DD, UTC), --dry-run Yes, unless --dry-run
webforms:backfill inbox Fills the Inbox columns submitter_email, submitter_name and inbox_label of older submissions. Safe to run again; resumable. After Hide in Submissions is switched on for a field a form's Submission Title uses, run webforms:backfill inbox --form=<id>: the Inbox and an order's Submissions tab show a saved copy of each title, which keeps the hidden answer until it is written again. --batch=<n> (default 500), --from-id=<id>, --form=<id> Yes, unless --dry-run (which only counts and takes no --form or --from-id)
webforms:backfill snapshots Creates submission snapshots for older submissions; without --repair or --force, an existing snapshot is never overwritten. Resumable. --batch=<n> (default 500), --repair, --no-resume, --force (re-stamps every snapshot) Yes, unless --dry-run
webforms:backfill typed-values Fills the typed search columns value_number and value_date of stored answers. Values that cannot be parsed are reported and left as they are. Resumable. --batch=<n> (default 5000), --no-resume, --max-batches=<n> Yes, unless --dry-run
webforms:backfill reference-numbers Gives a reference number to submissions that have none. Reports only, unless --apply is given; --apply and --dry-run can't be combined. --apply, --form=<id>, --limit=<n> Only with --apply
webforms:status:resume Resumes failed or stranded status removal jobs. --job=<id> Yes

Upgrade and migration​

Command What it does Options Writes
webforms:upgrade:migrate notifications Carries the 3.x per-form email settings into notifications, as setup:upgrade does. Safe to run again. --form=<id>, --dry-run, --acknowledge-legacy-columns-absent, --purge-payload (removes the raw 3.x values, addresses included, from the migration ledger) Yes, unless --dry-run
webforms:upgrade:migrate notification-templates Moves the content of notifications that point at a Magento email template inside the notification, as setup:upgrade does. Safe to run again. --notification=<id>, --dry-run Yes, unless --dry-run
webforms:upgrade:migrate pdf-templates Carries 3.x print email templates over to PDF documents, switched off, or lists what would be carried. --form=<id>, --dry-run Yes, unless --dry-run
webforms:files migrate Copies stored submission files to the configured storage root. Copies only. --from=<root>, --dry-run, --accept-unknown-shapes Yes, unless --dry-run
webforms:files reclaim Removes the old copies after proving that each file exists, byte for byte, under the storage root. --from=<root>, --dry-run, --accept-unknown-shapes Yes, unless --dry-run
webforms:files move-legacy Lists every customer notification attachment and the files still in the legacy directory, with the reason each one stays. Without --move it only reports and moves nothing. --move (moves what can be moved now) Only with --move
webforms:legacy migrate Migrates forms and submissions from WebForms 1 and 2. From the MageMe_WebFormsMigration module; run webforms:legacy status first. Only one run at a time. — Yes

Commands of 3.x that 4.0 doesn't have​

A script that calls one of these stops with "Command is not defined".

Removed Use instead
webforms:media:sync Nothing: WebForms 4 keeps submission files under its private storage root on disk, so there is no remote copy to fill.
webforms:migrate The WebForms 1 and 2 migration package: webforms:legacy status, then webforms:legacy migrate. See Coming from WebForms 1 or 2.

API connection​

Command What it does Options Writes
webforms:api:connect Creates and activates the Magento integration an MCP server or another API client signs in with, and prints the connection string. From the MageMe_WebFormsApi module. --name (default WebForms MCP), --preset=reader|editor|support|full (default editor), --permissions, --email, --base-url, --forms=all|selected, --reissue, --raw Yes

Each module registers its commands in Magento\Framework\Console\CommandListInterface in its etc/di.xml (MageMe_WebForms: etc/di.xml).

Upgrade scripts​

Three scripts help with the upgrade from WebForms 3. They are not bin/magento commands. preflight.php and refresh-canonical-staff-mail.php ship in the WebForms package's bin/ folder, described in bin/README.md. wf4-readiness.php is not part of the package: download it, with its checksum file, as Upgrading from WebForms 3 describes. Each prints its usage with --help and exits with 0; the readiness script also accepts -h.

Script When What it does
wf4-readiness.php [<magento-root>] [--json] [--acknowledge-print-templates] [--version] On the 3.x installation, before composer update; it also runs on 4.x, after the upgrade Checks whether the store is ready for WebForms 4. Without a folder it checks the current folder. It doesn't load Magento, so it works while the code is half upgraded, and it honours the database table prefix. Ends with READY, READY WITH WARNINGS or NOT READY. Exits with 0 when ready, with or without warnings, and 1 on blocking findings. It exits with 2 when the check could not finish: the folder is not a Magento root, or the data checks were skipped because app/etc/env.php names no database, the database can't be reached, the PHP running the script has no pdo_mysql extension (run it with the PHP that runs bin/magento) or a query failed. --acknowledge-print-templates is still accepted and changes nothing: a custom print template is a warning, not a block.
preflight.php With the 4.0 code installed, before setup:upgrade Checks the 3.x email settings the migration will read. Writes nothing.
refresh-canonical-staff-mail.php After the upgrade Brings a migrated Form Submitted email to your team up to the current standard text, only where its text was never edited. Reports by default; writes with --apply.

Setting integration keys from the command line​

The integration add-ons show their settings under WebForms → Integrations, in a group per service, but store them under webforms/<service>/<setting> (the field's config_path). bin/magento config:set looks a setting up by its position in the settings tree, so for these settings use the tree path:

bin/magento config:set webforms/integrations/freshdesk/api_key '<key>'

Under the storage path (webforms/freshdesk/api_key), config:set doesn't find the setting, so the value is saved unprotected, as plain text, and the integration can't use it, because it decrypts the stored value. With the tree path, the key is saved encrypted. Use the tree path, or enter the key in Stores → Configuration. The same applies to the keys, tokens and secrets of the other integrations with settings in this group (HubSpot, Salesforce, Zoho, Freshdesk, Zendesk, Klaviyo).

Cron jobs​

The jobs run only when Magento's cron is installed (bin/magento cron:install, or a crontab line that runs bin/magento cron:run every minute). Many jobs check a setting first and do nothing while it is off; the Runs when column names it.

Group default​

Job Schedule Class What it does Runs when
webforms_message_files_purge */30 * * * * MageMe\WebForms\Cron\MessageFilesPurge Deletes reply attachments past their retention period. Delete Old Reply Attachments is on
webforms_gallery_files_purge */30 * * * * MageMe\WebForms\Cron\GalleryFilesPurge Deletes Gallery field images no field uses any more. Delete Unused Gallery Files is on
webforms_uploader_cleanup 0 * * * * MageMe\WebForms\Cron\UploaderCleanup Removes stale temporary upload directories. Always
webforms_data_cleanup */30 * * * * MageMe\WebForms\Cron\DataCleanup Deletes submissions older than their form's retention period, and the uploaded files of submissions older than the form's file retention period. Every run also deletes the submission tokens that protect against a double submit once they are older than 24 hours. Per form, when the form's cleanup is on; the tokens always
webforms_stat_calc */15 * * * * MageMe\WebForms\Cron\StatCalc Reconciles form statistics with the stored submissions, writing only the counters that are wrong. Refresh Counters by Cron doesn't switch this job off: with the setting off, the forms grid also recounts each time it opens. Always
webforms_field_trash_purge 30 3 * * * MageMe\WebForms\Cron\FieldTrashPurge Deletes removed fields, and what is stored under them, after the grace period. Delete Removed Fields is on
webforms_audit_retention 20 3 * * * MageMe\WebForms\Cron\AuditRetention Deletes audit log rows older than the retention period. Audit Log Retention (Days) is above 0
webforms_status_retire_jobs * * * * * MageMe\WebForms\Cron\StatusRetireJobs Runs pending status removal jobs, which move submissions off a removed workflow status. Always
webforms_notification_snapshot_retention 20 3 * * * MageMe\WebForms\Cron\NotificationSnapshotRetention Removes the text of delivered messages past retention and keeps the delivery record. Always; the period is Keep Sent Message Text for (Days)
webforms_notification_quota_purge 30 3 * * * MageMe\WebForms\Cron\NotificationQuotaPurge Deletes notification limit windows that started more than the longest limit window ago, one day by default, so the table doesn't grow without end. Always
webforms_notification_source_retention 25 3 * * * MageMe\WebForms\Cron\NotificationSourceRetention After 180 days, removes the text of the notification source snapshots, the copies of a notification's content kept when the upgrade moved it out of a Magento email template and when an earlier state was restored, and of the upgrade's conversion reports, and keeps their hashes. The snapshot of the revision that is live now stays: a notification moved out of a Magento email template is sent from it. Always
webforms_inbound_mail_poll * * * * * MageMe\WebForms\Cron\InboundMailPoll Reads new mail from the reply mailbox of each store. Collect Replies by Email is on and the store reads a mailbox (IMAP), not a webhook
webforms_inbound_mail_process * * * * * MageMe\WebForms\Cron\InboundMailProcess Files fetched replies into their submissions. Collect Replies by Email is on
webforms_inbound_journal_purge 40 3 * * * MageMe\WebForms\Cron\InboundJournalPurge Deletes expired raw copies of inbound mail, finished journal rows and orphan files. Always
webforms_email_readiness_refresh 50 3 * * * MageMe\WebForms\Cron\EmailReadinessRefresh Recomputes whether each form can send email, and flags forms that stopped sending after an upgrade. Always
webforms_api_purge_expired 15 * * * * MageMe\WebFormsApi\Cron\PurgeExpired Removes expired API request keys, confirmation tokens, personal-data grants, download links and import files. Always
webforms_api_reply_send * * * * * MageMe\WebFormsApi\Cron\ReplySender Sends replies queued through the API. Always
webforms_api_export_run * * * * * MageMe\WebFormsApi\Cron\ExportRunner Runs queued API export jobs and expires old export files. Always
webforms_api_import_run */2 * * * * MageMe\WebFormsApi\Cron\ImportRunner Moves API import jobs along: validates uploaded files and continues half-written imports. Always
mm_webformsgraphql_purge_captcha_tokens */30 * * * * MageMe\WebFormsGraphQl\Cron\PurgeCaptchaTokens Removes expired GraphQL CAPTCHA tokens. Always
mageme_core_license_coverage 17 * * * * MageMe\Core\Cron\RefreshLicenseCoverage Refreshes the license coverage of MageMe modules. Always
webforms_mailchimp_lists_warm */15 * * * * MageMe\WebFormsMailchimp\Cron\WarmGroupLists Fetches Mailchimp group lists ahead of use. Mailchimp add-on only. A store has an account and a form has a Mailchimp Group field
webforms_zendesk_lists_warm */15 * * * * MageMe\WebFormsZendesk\Cron\WarmGroupLists Fetches Zendesk lists ahead of use. Zendesk add-on only. The Zendesk library is installed and an account is set up

The settings are on Privacy settings, Email & Replies settings and Results settings.

Group webforms_delivery​

Job Schedule Class What it does Runs when
webforms_notification_delivery * * * * * MageMe\WebForms\Cron\NotificationDelivery Recovers attempts an earlier run left behind, then delivers queued notification emails until the queue is empty, for at most 50 seconds per run. Deliver Notifications is on; it is off on a new install

etc/cron_groups.xml declares the group with schedule_generate_every 1, schedule_ahead_for 4, schedule_lifetime 2, history_cleanup_every 10, history_success_lifetime 60, history_failure_lifetime 600 and use_separate_process 1. Notification email does not go through the message queue: on a server whose cron runs only --group=default, every notification stays queued.

To run one delivery pass now, run the group by hand:

bin/magento cron:run --group=webforms_delivery --bootstrap=standaloneProcessStarted=1

A pass that finds this minute's run already taken by the store's cron does nothing; run it again a minute later. webforms:upgrade:check shows how many emails are in each state.

To see what ran, read cron_schedule:

SELECT job_code, status, MAX(executed_at)
FROM cron_schedule
WHERE job_code LIKE 'webforms%'
GROUP BY job_code, status;

Message queue​

Integration add-ons (Zapier, HubSpot, Salesforce, Zoho, Freshdesk, Zendesk, Klaviyo, Mailchimp) send new submissions through one queue. WebForms publishes nothing else to a queue.

Item Value Declared in
Topic mageme.webforms.integration.send, asynchronous, request type MageMe\WebForms\Api\Data\IntegrationMessageInterface etc/communication.xml
Publisher connection db, exchange magento-db etc/queue_publisher.xml
Binding topic → queue mageme.webforms.integration.send etc/queue_topology.xml
Consumer mageme.webforms.integration.send, connection db, handler MageMe\WebForms\Model\Integration\Consumer::process etc/queue_consumer.xml

The queue uses the MySQL connection, so RabbitMQ is not needed. Messages are rows in queue_message and queue_message_status. A message carries ids only, never answers:

{"integration_code":"klaviyo","result_id":1135919,"is_new":true,"store_id":3,"attempt":1}

Running the consumer​

Magento's consumers_runner cron job starts the consumer unless cron_consumers_runner in app/etc/env.php turns that off or leaves this consumer out of its list. Without that setting Magento starts every consumer with --max-messages=10000. You can also run it yourself, for example under a process supervisor:

php bin/magento queue:consumers:start mageme.webforms.integration.send --max-messages=1000

When nothing runs the consumer, integration messages stay in the queue and nothing reaches the services. One case skips the queue: a new submission of a form that does not store submissions, made on the storefront or through the REST API or GraphQL, is sent during the request, because it is deleted right after.

Retries​

The consumer delivers a message up to three times in all. The second try waits at least 60 seconds after the first failure and the third at least 300 seconds after the second (Consumer::RETRY_DELAYS). When the service names a longer wait, the retry follows it, up to 3600 seconds. A message taken from the queue before its time is put back as a new row, and each put-back counts toward --max-messages. A refusal the add-on marks as final is logged and not retried. Failures go to var/log/system.log, a warning for each retry and an error when the consumer gives up, without the submitted values.

To see the state of the queue:

SELECT s.status, COUNT(*)
FROM queue_message_status s
JOIN queue q ON q.id = s.queue_id
WHERE q.name = 'mageme.webforms.integration.send'
GROUP BY s.status;

Status 2 is new, 3 in progress, 4 complete, 5 retry required, 6 error, 7 marked for cleanup.

What's next​

Applies to WebForms 4Last reviewed November 24, 2026