2

I'm still a beginner with PHP so please bear with me. I've installed the Contact Form plugin for Craft by Pixel and Tonic, and have it configured to work as expected.

However, I'd like to have the form also send the data to a Zapier webhook URL so that it will automatically create a lead in my CRM system.

Putting the webhook URL in the "action" field but does send the data correctly to Zapier, but the user goes to a status page (see screnshot below) and the form isn't mailed out to my email.

Screenshot of status message page.

Any help or suggestions on the best way to accomplish this?

2

By putting the webhook URL in the action field, you're completely bypassing the Contact Form's processing of the POST request and getting back a JSON response from Zapier.

I believe the correct way to do this would be to write your own custom Craft plugin that listens to Contact Form's beforeSend event.

When that event gets fired, you can make an AJAX request (using Guzzle or whatever) to Zapier's URL passing in the required fields, get the response back, do with it what you will, then let the Contact Form's controller finish executing and send them email.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.