Zapier - possible to NOT have to create a new Zap for every form? [RESOLVED]

Looks like there have been other posts about this, but with getting rid of webhooks for the Zapier add-on, we’re now having to create new Zaps for each form. We have HUNDREDS of websites on our multisite with dozens more on the horizon. That’ll be close to impossible to manage in Zapier. Any way around this or way to enable a “legacy” version of the add-on with the webhooks?

For anyone running into this issue, here’s how I solved it:

$formid = get_field('form_id', 'option');
        add_action( 'gform_after_submission_'.$formid, 'post_to_third_party', 10, 2 );

function post_to_third_party( $entry, $form ) {

		    $endpoint_url = get_field('webhook', 'option');
		    $body = array();
		    foreach ( $form['fields'] as $field ) {
		        $inputs = $field->get_entry_inputs();
		        if ( is_array( $inputs ) ) {
		            foreach ( $inputs as $input ) {
		                $value = rgar( $entry, (string) $input['id'] );
		                $key = $field->adminLabel ? $field->adminLabel : $field->label;
		                $body[$key] = $value;
		            }
		        } else {
		            $value = rgar( $entry, (string) $field->id );
		            $key = $field->adminLabel ? $field->adminLabel : $field->label;
		            $body[$key] = $value;
		        }

		    }
		    GFCommon::log_debug( 'gform_after_submission: body => ' . print_r( $body, true ) );

		    $response = wp_remote_post( $endpoint_url, array( 'body' => $body ) );
		    GFCommon::log_debug( 'gform_after_submission: response => ' . print_r( $response, true ) );


}

In Zapier, instead of using the GF Legacy trigger (which you can still use with this method), I decided to use Zapier’s “Webhooks by Zapier” Catch Hook trigger… this way, if GF ever decides again to change how it connects to Zapier, the Zap isn’t affected.

I was originally going to use the Webhooks Add-on, but the problem was that the data keys were based on the field/input IDs, and while we have a lot of the same information being submitted in our web forms, the input/field IDs don’t always line up from form to form. Also, setting up each key manually in GF and/or trying to configure that in Zapier from form to form would be a nightmare.

This method allows you to set the keys based on the field labels (or admin labels) without have to enter each one manually for each form. We also use ACF, so that’s how our form id and endpoint variables are set. We still have to go into each of our zaps and remap our fields, so we still have a bit of a headache to deal with, but it’s a hell of a lot less of a headache than creating a new Zap per form or adding 50+ keys to every webhook on GF.

1 Like

Thanks for sharing that Brittany.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.