Integrations

Alloy Navigator notifications in Microsoft Teams

Alloy Navigator notifies the stakeholders about various events using good old email and push notifications. However, you may use other channels to communicate with your colleagues, such as Microsoft Teams. This article describes how to send alerts to Microsoft Teams to keep your teammates updated about events in Alloy Navigator.

Here are the steps you should take:

  1. Set up an incoming webhook in Microsoft Teams

  2. Add a PowerShell script to the Alloy Navigator workflow

Set up an incoming webhook in Microsoft Teams

Incoming webhooks are a special type of connector in Microsoft Teams that provide a simple way for external apps to share content in a team channel. A channel's webhook exposes an HTTPS endpoint that will accept correctly formatted JSON and insert messages into that channel.

To set up a custom incoming webhook in Microsoft Teams:

  1. In Microsoft Teams, go to the channel where you want alerts to appear.

    TIP: You can create a new channel for this purpose.

  2. In the upper-right corner next to the channel name, click the ellipsis button to reveal more options and choose Connectors.

    NOTE: Any team member can add, modify, or delete connectors when the Allow members to create, update, and remove connectors check box in your team's Settings > Member permissions is selected.

  3. Search for Incoming Webhook and click Add.

  4. Enter a name for the webhook, upload an image to associate with alerts from Alloy Navigator, and click Create.

  5. Click Done.

  6. Click the Copy button to copy the webhook URL to the Clipboard, and save it. You will need that URL in the next step for sending information to Microsoft Teams.

The webhook is ready to receive alerts from Alloy Navigator sent via PowerShell.

Add a PowerShell script to the Alloy Navigator workflow

When the incoming webhook in Microsoft Teams is ready, configure the Alloy Navigator workflow to send alerts to the Teams channel when certain events in Alloy Navigator occur.

For example, you can set up posting a message when a new Incident in Alloy Navigator is submitted. To do so, create a trigger that will fire on creating Incidents and send messages to the webhook using PowerShell.

To create a trigger in Alloy Navigator:

  1. In Alloy Navigator Settings, go to Workflow and Business Logic > Service Desk > Incidents > Workflow > Triggers > On Created/Modified and click New.

  2. Enter a trigger name and optionally a description.

  3. Next to Execute when, leave the Object in created option selected.

  4. Switch to the Programming tab and click New > External Command to bring up the External Command dialog box.

  5. Under Run command on, click Server and then copy the following PowerShell script and paste it under Run.

    PowerShell
    $URL = 'WebHookURL'
     
    $Text = '<b><a href="%[SYS Web Portal Link]%go/{0}">{1}</a></b>' -f "%[DBF Ticket]%","%[DBF Ticket]%"
    $Text += "<br>%[DBF Summary]%"
    $Text += "<br>by %[DBF Requester_ID.Full_Name]%"
     
    $body = ConvertTo-JSON -Depth 2 @{
    	title = 'New Incident';
    	text = $Text
    }
     
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
    Invoke-RestMethod -Uri $URL -Method Post -Body $body -ContentType 'application/json'

    where:

    • WebHookURL - the webhook URL in Microsoft Teams.
    • %[SYS Web Portal Link]% - the Web Portal Link system macro that inserts the Web App URL. For details, see Installation Guide: Customizing the Web Portal Link Macro.
    • %[DBF Ticket]% - the placeholder for the Incident number.
    • %[DBF Summary]% - the placeholder for the Incident summary.
    • %[DBF Requester_ID.Full_Name]% - the placeholder for the Incident's requester name.
    • [Net.ServicePointManager]::SecurityProtocol = <...> - the command to ensure that the computer running the PowerShell script has TLS, TLS 1.1, and TLS 1.2 security protocols enabled (in our scenario, it is the Automation Server host). Otherwise, your script may throw "The underlying connection was closed: an unexpected error occurred on a send." in some environments.

    IMPORTANT: Do not forget to replace the WebHookURL placeholder in the script with the actual URL that you copied when creating the webhook in Microsoft Teams.

    TIP: If you want to add more information to the alert messages, add a new $Text += line to the script and use the Insert Placeholder button to insert placeholders for other Incident properties, such as its Urgency or the requester's Organization. For details, see Administration Guide: Object Fields.

    TIP: If you want to send alerts only about high-priority Incidents, or you have other criteria in mind, switch to the Condition tab and create a trigger condition. For details, see Administration Guide: Building Criteria.

  6. Click OK to close the External Command dialog box, and then click OK to save the trigger.

Everything is ready.

Now Alloy Navigator will automatically post a new message to your Microsoft Teams channel whenever a new Incident is submitted. Clicking the Incident number will open that incident in the Web App.