Zapier
What it does
Sends each new submission of a form to a webhook address, usually a Zap's webhook trigger. From there Zapier can pass it to a spreadsheet, a chat channel or any other app it supports. Each form has its own webhook address, so different forms can feed different Zaps.
Zapier receives the whole submission. You don't choose fields; it gets all of them:
- the form's id and name, and when the submission was sent;
- the submission's number, store view, reference number and approval state, and its status when the form uses statuses;
- the customer account number when a signed-in customer sent it;
- the visitor's IP address, when Save Customer IP Addresses is on. See Settings: Privacy;
- the address and title of the page the form was sent from;
- the address of the page the visitor came from before the form;
- every field's id, code and answer, also of fields marked as personal data and of fields hidden from the submission details. Answers to fields you deleted from the form later are included with their label.
- the stored value of a Password field: the scrambled form while Encrypt Password is on or was never set, and the password itself when it's off. Don't connect Zapier to a form with a Password field.
Each answer arrives in two ways. Under result.fields, it comes as WebForms stores it, for example the value of a
chosen option rather than its label. Under result.values, it comes under the field's code as readable text: an
option by its label, a country by its name, a table row by row. A field with several values, such as ticked options
or the rows of a table, also comes as a list under its code followed by _list, for example
result.values.services_list. In a Zap, map the
names under values. The data is posted as form data, one value per name.
Uploaded files arrive as links or names, not as files. The answer of a File or Image field is the file's download link when the form has Allow Frontend File Downloads on, and the file's name when it's off. Such a link opens the file for anyone who has it; see Uploaded files. The answer of a Gallery field is the web address of each picture the visitor chose. When a field holds several files or pictures, they arrive as one value, one per line. When the visitor sent none, the value is empty, so the name you map in Zapier is there in every request.
Install
composer require mageme/module-webforms-addon-zapier
bin/magento setup:upgrade
Settings
Zapier has no settings in the store configuration. Everything is set per form.
- In Zapier, create a Zap whose trigger is a webhook that catches a request, and copy the webhook address Zapier gives you.
- Go to Content → WebForms → Manage Forms and click the form's name.
- Under Form Information, click Zapier Integration Settings.
- Select Yes in Enable Zapier Webhook.
- Paste the address into Zapier Webhook URL.
- Click Save.
Both settings can differ per store view. Pick the store view in Scope at the top of the page.
Anyone who knows the webhook address can post to your Zap, and the Zap receives personal data. Keep the address private, and turn off or delete the Zap when you stop using it.
How it works
When a visitor submits the form, WebForms saves the submission and then queues it for Zapier. The queue is worked through by Magento's scheduled tasks (cron), so the data reaches Zapier shortly after the visit, not during it. A form set to Do Not Store Submissions sends during the visit instead, before the submission is discarded. Editing a submission later doesn't send it again.
To send submissions that already exist, or to send one again:
- Go to Content → WebForms → Manage Forms.
- In the form's row, click Select in the Actions column, then click Browse Results.
- Select the checkboxes of the submissions.
- Click Actions, then Send to Zapier, and confirm.
WebForms reports how many submissions were sent, skipped and failed. Send to Zapier is in the menu only while Enable Zapier Webhook is Yes and Zapier Webhook URL is filled for the form, and only for admins with the Edit Result permission. A repeated send reaches the Zap again; Zapier doesn't recognise it as a repeat.
To check that it worked, open the Zap's history in Zapier and look for the submission. WebForms doesn't mark a submission as sent.
Troubleshooting
- Nothing reaches Zapier. Check that Enable Zapier Webhook is Yes and Zapier Webhook URL is filled
for the store view the form was sent from. Then ask whoever runs your server to check that Magento cron is
running, and to search Magento's system log for "Zapier" in any letter case. The lines about sending start with
"WebForms integration" and name the service in lowercase, as
zapier. - Zapier didn't answer, or answered with a server error or "too many requests". WebForms tries again, up to three tries in all, waiting longer before each one. After the third failure it gives up and writes an error to the log. Send the submission again from the list once Zapier works.
- The webhook address was refused, for example because the Zap was deleted or turned off. WebForms doesn't try again. Put the current address in Zapier Webhook URL, save, and send the submission again from the list.
- The log says "the webhook URL is refused". WebForms sends only to a public
https://address. An address withouthttps://, or one whose host is local, in a private network, reserved or otherwise not reachable from the internet, is refused, and the submission isn't sent. Use the address Zapier gave you. - The log says "the webhook answered with a redirect". WebForms doesn't follow redirects. Enter the final address in Zapier Webhook URL, save, and send the submission again from the list.
What's next
- Integrations: the other services WebForms can send to.
- Field codes: the codes the Zap sees as field names.
- Privacy and personal data: what counts as personal data in a submission.