• Resolved zahaviliron

    (@zahaviliron)


    Hi,
    Our site uses multiple cf7 forms. We gave each form a webhook and connected it to zapier which sends the lead to a spreadsheet.
    Each time a lead is sent from a form, it enters the database and sent to recipients (as it should), but in some of the cases the lead does not connect with zapier and does not add to thr spreadsheet. We cannot find the reason why sometimes the integration with zapier works and in others it doesnt, even with the same form in a matter of minutes.
    Your input will be much appreciated.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mário Valney

    (@mariovalney)

    Hi!

    Well… maybe a connection problem?

    I’m launching today the 1.4.0 version.
    It will have new hooks and actions to allow users process webhook errors and show a error in form.

    For example, if WordPress throws a Exception (error) in connection it will show the error in form. If you want show a error in another case (if Zapier return 404, for example) you should use “ctz_post_request_result” action.

    For example, this code will check for response code 404 and return a error.

    add_action( 'ctz_post_request_result', 'example_ctz_post_request_result' );
    function example_ctz_post_request_result( $result ) {
        $response = ( ! empty( $result['response'] ) ) ? $result['response'] : [];
    
        if ( ! empty( $response['code'] ) && $response['code'] === 404 ) {
            throw new Exception( 'Integration returned 404 error.' );
        }
    }

    If you want to show this error to user, add this filter to change the default form message:

    add_filter( 'ctz_trigger_webhook_error_message', 'example_ctz_trigger_webhook_error_message', 10, 2 );
    function example_ctz_trigger_webhook_error_message( $message, $exception ) {
        return $exception->getMessage();
    }
    Thread Starter zahaviliron

    (@zahaviliron)

    Thanks, but the thing is that the form works well (always sends to database and e-mails), so i wouldnt want to show an error when the problem is only with the conection to zapier.

    Plugin Author Mário Valney

    (@mariovalney)

    You can change to do something like send mail to you or just log.

    Anyway, the new version will not change your flow (if it’s not a case of request failure). If you want to ignore even the errors in WordPress request and don’t need to user resend data, just add this to your functions.php:

    add_filter( 'ctz_trigger_webhook_error_message', '__return_empty_string' );
    
    • This reply was modified 5 years, 5 months ago by Mário Valney.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘form sent to zapier randomly’ is closed to new replies.