• Resolved thetishbyte

    (@thetishbyte)


    I’m trying to make use of the new Webhook feature with Power Automate, but it seems no matter what I do, it will not pass the actual data submitted.

    I’m using the form below:
    {"type":"form","data":{"fields":[{"id":"email-1","element_id":"email-1","form_id":"wrapper-7755-6699","parent_group":"","type":"email","options":[],"cols":"12","conditions":[],"wrapper_id":"wrapper-7755-6699","validation":"","placeholder":"E.g. [email protected]","field_label":"Email Address"}],"settings":{"pagination-header":"nav","paginationData":{"pagination-header-design":"show","pagination-header":"nav"},"formName":"TestWebhook","version":"1.19.0","form-border-style":"none","form-padding":"","form-border":"","fields-style":"open","validation":"on_submit","akismet-protection":"1","form-style":"default","enable-ajax":"true","autoclose":"true","submission-indicator":"show","indicator-label":"Submitting...","form-type":"default","submission-behaviour":"behaviour-thankyou","thankyou-message":"Thank you for contacting us, we will be in touch shortly.","submitData":{"custom-submit-text":"Send Message","custom-invalid-form-message":"Error: Your form is not valid, please fix the errors!"},"validation-inline":"1","form-expire":"no_expire","form-padding-top":"0","form-padding-right":"0","form-padding-bottom":"0","form-padding-left":"0","form-border-width":"0","form-border-radius":"0","cform-label-font-family":"Roboto","cform-label-custom-family":"","cform-label-font-size":"12","cform-label-font-weight":"bold","cform-title-font-family":"Roboto","cform-title-custom-family":"","cform-title-font-size":"45","cform-title-font-weight":"normal","cform-title-text-align":"left","cform-subtitle-font-family":"Roboto","cform-subtitle-custom-font":"","cform-subtitle-font-size":"18","cform-subtitle-font-weight":"normal","cform-subtitle-text-align":"left","cform-input-font-family":"Roboto","cform-input-custom-font":"","cform-input-font-size":"16","cform-input-font-weight":"normal","cform-radio-font-family":"Roboto","cform-radio-custom-font":"","cform-radio-font-size":"14","cform-radio-font-weight":"normal","cform-select-font-family":"Roboto","cform-select-custom-family":"","cform-select-font-size":"16","cform-select-font-weight":"normal","cform-multiselect-font-family":"Roboto","cform-multiselect-custom-font":"","cform-multiselect-font-size":"16","cform-multiselect-font-weight":"normal","cform-dropdown-font-family":"Roboto","cform-dropdown-custom-font":"","cform-dropdown-font-size":"16","cform-dropdown-font-weight":"normal","cform-calendar-font-family":"Roboto","cform-calendar-custom-font":"","cform-calendar-font-size":"13","cform-calendar-font-weight":"normal","cform-button-font-family":"Roboto","cform-button-custom-font":"","cform-button-font-size":"14","cform-button-font-weight":"500","cform-timeline-font-family":"Roboto","cform-timeline-custom-font":"","cform-timeline-font-size":"12","cform-timeline-font-weight":"normal","cform-pagination-font-family":"","cform-pagination-custom-font":"","cform-pagination-font-size":"16","cform-pagination-font-weight":"normal","payment_require_ssl":"","submission-file":"delete","store_submissions":"1","form_name":"TestWebhook","form_status":"draft"},"client_id":null,"integration_conditions":[],"behaviors":[{"slug":"behavior-1234-4567","label":"","autoclose-time":"5","autoclose":"true","newtab":"sametab","thankyou-message":"Thank you for contacting us, we will be in touch shortly.","email-thankyou-message":"","manual-thankyou-message":"","submission-behaviour":"behaviour-thankyou","redirect-url":""}],"notifications":[{"slug":"notification-1234-4567","label":"Admin Email","email-recipients":"default","recipients":"{email-1}","email-subject":"New Form Entry #{submission_id} for {form_name}","email-editor":"You have a new website form submission: <br /> {all_fields} <br />---<br /> This message was sent from {site_url}.","email-attachment":"true","type":"default"}]},"status":"publish","version":"1.19.0"}

    I’ve setup the Webhook Integration and there a couple things with that.
    1. If I use the URL provided in Power Automate (trigger ‘When a HTTP request is received’), Forminator tells me ‘Failed to process request : Unauthorized’.
    2. If I throw in an ampersand (&) at the end of the URL it accepts it, but it doesn’t seem to send any data then, only header information.

    Here is what the trigger receives when I submit the form (some data censored):

    {
        "headers": {
            "Connection": "close",
            "Accept": "application/json",
            "Accept-Encoding": "deflate,gzip",
            "Host": "prod-126.westus.logic.azure.com",
            "Referer": "https://prod-126.westus.logic.azure.com/workflows/########################################/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=##############################################################################",
            "User-Agent": "WordPress/6.0.3; https://dev.#########.### ForminatorWebhook/1.0",
            "X-Hook-Test": "true",
            "Content-Length": "89",
            "Content-Type": "application/json"
        },
        "queries": {
            "/": ""
        },
        "body": {
            "email_1": "Email Address",
            "form_title": "TestWebhook",
            "entry_time": "2022-10-21 09:59:21"
        }
    }

    I’ve searched through Power Automate documentation and articles for hours trying different configurations and my only conclusion is that it’s something with the way Forminator uses the webhook feature that isn’t clear.

    • This topic was modified 2 years, 1 month ago by thetishbyte.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter thetishbyte

    (@thetishbyte)

    Adding to this, I’ve tested the Power Automate endpoint URL (with and without the ampersand) using https://reqbin.com/ to send a sample JSON payload and can confirm that it works just fine.

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @thetishbyte,

    Trust you are doing good, and sorry for the delay in getting back to you.

    I have brought this to the notice of our developers to take a closer look at the issue, and we’ll update you here once we have more insights on this as soon as possible.

    Kind Regards,
    Nebu John

    Thread Starter thetishbyte

    (@thetishbyte)

    Thanks for the update!
    I wanted to also add that I tested this in a separate site on a separate host and ran into the same issue.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @thetishbyte

    Just to update you again – the issue has been reported to our developers and they are checking it to find out what’s causing it and whether it’s a bug in plugin or something specific to this very service/webhook.

    I’d appreciate some patience as our developers are dealing with a lot of complex tasks on daily basis. We’ll update you again once we get to know more.

    Kind regards,
    Adam

    Thread Starter thetishbyte

    (@thetishbyte)

    Hi, just wanted to followup on this.

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @thetishbyte,

    Could you please try this snippet and then check whether it works fine?

    <?php
    /**
     * Plugin Name: [Forminator] Microsoft Power Automate webhook patch
     * Description: Solves a bug that prevents the Power Automate webhooks to work with Forminator
     * Author: Anderson Salas @ WPMUDEV
     * Task: SLS-4290
     * Author URI: https://premium.wpmudev.org
     * License: GPLv2 or later
     */
    
    add_action( 'plugins_loaded', function() {
    	add_filter( 'forminator_addon_webhook_api_url', function( $url, $verb, $path, $args ) {
    		if ( false === strpos( $url, 'azure.com' ) ) {
    			return $url;
    		}
    		$url = str_ireplace( '%2F', '/', $url );
    		$url = str_ireplace( 'triggersmanualrun', '%2Ftriggers%2Fmanual%2Frun', $url );
    		return trim( $url, '/' );
    	}, 10, 4 );
    });

    You can apply the above snippet as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind Regards,
    Nithin

    Thread Starter thetishbyte

    (@thetishbyte)

    Hi, can confirm that this fixed the issue.
    Do you know when/if this fix will be included in the main plugin?

    Also, do mu-plugins like these need to be removed later when fixes like this are implemented?
    Thanks!

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @thetishbyte,

    I’m afraid there isn’t any exact ETA we could provide at the moment on when this will be patched in the plugin version. Hoping it will be soon.

    It would be ideal to remove the snippet once it’s patched in the plugin version.

    Kind Regards,
    Nithin

    Thread Starter thetishbyte

    (@thetishbyte)

    Gotcha, thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Webhook seems to only send header data/Other Power Automate issues’ is closed to new replies.