Reference outputs from previous steps using template syntax to chain actions and build complex automation.
Requirements:
- New Relic account with appropriate permissions
- Slack workspace with appropriate permissions
- Slack bot token configured as a secret in workflow automation
- Access to Slack channels where messages will be sent
Basic data passing
Query alert issues from New Relic and send notifications to Slack for each active issue.
What this workflow does:
Execute NerdGraph query to retrieve active alert issues
Loop through each alert issue
Send Slack notification for each issue with issue details
name: alertSlackdescription: "query Alert Issues and send notifications to Slack"workflowInputs:accountId:type: Intsteps:- name: getAlerttype: actionaction: newrelic.nerdgraph.executeversion: 1inputs:graphql: |query GetAlertIssues($accountId: Int!) {actor {account(id: $accountId) {aiIssues {issues(filter: {states: ACTIVATED}) {issues {issueIdprioritystatetitle}}}}}}variables:accountId: ${{ .workflowInputs.accountId }}- name: loopSteptype: loopfor:in: ${{ .steps.getAlert.outputs.data.actor.account.aiIssues.issues.issues }}steps:- name: sendToSlacktype: actionaction: slack.chat.postMessageversion: 1inputs:token: ${{ :secrets:your_slack_token }}channel: incident-channeltext: >issueId: ${{ .steps.loopStep.loop.element.issueId }}priority: ${{ .steps.loopStep.loop.element.priority }}state: ${{ .steps.loopStep.loop.element.state }}title: ${{ .steps.loopStep.loop.element.title | tostring }}
Key actions: newrelic.nerdgraph.execute, slack.chat.postMessage
What's next
- Loops: Iterate through collections
- Conditional logic: Use switch statements