Nected Docs
Try Nected For Free
  • 5 min QuickStart Guide
  • Getting Started
    • Introduction
    • Core Concepts
    • Use Cases
    • Tech Architecture
    • FAQs
  • INTEGRATIONS
    • Overview
    • Integrations Libraries
      • PostGres
      • MySQL
      • Oracle
      • MS SQL Server
      • Snowflake
      • MongoDB
      • RedShift
      • REST API
      • Google Sheets
      • Slack
    • Managing Integrations
  • DATASETS
    • Overview
    • Managing Dataset
  • Rules
    • Overview
    • Rule Types
      • SimpleRule
      • DecisionTable
      • Ruleset
      • Rule Chain
    • Rule Conditions
    • Rule Actions
    • Concepts
      • Rule Result
      • Test & Publish Rules
    • Add Input Attributes
      • JSON Input Attributes
      • List Input Attributes
  • Triggers
    • Trigger Rule via API
    • Trigger Rule via WebHook
    • Trigger Workflow via API
    • Trigger Workflow via WebHook
    • Scheduler
    • Rule Response Format
  • Workflow
    • Overview
    • Managing Workflow
    • Add Node
      • Action Nodes
        • Rule Node
        • Workflow Node
        • Custom Code Node
        • Database Node
        • REST API Node
      • Control Nodes
        • Loop Node
        • Delay Node
        • Response Node
        • Set Variables Node
        • Switch Block
    • Test & Publish Workflows
  • CODE AND DATABASE QUERIES
    • JavaScript Editor
    • Formula Editor
    • JSON Editor
    • List Editor
    • Excel-like Function
  • Embedded System
    • White-Labelling
    • Embeddable View
  • Self Hosting
    • Overview
    • Infrastructure Sizing
    • New Installation
      • Docker
      • Kubernetes
        • Set Up Kubernetes Cluster on AWS EKS
    • Additional Configuration
      • High Availability
      • Email Setup Guide
    • Upgrade Nected Version
  • Security
    • API Authentication
      • OAuth as part of Authentication under REST API
    • Role Based Access Control (RBAC)
    • SOC 2 Type 2, GDPR, ISO Compliance
  • Audit
    • Audit Trail
    • Approval Flow
    • Version Control & Rollback
    • Import/Export
  • Management API
    • Audit Log API
    • Global Variable API
  • References
    • Attribute Library
    • Global Variables
    • Pre-Configured Tokens
    • Pre-Configured Operators
    • NULL Value Handling/Behavior
    • Troubleshooting Errors
      • Multiple Tabs/Users Edits
      • Limits in Nected
    • Allowed Status Combinations
    • Environments
    • Usage Widget
    • Gen AI
  • ACCOUNT SETTINGS
    • Workspace Setting
      • Date Format and Timezone Settings
Powered by GitBook
On this page
  • Trigger Rule via WebHook
  • Passing Custom Attributes Using WebHook
  1. Triggers

Trigger Rule via WebHook

PreviousTrigger Rule via APINextTrigger Workflow via API

Last updated 8 months ago

Nected helps you to seamlessly automate and trigger rules and workflows directly from your systems via WebHooks. By leveraging WebHooks, you can integrate custom parameters and ensure real-time execution of predefined rules and workflows. Additionally, easily integrate third-party services and applications to further extend the capabilities of the Nected platform. Follow the steps below to maximize the benefits of WebHooks within your automated workflows and rules.

Trigger Rule via WebHook

Nected enables you to securely trigger a rule from your systems via WebHook, allowing you to use custom parameters and access all relevant information about the rule.

To trigger a rule using a WebHook, follow these steps:

  1. Test and Publish the Rule: Ensure the rule you want to trigger is tested and published.

  2. Access the Trigger Settings:

    • Go to the Trigger section of the rule.

    • Update the rule trigger settings as needed.

    • From the toggle option click on WebHook. And then copy the Webhook URL. To edit the webhook, click on the gear icon after the base URL field.

    • After that, the API Settings window will appear, like this:

  3. In the settings window, again click on the toggle button to change the settings from API to WebHook as shown in the GIF. And then copy the required field as per your need.

  4. Use the WebHook URL: The API Settings window contains the WebHook URL, which includes all the information and behavior of the rule. Use this URL to trigger the rule via WebHook.

