Uploaded image for project: 'Automation for Cloud'
  1. Automation for Cloud
  2. AUTO-142

Allow smart values for webhook URL in Microsoft Teams, Slack message actions

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Duplicate
    • None
    • None
    • 0
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Send Webhook request allows smart values for Webhook URL.

      Microsoft Teams and Slack both do not allow smart values.

      How to reproduce

      Create new rule:

      1. When: Scheduled: Advanced Cron: 0 0 0 1 1 ? 1970
      2. Then: Create variable:
        1. Variable name: url
        2. Smart value: https://<tenancy name>.webhook.office.com/webhookb2/<channel GUID>/IncomingWebhook/<webhook GUID>
      3. And: Send Microsoft Teams message:
        1. Webhook URL: {
          Unknown macro: { url}

          }

        2. Message title: Test notification
        3. Message: This is a test notification
        4. Include summary in message

      Publish rule

      Expected behaviour

      Rule published; can execute with "Run Now".

      Actual behaviour

      Rule does not publish: an alert is registered against "Webhook URL" field in "Send Microsoft Teams message" action

      Impact

      Low; can be worked around with reasonable difficulty. The main reason for this is to simplify rule management, and to allow the webhook URL to be extracted from other sources, eg. an Insight object attribute or an Issue entity property.

      Workaround

      Send an outgoing webhook instead:

      1. Webhook URL: {
        Unknown macro: { url}

        }

      2. Headers: Content-Type: application/json
      3. HTTP method: POST
      4. Webhook body: custom data
      5. Custom data:
      {
      	"summary": "{{issue.key}} {{issue.summary.jsonEncode}}",
      	"sections": [
      		{
      			"activityTitle": "{{issue.VIP}}{{#if(exists(issue.priority))}} 👆 {{issue.priority.name.jsonEncode}}{{/}} ⏰ {{issue.Time to Resolution.ongoingCycle.remainingTime.friendly.jsonEncode}} 👩‍💼 {{reporter.displayName.jsonEncode}}{{#if(exists(issue.Affected Services))}} ⚙ {{issue.affectedServices.name.join(",").jsonEncode}}{{/}}",
      			"activitySubtitle": "",
      			"activityImage": "https://d283vu6e5qi87p.cloudfront.net/automation/prod/automation-logo.svg",
      			"activityText": "* Assigned by: {{initiator.displayName.jsonEncode}}\n* Reporter: {{issue.reporter.displayName.jsonEncode}}{{#if(exists(issue.Affected Contact))}}\n* Affected Contact: {{issue.Affected Contact.displayName.jsonEncode}}{{/}}{{#if(exists(issue.Affected Services))}}\n* Affected Services: {{issue.affectedServices.name.join(",").jsonEncode}}{{/}}"
      		},
      		{
      			"activityTitle": "{{issue.key}} {{issue.summary.jsonEncode}}",
      			"facts": [
      				{
      					"name": "Status",
      					"value": "{{issue.status.jsonEncode}}"
      				},
      				{
      					"name": "Issue type",
      					"value": "{{issue.issuetype.name.jsonEncode}}"
      				},
      				{
      					"name": "Assignee",
      					"value": "{{#if(exists(issue.assignee))}}{{issue.assignee.name.jsonEncode}}{{/}}{{#if(not(exists(issue.assignee)))}}Unassigned{{/}}"
      				}
      			]
      		}
      	],
      	"potentialAction": [],
      	"themeColor": "fd5a00",
      	"@context": "http://schema.org/extensions",
      	"@type": "MessageCard"
      }
      

      The Slack action further validates that the webhook URL is for the Slack domain, not useful if users want to use a middle layer application to collect these notifications. The same workaround is available for Slack. 

              89403358cf11 Charlie Gavey
              0a5e36d64dad Alex van Vucht (GLiNTECH)
              Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: