Trigging Webhooks Manually

Hi all,

I need to POST data from a form to an external server. I can set this up with a Webhook. This brings me to two features that I don’t seem to have here…

  • The ability to trigger a webhook with an entry’s data manually, mainly for testing/debugging.
  • The ability to control when a webhook happens… There is conditional logic, but that doesn’t really apply.

Specifically, I am sending details of a payment to another server, but I don’t want it to happen until (or unless) the payment status Completed. When using Stripe or PayPal, the entries status is pending until the callback happens that changes the status to Completed.

Some correspondence with Support helped me piece these code blocks together in my functions file.

add_action( 'gform_after_update_entry', function ( $form, $entry_id ) {
    if ( function_exists( 'gf_webhooks' ) ) {
        $entry = GFAPI::get_entry( $entry_id );
        gf_webhooks()->maybe_process_feed( $entry, $form );
        gf_feed_processor()->save()->dispatch();
    }
}, 10, 2 );

add_action( 'gform_post_payment_completed', function ( $form, $entry_id ) {
    if ( function_exists( 'gf_webhooks' ) ) {
        $entry = GFAPI::get_entry( $entry_id );
        gf_webhooks()->maybe_process_feed( $entry, $form );
        gf_feed_processor()->save()->dispatch();
    }
}, 10, 2 );

If I am understanding correctly, those should process the webhooks if an entry is updated or if the payment status Completed happens. When those are applied, I don’t see Webhooks log entries for any webhook processing, but is that because logging isn’t a part of those actions?

How can I further debug this?

It would be nice if the Webhooks Add-on had all of the same options as the Notifications section, such as the Event, and also the ability to Retrigger, just like you can resend Notifications.

image

I’d like to second this functionality as well. We’ve custom developed a plugin to re-send webhooks and Zapier hooks, but would prefer to use an officially supported plugin rather than hacking it together. To echo what @muzicman82 said, this is critical functionality from a testing standpoint.

This free plugin allows BULK retriggering of Webhooks (Process feeds and select webhook name). I’m still struggling with automatic resubmit on edit, but this is a workaround for me.

Gravity Forms Utility from GravityPlus
https://gravityplus.pro/gravity-forms-utility/

1 Like