A customer asked me during a webinar if we can show how to send Skyline Findings results from Insights API to Microsoft Teams (like that of Slack). The good news is that Microsoft Teams does have a decent documentation for “Rest API” usage (https://learn.microsoft.com/en-us/graph/teams-concept-overview). Since we are showing this in PowerShell, it is even easier. I will show a simpler process using PowerShell module (go here to check out the details of the module – https://github.com/EvotecIT/PSTeams). Here is how to install it:
1 |
Install-module PSteams |
Now you need to identify the channel you wish to send your results to. As soon as you do, you need to create a webhook for that channel. Please read this article to understand more about webhooks (https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/what-are-webhooks-and-connectors). As the results, you will receive a path to use inside your code (i.e. https://teams.webhook.office.com/webhook/xxxxxxxx).
Like the sample code before, you need to pull the data from any of the Skyline CSV that you have generated via Skyline Advisor Pro or Skyline Insights API. The code looks like this:
1 2 3 4 5 6 7 8 |
$TEAMSSERER = “https://teams.webhook.office.com/webhook/xxxxxxxx” $fileteams = "skyline-teams.csv" $FINDINGS.data.activeFindings.findings | foreach-object { add-content $fileteams $_ } $TeamsComment = get-content $fileteams |
To finish it off, I will send the results over to Microsoft Teams via webhook with one simple command:
1 |
Send-TeamsMessage -uri "$TEAMSSERVER" -messagetext "$TeamsComment" |
And there you have it. This is a simple PowerShell method to sending your Skyline Findings to Microsoft Teams.
And as always, please feel free to share any good suggestions for others to follow.
If you have additional product integrations to send to, please add them in the comments. Time permitting, I can show examples in future blogs.
Comments