curl -X "POST" "https://nected-xx.nected.io/nected/webhook/staging/rule/6646fab31117feddxxxxxxxx" \
     -H 'Content-Type: application/json' \
     -H 'nected-api-key: zC2cyKqDMQmFgQxxxx-muDvG-_xxxx' \ //If you've enabled the Authentication, only then it will appear
     -d $'
{
    "Loan_amount": [12000,20000,123456,21000],
    "curtime": "12/11/2001 11:11:11",
    "cusid": 51,
    "sample": [  "ABC",
  [
    2000,
    "Nected",
    "2024-07-02"
  ],
  "2024-07-02T05:47:10Z",
  {
    "key_name_1": "Rule Engine",
    "key_name_2": true
  },
  true]
  }
'

WebHook URL Template: The Webhook URL looks like this:

<https://nected-xx.nected.io/nected/webhook/{env}/rule/{id}/{version}>

Where the URL consists of the following components:

  • Base URL: https://nected-xx.nected.io/nected/webhook

  • env: The environment of the rule, either staging or production.

  • id: The ID of the rule.

  • version: The version is optional, and will only appear if the rule environment if production.

  • nected-api-key: You'll see this in your cURL code if you've enabled authentication for your rule.

As we've multi-environment along with multiple versions, it can be confusing for you while working with the API. To minimize your confusion, here is a table clarifying the API behavior based on versions and different environments:

Version
Environment
View
Explanation

✅

✅

"version":"version_value",

"environment":"env_value", (staging/production)

If in your webhook URL, both are written, then simply that specific version of rule will be executed

✅

❌

"version":"version_value", "environment":"production",

While calling the webhook, in the url, if you've not specified the env but you've specified the version then the by default the production environment will be called of that version.

❌

✅

"version":"latest", "environment":"env_value", (staging/production)

So, if you've not specified the version but the env then the webhook will execute the latest version of the rule of the environment that you've specified i.e. either staging or production.

❌

❌

"version":"latest", "environment":"production",

If you've not specified anything in your webhook url, then by default the latest live/production version of the rule will be called and executed.

This is how the webhook works, so if you're triggering the rule via WebHook, make sure you follow this and call the webhook accordingly.

Here is the difference between the triggering rule via Webhook for the draft rule and the publishing respectively:

As it can be visible, the base URL changed for staging and production like this:

  1. Staging: https://nected-XX.nected.io/nected/webhook/staging/rule/{id}

  2. Production: https://nected-XX.nected.io/nected/webhook/production/rule/{id}/0.30

Now, if you've multiple versions, and you want to trigger a specific version of the rule via webhook, then you can follow this:

  1. Go to the Version Control tab, and click on the "Preview" button for a specific version.

  2. A new tab will be opened for that specific version. Then follow the same steps to go to the Webhook settings.

  3. Then finally copy the URL and other fields.

Passing Custom Attributes Using WebHook

You can pass custom attributes to a rule using the WebHook by utilizing a flattened payload structure. Here’s how to do it:

  1. Select the WebHook URL: Once you have the WebHook URL, you can use it to pass custom attributes.

  2. Payload Structure: Unlike the API, the payload structure for webhooks is different. Here we use flattened JSON like this:

    {
        "Loan_amount": [12000,20000,123456,21000],
        "curtime": "12/11/2001 11:11:11",
        "cusid": 51,
        "sample": [  "ABC",
      [
        2000,
        "Nected",
        "2024-07-02"
      ],
      "2024-07-02T05:47:10Z",
      {
        "key_name_1": "Rule Engine",
        "key_name_2": true
      },
      true]
      }
  3. Execution: The WebHook will run asynchronously in the backend. After successful execution, it will respond with a success message.

By following these steps, you can effectively trigger and manage rules within the Nected platform using WebHooks.