• EnglishEspañol日本語한국어Português
  • Log inStart now

NerdGraph tutorial: Create and manage applied intelligence workflows

For New Relic applied intelligence, you can create and manage workflows using our NerdGraph API.

List and filter workflows

The workflows query allows you to paginate through all of your workflows per account. It also allows some filtering functionality on the account workflows. Here are some example use cases:

Create a workflow

In order to create a workflow you should first create destinations and channels.

callout.note

A channel ID is unique and so can't be used in multiple workflows or used multiple times in the same workflow.

Update a workflow

When you update a workflow, note the only mandatory attributes you need to supply are the workflow ID and account ID. The rest are optional. For example, you only need to supply the name if you only intend to update the name.

To get the workflow ID, go to the workflow table and click ... at the end of the row. Then, choose Copy workflow id to clipboard.

Here's an example of updating a workflow:

mutation {
aiWorkflowsUpdateWorkflow(
accountId: YOUR_ACCOUNT_ID
updateWorkflowData: { name: "UPDATED_API_DEMO_WORKFLOW", id: WORKFLOW_ID }
) {
workflow {
id
name
destinationConfigurations {
channelId
name
type
notificationTriggers
}
enrichmentsEnabled
destinationsEnabled
issuesFilter {
accountId
id
name
predicates {
attribute
operator
values
}
type
}
lastRun
workflowEnabled
mutingRulesHandling
}
errors {
description
type
}
}
}

Delete a workflow

Here's an example of deleting a workflow:

mutation {
aiWorkflowsDeleteWorkflow(id: WORKFLOW_ID, accountId: YOUR_ACCOUNT_ID) {
id
errors {
description
type
}
}
}

Test a workflow

The test searches for previous issues that match your inputs and creates a fake notification based on that. If no previous issue matching your inputs has been found it will return an error.

For example:

mutation {
aiWorkflowsTestWorkflow(
accountId: YOUR_ACCOUNT_ID
testWorkflowData: {
destinationConfigurations: { channelId: YOUR_CHANNEL_ID, type: SLACK }
issuesFilter: { predicates: [], type: YOUR_FILTER }
}
) {
status
notificationResponses {
status
evidence
channelId
}
errors {
description
type
}
}
}
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.