Use ServiceNow to Trigger a Kestra Flow
Execute Kestra flows with a ServiceNow webhook trigger.
Overview
ServiceNow often acts as the front door for enterprise automation. This guide shows how to let analysts request an on-demand compliance scan from a ServiceNow catalog item while Kestra executes the workflow behind the scenes through a webhook trigger.
This guide assumes the existence of a flow like in our SecOps with Kestra guide.
Prerequisites
- A ServiceNow instance with Flow Designer access
- A Kestra tenant with a flow exposed through a webhook trigger
- The webhook URL, namespace, and token for the Kestra flow
What You Will Build
- A Service Catalog item (
complianceScanAndRemediate) that collects the host IP and remediation preferences - Catalog variables that persist the user input
- A reusable ServiceNow Action that calls the Kestra webhook
- A Flow Designer flow that ties the catalog submission to the Action
Step 1: Create the Catalog Item
- Sign in to ServiceNow as an administrator and navigate to Service Catalog → Catalog Definitions → Maintain Items.

- Select New and provide the basic metadata:
- Name:
complianceScanAndRemediate - Catalogs: Service Catalog
- Category: Services
- Fulfillment automation level: Fully automated
- Name:
- Fill in the Short description and Description, adjust any Portal settings you do not need, and click Save.

Step 2: Add Catalog Variables
- In the Variables related list, choose New and create the primary inputs:
- Type: Single Line Text
- Question: IP Address
- Name:
ipAddress - Mandatory: enabled

- Create an additional variable for remediation control, for example:
- Type: Single Line Text (or Boolean if you prefer a toggle)
- Question: Auto remediate (Name
autoRemediate)

- (Optional) Add a multi-choice variable if you want to offer canned scan profiles. Define the choices under the Choices related list once the variable has been saved.

- Click Update to persist the catalog item changes.
Step 3: Build the Script Action
Navigate to the Workflow Studio:

- Open Flow Designer → Action and create a new Action named
triggerKestraWebhookin the Service Catalog category. - Add two Action inputs:
ipAddressandremediateControls.

- Insert a Script step, expose the same inputs to that step, and paste the following code, updating the endpoint with your Kestra domain, tenant, namespace, flow ID, and webhook token. Store any secrets (such as the token) in ServiceNow Credential or Connection records rather than hardcoding them.
(function execute(inputs, outputs) {
outputs.error = "";
try {
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod("post");
request.setEndpoint("https://{YOUR.KESTRA.DOMAIN}/api/v1/{TENANT}/executions/webhook/{NAMESPACE}/{FLOW_ID}/{WEBHOOK_TOKEN}");
request.setRequestHeader("Content-Type", "application/json");
request.setRequestHeader("Accept", "application/json");
var body = {
ipAddress: inputs.ipAddress,
remediateControls: inputs.remediateControls
};
request.setRequestBody(JSON.stringify(body));
var response = request.execute();
var httpStatus = response.getStatusCode();
var responseBody = response.getBody();
gs.info("Kestra webhook response status: " + httpStatus);
gs.info("Kestra webhook body: " + responseBody);
outputs.responseBody = responseBody;
outputs.statusCode = httpStatus;
} catch (error) {
gs.error("Kestra webhook failed: " + error.message);
outputs.error = error.message;
}
})(inputs, outputs);
- Define Script outputs for
responseBody,statusCode, anderror, then map them to Action outputs so downstream flows can inspect the response.

- Publish the Action.

Step 4: Create the ServiceNow Flow
- In Flow Designer, create a flow named
catalogSubmissionFlow. - Select the Service Catalog trigger so the flow runs whenever the catalog item is submitted.
- Add the Get Catalog Variables action and configure it to:
- Use the Requested Item record from the trigger as the submitted request
- Limit the template to the
complianceScanAndRemediatecatalog item - Return all of the variables you created earlier
- Add the
triggerKestraWebhookAction to the flow and map each Action input to the corresponding variable output from the previous step. - Activate the flow.
Step 5: Connect the Catalog Item to the Flow
In the Workflow Editor, click on New -> Flow:

- Name the flow
catalogSubmissionFlowand give a description

- Set the Trigger as Service Catalog
- In Actions, get the Catalog Variables

- Set Action Inputs

- Set Template Catalog Items: Click on the magnifying glass and select
complianceScanAndRemediate.

- Set the Catalog Variables and Save.

- Add an Action and search for
triggerKestraWebhook:

- Under Action Inputs, for
ipAddressand click on the wand icon to select Get Catalog Variables →ipAddressand repeat for Auto Remediate.

Validate the End-to-End Run
- Open your Catalog Item Catalog → Catalog Definitions -> Maintain Items→
complianceScanAndRemediate - Go to Process Engine, and under Flow select
catalogSubmissionFlow

- Click on Update, then try the workflow

- Submit the request and navigate System Log -> All:

The webhook will be triggered:

- Navigate to Kestra, and view the Flow Executions tab:

Conclusion
By fronting Kestra with a ServiceNow catalog item, you let users stay inside their familiar ITSM portal while still benefiting from Kestra's orchestration capabilities. The same pattern works for any flow that exposes a webhook trigger—swap in different inputs, reuse the Action, and tailor the downstream automation without changing the ServiceNow experience.
Was this page helpful?