|
/ Documentation /Developer Hooks & Events/ OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook

OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook

Overview

The suredonation_suretriggers_integration_data_filter filter allows developers to modify the configuration payload sent to the OttoKit embed iframe, formerly known as SureTriggers.

The iframe is injected into the SureDonation form builder when a user configures an automation. You can use this filter to customize the embed configuration or modify the sample data displayed during automation setup.

When to Use This Filter

Use this filter when you need to customize the data passed to the OttoKit integration interface.

For example, you can use it to:

  • Modify the automation summary.
  • Customize the sample response.
  • Adjust integration configuration.
  • Change embed settings.
  • Add or modify values in the payload sent to OttoKit.

Filter Signature

apply_filters( 'suredonation_suretriggers_integration_data_filter', $body, $campaign_id, $form_id );

Parameters

ParameterTypeDescription
$bodyarrayConfiguration payload sent to the OttoKit embed.
$campaign_idintThe resolved SureDonation campaign ID.
$form_idintThe donation form ID from which the integration embed was opened.

$body Payload

The $body array contains configuration information used to initialize the OttoKit embed.

Common keys include:

KeyDescription
client_idIdentifies the integration client. For SureDonation, this is SureDonation.
st_embed_urlURL used to load the OttoKit embedded interface.
embedded_identifierCampaign ID associated with the automation.
targetTarget configuration for the embed.
eventThe automation trigger definition, such as Donation Completed.
summaryCampaign name or automation summary.
selected_optionsSelected integration options.
integrationIntegration configuration data.
sample_responseSample response data displayed while configuring the automation.

Return Value

The callback must return the payload as an array.

You can return:

  • The original $body array.
  • A modified version of the $body array.

The returned array is sent as the data field in the AJAX success response.

Basic Usage

Use add_filter() to register your callback.

add_filter( 'suredonation_suretriggers_integration_data_filter', 'your_custom_function', 10, 3 );

function your_custom_function( $body, $campaign_id, $form_id ) {

    // Modify the embed payload here.

    return $body;

}

Example: Customize the Automation Summary

The following example changes the summary displayed for the automation.

add_filter(

    'suredonation_suretriggers_integration_data_filter',

    'mysite_embed_summary',

    10,

    3

);

function mysite_embed_summary( $body, $campaign_id, $form_id ) {

    $body['summary'] = 'Automation for campaign #' . $campaign_id;

    return $body;

}

This changes the summary to include the campaign ID associated with the automation.

Example: Modify Sample Response

You can also customize the sample response shown while configuring an automation.

add_filter(

    'suredonation_suretriggers_integration_data_filter',

    'mysite_modify_sample_response',

    10,

    3

);

function mysite_modify_sample_response( $body, $campaign_id, $form_id ) {

    if ( isset( $body['sample_response'] ) ) {

        $body['sample_response']['custom_field'] = 'Example value';

    }

    return $body;

}

Integration Flow

The filter is applied as part of the SureDonation and OttoKit integration flow:

  1. The user opens the OttoKit integration from the SureDonation form builder.
  2. SureDonation determines the related campaign and donation form.
  3. SureDonation prepares the integration configuration payload.
  4. The suredonation_suretriggers_integration_data_filter filter is applied.
  5. Your callback can modify the payload.
  6. SureDonation returns the modified payload through the AJAX response.
  7. The payload is passed to the OttoKit embedded interface.

Related Hooks

  • suredonation_donation_completed
    Runs when a donation is successfully completed.
  • suredonation_new_donation
    Runs when a new donation is created.
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Table of Contents
Scroll to Top