Title: Custom Webhook
Last modified: May 31, 2023

---

# Custom Webhook

 *  Resolved [HoneyBee](https://wordpress.org/support/users/neilgroll/)
 * (@neilgroll)
 * [3 years ago](https://wordpress.org/support/topic/custom-webhook-2/)
 * We are wanting to define a Custom Webhook (rather than using Zapier etc), as 
   this will send data to our internal CRM (not supported by Forminator integrations).
 * In Forminator, is it possible to configure a Webhook, which:
    1. Set HTTP POST header info like Content-Length and Content-Type
    2. Define a custom payload like:
       form_email=[email]&form_title=[title]&form_firstname
       =[firstname]
 * (We currently do this in Gravity Forms, so were hoping to move over to Forminator
   with the same functionality).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [3 years ago](https://wordpress.org/support/topic/custom-webhook-2/#post-16782204)
 * Hi [@neilgroll](https://wordpress.org/support/users/neilgroll/)
 * I hope you’re well today and thank you for your question!
 * The built-in Webhook isn’t limited to Zapier and similar and it can use any webhook
   URL provided that the target is capable or handling such POST request.
 * However, the format and data sent is the same regardless of used URL and there
   is not “point and click” way to customize it. It could be possible to some degree
   with additional custom code based on available action/filter hooks.
 * However, given the case you described, I’d suggest using this code instead:
 * [https://gist.github.com/adczk/a314ad50036ffd449147d28f2e876e2b](https://gist.github.com/adczk/a314ad50036ffd449147d28f2e876e2b)
 * It should give you that exact functionality that you need. Note: it says it’s“
   to send to other form” but in fact it is actually making POST request just like
   webhook integration but very customizable.
 * To add it to site:
 * – simply create an empty file with .php extension (e.g. “forminator-custom-webhook-
   tool.php)
 * – copy and paste code into it
 * – set your form ID and webhook URL in these lines
 *     ```
       $form_ids = array( 123 ); // ID of form(s) to push to external source; one or more, comma separated
       $target_url = 'https://external-form-action-url.com'; // URL to post data to 
       ```
   
 * – save the file and upload it to the “/wp-content/mu-plugins” folder of your 
   site’s WordPress install.
 * This should work out of the box but you will want to customize it to your needs
   and here is how:
 * 1. To define “payload”, look at this part of the code
 *     ```
       $field_mapping = array( 
        'name-1' => 'FIRST_NAME',
        'email-1' => 'EMAIL', 
       );
       ```
   
 * This sends two form fields – name-1 and email-1 – to webhook under the FIRST_NAME
   and EMAIL “lables”. You would want to change that to define your fiedls where
   the left “column” are names of Forminator form fields to be send and the right“
   column” are names that are used at “target” (webhook).
 * 2. In this part you can define any additional data that you want to send to webhook
   that are not on the form
 *     ```
       $fields_extra = array(
       		'FORM_ID' => '123', 
       		'HIDDEN_MSG' => 'Hey! I am hidden field!', 
       	);
       ```
   
 * where on the left you got target variable/field name (so the one on “webhook’s
   end”) and on the right you got value that should be assigned to it. Note: these
   aren’t headers; this is sent the same way and together with form data (see p.
   1) but just additional in case you wanted to send also data that is not coming
   from the form.
 * 3. Finally, headers:
 *     ```
       $request_args = array(
       		'method' => 'POST',
       		'timeout' => 30,
       	);
       ```
   
 * In this part (ignore that it says above to not edit) you can add your headers
   but you need to slightly change it. For example
 *     ```
       $request_args = array(
       'method' => 'POST',
       'timeout' => 30,
       'headers' => array(
         'Content-Length' => 123,
         'Content-Type' => 'text/html'
       ),
       );
       ```
   
 * That’s just an example of course and you’ll probably want to set your own headers
   and data but I believe the configuration of this script is pretty simple.
 * If you have any other/additional questions, let us know.
 * Best regards,
    Adam
 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [3 years ago](https://wordpress.org/support/topic/custom-webhook-2/#post-16809069)
 * Hello [@neilgroll](https://wordpress.org/support/users/neilgroll/) ,
 * We haven’t heard from you for over a week now, so it looks like you no longer
   need our assistance.
 * Feel free to re-open this ticket if needed.
 * Kind regards
    Kasia

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Webhook’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [webhook](https://wordpress.org/support/topic-tag/webhook/)

 * 2 replies
 * 3 participants
 * Last reply from: [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/custom-webhook-2/#post-16809069)
 * Status: resolved