Webhooks Feed Meta

Introduction

The Feed Meta Object for the Webhooks Add-On is an associative array with properties determining how the add-on should process the form submission.

$feed['meta'] = array(
    'feedName'                 => 'Webhook Feed 1',
    'requestURL'               => 'https://example.com/webhook',
    'requestMethod'            => 'POST',
    'requestFormat'            => 'json',
    'requestHeaders'           => array(
        array(
            'key'          => 'Content-Type',
            'custom_key'   => '',
            'value'        => 'application/json',
            'custom_value' => '',
        ),
        array(
            'key'          => 'Authorization',
            'custom_key'   => '',
            'value'        => 'Bearer example_token',
            'custom_value' => '',
        ),
    ),
    'requestBodyType'          => 'all_fields',
    'fieldValues' => array(
    array(
        'key'          => 'custom_param_1', 
        'custom_key'   => '',               
        'value'        => '1',              
        'custom_value' => '',   
    ),
),
    'feedCondition'            => true,
    'feed_condition_object'    => array( 
        'conditionalLogic' => array(
            'actionType' => 'show',
            'logicType'  => 'all',
            'rules'      => array(
                array(
                    'fieldId'  => '1',
                    'operator' => 'is',
                    'value'    => 'Approved',
                ),
            ),
        ),
    ),
);

We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:

$conditional_logic_enabled = rgars( $feed, 'meta/feedCondition' );

if ( $conditional_logic_enabled ) {
    // Conditional logic is enabled for this feed.
    $logic_rules = rgars( $feed, 'meta/feed_condition_conditional_logic_object/conditionalLogic/rules' );
    foreach ( $logic_rules as $rule ) {
        // Process each conditional logic rule.
        $field_id  = rgar( $rule, 'fieldId' );
        $operator  = rgar( $rule, 'operator' );
        $value     = rgar( $rule, 'value' );
        // Example: Use $field_id, $operator, and $value in your logic.
    }
}

Properties

PropertyTypeDescription
feedNamestringThe feed name that appears on the Add-On feeds tab.
requestURLstringThe URL where the webhook request is sent.
requestMethodstringThe HTTP method for the request. Possible values: GET, POST, PUT, PATCH, DELETE.
requestFormatstringThe format of the request body. Possible values: json, form.
requestHeadersarrayA multidimensional array containing the headers for the webhook request. See Custom Field Properties.
requestBodyTypestringSpecifies whether to send all fields (all_fields) or selected fields (select_fields) in the request.
fieldValuesarrayAn array mapping form fields to custom webhook parameters.
Only applicable if requestBodyType is ‘select_fields’.
feed_condition_conditional_logicbooleanIndicates if conditional logic is enabled for the feed. Default is false.
feed_condition_conditional_logic_objectarrayAn associative array containing the conditional logic rules. See Conditional Logic Object.

Custom Field Properties

array(
    'key'          => '',
    'custom_key'   => '',
    'value'        => '',
    'custom_value' => '',
);
SettingTypeDescription
keystringThe name of the custom field.
custom_keystringCustom key for headers.
valuestringThe ID of the form field or entry meta item contains this custom field’s value. Merge tags supported.
custom_valuestringCustom value for the field.