elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.
https://elementor.com/
GNU General Public License v3.0
6.59k stars 1.42k forks source link

Forms Webhook action has no meta data UI #11086

Open slewisma opened 4 years ago

slewisma commented 4 years ago

Prerequisites

Description

The Webhook after submit action for Forms is coded to pass meta data to the hook but it has no UI for selecting meta data. Unless another action, such as email, is added and has meta fields in it, meta data like the form submit date do not get passed to the hook.

There needs to be a way to specify the meta data fields to include when using only a Webhook after submit action.

Steps to reproduce

Make a form, add a Webhook after submit action and remove all other after submit actions. Set the Webhook up to go to Zapier or a similar service Test the form Review the data received at Zapier, there will be no date in the meta data sent

Now add an email after submit action and make sure Date is one of the meta data items in the Meta Data field in the email action.

Repeat the test and review the received data at Zapier. Date will be present in the received data.

Isolating the problem

Environment

System Info follows but is not relevant in this bug. System Info == Server Environment == Operating System: Linux Software: Apache/2.4.25 (Raspbian) MySQL version: Raspbian 9.11 v5.6.46-86.2 PHP Version: 7.0.33-0+deb9u7 PHP Max Input Vars: 1000 PHP Max Post Size: 128M GD Installed: Yes ZIP Installed: Yes Write Permissions: All right Elementor Library: Connected == WordPress Environment == Version: 5.4 Site URL: https://scottl.hopto.org Home URL: https://scottl.hopto.org WP Multisite: No Max Upload Size: 128 MB Memory limit: 256M Permalink Structure: /%postname%/ Language: en-US Timezone: America/New_York Debug Mode: Inactive == Theme == Name: GeneratePress Version: 2.4.2 Author: Tom Usborne Child Theme: No == User == Role: administrator WP Profile lang: en_US User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:75.0) Gecko/20100101 Firefox/75.0 == Active Plugins == Advanced Custom Fields PRO Version: 5.8.9 Author: Elliot Condon Elementor Version: 2.9.7 Author: Elementor.com Elementor Pro Version: 2.9.2 Author: Elementor.com Give - Donation Plugin Version: 2.6.2 Author: GiveWP GP Premium Version: 1.10.0-beta.1 Author: Tom Usborne Responsive Lightbox & Gallery Version: 2.2.2 Author: dFactory Simple CSS Version: 1.1 Author: Tom Usborne Toolset Access Version: 2.8.4 Author: OnTheGoSystems Toolset Forms Version: 2.5.5 Author: OnTheGoSystems Toolset Types Version: 3.3.10 Author: OnTheGoSystems Toolset Views Version: 3.1.3 Author: OnTheGoSystems WooCommerce Version: 4.0.1 Author: Automattic WooCommerce PayPal Checkout Gateway Version: 1.6.20 Author: WooCommerce == Elements Usage == section : 3 button : 1 wp-post : 0 heading : 1 text-editor : 1 wp-page : 4 heading : 1 == Log == Log: showing 11 of 112020-01-27 23:07:38 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '2.8.4', 'to' => '2.8.5', )] 2020-02-17 20:24:53 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '2.8.5', 'to' => '2.9.2', )] 2020-02-17 20:24:53 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '2.8.3', 'to' => '2.8.4', )] 2020-02-27 10:48:30 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '2.9.2', 'to' => '2.9.3', )] 2020-03-08 10:45:57 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '2.9.3', 'to' => '2.9.4', )] 2020-03-08 10:45:57 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '2.8.4', 'to' => '2.9.0-beta1', )] 2020-03-13 10:28:26 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '2.9.4', 'to' => '2.9.6', )] 2020-03-13 10:28:26 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '2.9.0-beta1', 'to' => '2.9.0-beta2', )] 2020-03-19 09:21:13 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '2.9.0-beta2', 'to' => '2.9.1', )] 2020-03-25 18:01:00 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '2.9.6', 'to' => '2.9.7', )] 2020-03-25 18:01:00 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '2.9.1', 'to' => '2.9.2', )] PHP: showing 1 of 1PHP: 2020-03-20 22:47:51 [notice X 2][/var/www/html/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-url.php::35] Undefined offset: 1 [array ( 'trace' => ' #0: Elementor\Core\Logger\Manager -> shutdown() ', )]
Karenskeens commented 3 years ago

Ditto. The metadata does not appear when using webhooks to connect Elementor Forms to Google Sheets. The metadata shows up fine in the Elementor after-submit emails. But it is missing from the webhook. I use the webhook in Zapier to export Elementor form data to Google Sheets. Unfortunately, only the visible form fields appear in Google sheets. There is no metadata like date, time, IP, etc., which makes the Google Sheets fairly worthless. Elementor, can you please fix this?

Karenskeens commented 3 years ago

Solved: Elementor will push the metatag info into Google Sheets via Zapier IF you have selected "email" in "Actions After Submit". Go to the Elementor form, select "Actions after submit," select "email", then set up the email. It is the first email that generates the metatag. (I had this email turned off because I was using conditional logic to generate secondary emails which don't seem to generate the metatadata.)

roma2341 commented 2 years ago

I want to retreive "Page url" at my webhook, but i forced to enable "after submission: email" to make Elementor adding this metadata. it's very confusing.

hongsigner commented 1 year ago

If I want to bring meta data to the webhook, I must set up the email sending setting. I'll keep in mind.

orchard800 commented 1 year ago

So where do you put your API key? :-D

Zetanova commented 10 months ago

Would be nice not to require to send an email

HonzaKopecky commented 7 months ago

Just burned myself with this too. Noticed some time ago that the email notifications have metadata which are unnecessary, so I removed them from the Email and now a month later I found out that our Make integration doesn't work. Lucky I found this issue.

Please fix this guys! If I am not mistaken this is actually a PRO feature, so it would be really nice to get the paid software working.

yivi commented 6 months ago

It's rather silly that the webhook payload changes depending on other steps. It should be always the same, and there is no reason not to send the "meta" always.

The automatically generated meta includes a page_url field, but on the dynamic fields there is no option to add a page url (although one can add a post id or a page title, which are useful but not the same).

roma2341 commented 6 months ago

It's rather silly that the webhook payload changes depending on other steps. It should be always the same, and there is no reason not to send the "meta" always.

The automatically generated meta includes a page_url field, but on the dynamic fields there is no option to add a page url (although one can add a post id or a page title, which are useful but not the same).

I don't remember if it works, but for dynamic field my java code access meta[page_url][value] field. I think that presence of these field depends on "send email" step.

edpittol commented 3 months ago

This piece of code makes all meta data available to webhook without the need of use email action.

/**
 * @param array       $args   Webhook request arguments.
 * @param Form_Record $record An instance of the form record.
 */
add_filter( 'elementor_pro/forms/webhooks/request_args', function( $args, $record ) {
    $meta_keys = [
        'date',
        'time',
        'page_url',
        'page_title',
        'user_agent',
        'remote_ip',
        'credit',
    ];

    $result = $record->get_form_meta( $meta_keys );

    $args['body']['meta'] = array_merge( $args['body']['meta'], $result );

    return $args;
}, 10, 2 );