Trigger Workflow via WebHook
Last updated
Last updated
Nected allows you to securely initiate a workflow from your systems using a Webhook URL. This feature enables you to pass custom parameters and retrieve all pertinent information related to the workflow, ensuring seamless integration and efficient data handling.
To trigger a workflow via webhook, follow these steps:
Test and Publish the Workflow: Ensure the workflow you want to trigger is tested and published.
Access the Trigger Node:
Go to the Trigger Node and click on it.
Navigate to the Settings tab, where you will find the API and WebHook URL information.
Use the WebHook URL:
The Settings tab will display the WebHook URL, which contains all the information and behavior of the workflow trigger.
Use the URL to trigger the workflow via WebHook. Below is the URL:
The WebHook 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
.
entity_name: The name of the rule to be executed.
id: The ID of the rule.
Version: The version is optional, and will only appear if the rule environment if production.
Inside the 'How to Trigger?' section you'll get this type of cURL
code, which you can copy and use seamlessly:
Well, 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":"version_value",
"environment":"env_value", (staging/production)
If in your webhook URL, both are written, then simply that specific version of workflow 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 default env i.e. production
environment of that version will be executed
❌
✅
"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 workflow via WebHook, make sure you follow this and call the webhook accordingly.
As it can be visible, the base URL changed for staging and production like this:
Staging: https://nected-XX.nected.io/nected/webhook/staging/workflow/{id}
Production: https://nected-XX.nected.io/nected/webhook/production/workflow/{id}/0.30
Now, if you've multiple versions, and you want to trigger a specific version of the workflow via webhook, then you can follow this:
Go to the Version Control tab, and click on the "Preview" button for a specific version.
A new tab will be opened for that specific version. Then follow the same steps to go to the Webhook settings.
Then finally copy the URL and other fields.
After Selecting the Webhook URL, you can use the webhook to pass the information as a custom attribute.
To pass custom attributes in Workflow via using WebHook, You can use this flattened payload structure like this:
Once You pass the payload, the webhook will not wait for the workflow execution it runs asynchronously backend. after its successful execution, it responds via a successful message.