Skip to content

Integrating custom errors with Feed Error Alerts

If you’re building your own Gravity Forms feed addon, or using one that doesn’t use the standard add_feed_error() method—you can still fully integrate with the Feed Error Alerts plugin.

By manually calling our error handler, you can log and display feed errors in the dashboard and trigger alerts, just like native integrations.

Why use this?

Some addons:

  • Use custom logic for error detection
  • Don’t extend GFFeedAddOn, or
  • Don’t call add_feed_error() when a feed fails

In these cases, Feed Error Alerts won’t detect the failure by default. But you can easily hook into your own error detection and pass the error to our system manually.

 

How to add a custom feed error

Use the following example to integrate seamlessly:

<?php
if ( class_exists("GFFeedErrorAlerts") ) {

    add_action("my_custom_feed_error_detection", function( $feed, $entry, $form, $error_message ){

        $form_id   = rgar($form, 'id');
        $entry_id  = rgar($entry, 'id');
        $feed_id   = rgar($feed, 'id');

        GFFeedErrorAlerts::get_instance()->add_feed_error( $feed_id, $entry_id, $form_id, $error_message );

    }, 10, 4);

}

Method reference

GFFeedErrorAlerts::get_instance()->add_feed_error( $feed_id, $entry_id, $form_id, $error_message );

Example use case

You’ve built a custom integration for a CRM that sends leads via API. The request fails and you detect the error with your own logic:

if ( $response['status'] === 'error' ) {
    do_action( 'my_custom_feed_error_detection', $feed, $entry, $form, 'CRM API request failed: ' . $response['message'] );
}

Need help?

Want help integrating your own feed or have suggestions for a better integration path? Contact us or browse more developer documentation.