Trigger Rule via WebHook

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.

  3. 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}/>

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.

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

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.

Last updated