|
/ Documentation /Getting Started/ Webhook Conditional Logic

Webhook Conditional Logic

Feature Overview

SureForms has introduced an advanced Conditional Logic feature for webhooks. This powerful tool enables users to define specific conditions that dictate when a webhook is triggered. With this functionality, users can ensure that webhooks are executed only when predefined criteria based on field values are met. This not only enhances precision but also optimizes workflow automation.

Key Benefits:

  • Targeted Execution: Trigger webhooks only when necessary, reducing unnecessary data processing.
  • Customizable Logic: Tailor triggers to specific scenarios for better control.
  • Improved Efficiency: Streamline workflows and eliminate redundant webhook calls.

Logic Matching Modes

Before configuring conditions, users must select one of two logic matching modes:

  1. Any: The webhook triggers if any one of the conditions is satisfied.
  2. All: The webhook triggers only if all specified conditions are met.

This flexibility ensures compatibility with a wide range of use cases, from simple to complex triggering scenarios.

Conditional Operators

SureForms provides a robust set of conditional operators to define rules:

  • Is: Triggers when the field value equals the specified value.
  • Is Not: Triggers when the field value does not equal the specified value.
  • Is Greater Than: Triggers when the field value is greater than the specified value.
  • Is Greater Than or Equal To: Triggers when the field value is greater than or equal to the specified value.
  • Is Less Than: Triggers when the field value is less than the specified value.
  • Is Less Than or Equal To: Triggers when the field value is less than or equal to the specified value.
  • Starts With: Triggers when the field value begins with the specified value.
  • Ends With: Triggers when the field value ends with the specified value.
  • Contains: Triggers when the field value includes the specified value.
  • Does Not Contain: Triggers when the field value does not include the specified value.
  • Regex: Triggers when the field value matches a specified regex pattern. Learn more about regex.

How It Works

Defining Conditions

Users can create one or more conditions using the available operators. Each condition references a specific field value within the form.

Webhook Execution

Webhook execution is determined by:

  • The selected logic matching mode (Any or All).
  • The conditions specified by the user.

Use Cases

Here are a few scenarios where Conditional Logic for webhooks can be highly effective:

  • Age Verification: Trigger a webhook only if the user’s age exceeds 18.
  • Keyword Matching: Send a webhook if a field contains a particular keyword.
  • Regex Validation: Execute a webhook when a field value matches a regex pattern.

Examples

Example 1: Age Restriction

  • Matching Mode: All
  • Conditions:
    • Field Age is greater than or equal to 18.
    • Field Consent is “Yes”.
  • Outcome: The webhook triggers only if the user is 18 or older and has given consent.

Example 2: Location-Based Trigger

  • Matching Mode: Any
  • Conditions:
    • Field Country is “United States”.
    • Field Country is “Canada”.
  • Outcome: The webhook triggers if the user is from either the United States or Canada.

Example 3: Text Matching

  • Matching Mode: All
  • Conditions:
    • Field Feedback contains “excellent”.
    • Field Rating is greater than 4.
  • Outcome: The webhook triggers only if the feedback contains “excellent” and the rating is greater than 4.

Example 4: Regex Validation

  • Matching Mode: Any
  • Conditions:
    • Field Email regex matches ^[a-zA-Z0-9._%+-]+@example\.com$.
    • Field Referral Code starts with “PROMO”.
  • Outcome: The webhook triggers if the email belongs to the “example.com” domain or the referral code starts with “PROMO”.

Example 5: Purchase Amount Validation

  • Matching Mode: All
  • Conditions:
    • Field Purchase Amount is greater than or equal to 500.
    • Field Discount Applied is “Yes”.
  • Outcome: The webhook triggers only for purchases of $500 or more with a discount applied.

Example 6: Exclusion Criteria

  • Matching Mode: All
  • Conditions:
    • Field Category does not contain “Restricted”.
    • Field Access Level is greater than or equal to 3.
  • Outcome: The webhook triggers only if the category does not include “Restricted” and the access level is 3 or higher.
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
On this page
Scroll to Top