• Hi,

    i can send my contact form data to a specific endpoint but i would like to know if it’s possible de return a specific response in case of wrond data sent ?
    For exemple, if in my form there is a ID field, i can check if the ID already exists on my system and return an error with the message “ID already used”.

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ironikus

    (@ironikus)

    Hey. @lerdouille – Thank you for reaching out, as well as for using our plugin! ??
    From what I understood, you send data via the Content Form 7 extension and want to customize the response that comes back, correctly?
    If so, you would need to customize the response from the third-party service you are calling the endpoint at.
    Otherwise, you would need to extend the code by writing your custom PHP code.
    I hope this helps you so far. Feel free to let me know in case I was interpreting your request wrong. ??

    Thread Starter lerdouille

    (@lerdouille)

    Hi @ironikus ,

    thanks for the answer. I didn’t mention it, but yes, i use Contact Forms 7 and WP Hebhook (+contact form wp webhook integration).

    Let me detail the perfect use case : a newsletter form.

    My client give is email adresse, contact forms 7 send the data to my endpoint which control if the email is disposable or if the email already exist in my database.
    If so, my endpoint script will return an erreur and a detail message that i want to display.
    Actually, when my client insert his email, contact forms 7 display a “Message sent, thank you….” without check if my endpoint return a good or wrong response.

    Regards

    Plugin Contributor Ironikus

    (@ironikus)

    Hey @lerdouille – Thank you for your answer.
    If you want to show an error message on a frontend form that is submitted via Contact Form 7, it’s better to write a custom modification for it.
    Since custom development is out of our scope, I’m afraid I can’t really provide you an example here, but I definitely can give you some suggestions of what you can try.

    There’s an action available that allows you to fire after the cf7 webhook was sent:

    do_action( 'wpwhpro/webhooks/trigger_cf7_forms', $form_id, $data_array, $response_data );

    Contact form 7 does the following within the code:

    $this->set_status( 'mail_sent' );
    $this->set_response( $contact_form->message( 'mail_sent_ok' ) );
    
    do_action( 'wpcf7_mail_sent', $contact_form );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Webhooks contact forms Answers’ is closed to new replies.