While I'm not intimately familiar with Zapier's interface and don't have access to an account to test thoroughly, my understanding is that something like the following should get you most of the way:
Option One: Webhook Method
Create a Zap in Zapier
- Log in to Zapier.
- Create a New Zap
- Set up the Trigger:
- Choose "Webhooks by Zapier" as the trigger app.
- Select "Catch Hook" as the trigger event.
- Copy the unique webhook URL provided by Zapier.
Code Integration
- Create or Edit Your Form
- Define a PHP Function: In the PHP tab (SRC view), define a function to send data to the webhook URL. For example:
function sendToZapier($formData) {
$webhookUrl = "https://hooks.zapier.com/hooks/catch/123456/abcde"; // Your webhook URL
$payload = json_encode($formData);
$ch = curl_init($webhookUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_exec($ch);
curl_close($ch);
}
- Link the Function to the Form Submission: Use the
onsubmitserver
attribute in your form's HTML to call this function on form submission:
<forms:form id="my_form" onsubmitserver="sendToZapier($my_form.getValues())">
<forms:row label="Field 1">
<forms:editbox id="field_1" />
</forms:row>
<forms:row label="Field 2">
<forms:editbox id="field_2" />
</forms:row>
<forms:row type="one_column" align="center">
<forms:submitbutton value="Submit" />
</forms:row>
</forms:form>
You can review using onsubmitserver
to call functions in the API documentation here.
Option Two: Email Parser Method
Set Up the Zapier Email Parser
- Log in to Zapier Email Parser: Go to https://parser.zapier.com/ and log in or create an account.
- Create a Mailbox: Follow the instructions to create a new mailbox. You will receive a unique email address (e.g.
your_mailbox@robot.zapier.com
).
Code Integration
- Create or Edit your form
- Add a
onsubmitemail
attribute to your form with your Zapier email address. *Note that you can add multiple email addresses by comma separating.
Example: <forms:form id="myform" onsubmitemail="admin@mydomain.com, your_mailbox@robot.zapier.com">
Test the Integration
- Fill out and submit your form.
- Verify in Zapier: If using the Webhook method, check the Zapier dashboard to ensure the webhook is receiving the form data correctly. For the Email Parser, Check your Zapier inbox and follow the instructions to correctly parse the form submission data.