Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper for Office 365 / MS Teams Notifications #1501

Merged
merged 1 commit into from
Apr 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions help/literate/templates/template-project.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ <h3 class="muted">{project-name}</h3>
<li><a href="wix.html">WiX Setup Generation</a></li>
<li><a href="chocolatey.html">Using Chocolatey</a></li>
<li><a href="slacknotification.html">Using Slack</a></li>
<li><a href="msteamsnotification.html">Using Microsoft Teams</a></li>
<li><a href="sonarcube.html">Using SonarQube</a></li>
<li class="divider"></li>
<li><a href="deploy.html">Fake.Deploy</a></li>
Expand Down
52 changes: 52 additions & 0 deletions help/msteamsnotification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Sending Notifications to a Microsoft Teams channel

In this article you will learn how to create a Office 365 webhook integration on a MS Teams channel and send a notification to it. This article assumes that you already have a Microsoft Teams team and channel setup.

## Adding a Webhook Integration to a Channel

Follow the [instructions](https://msdn.microsoft.com/en-us/microsoft-teams/connectors) for setting up a webhook connector to your channel. When finished, you should have a Webhook URL that looks like "https://outlook.office.com/webhook/some-random-text/IncomingWebhook/some/random/text".

## Sending a Notification to the Webhook

// The webhook URL from the integration you set up
let webhookUrl = "https://outlook.office.com/webhook/some-random-text/IncomingWebhook/some/random/text"

let imageUrl = sprintf "https://connectorsdemo.azurewebsites.net/images/%s"

let notification p =
{ p with
Summary = Some "Max Muster ran a build"
Title = Some "Sample Project"
Sections =
[ { SectionDefaults with
ActivityTitle = Some "Max Muster"
ActivitySubtitle = Some "on Sample Project"
ActivityText = Some "Build successful!"
ActivityImage =
imageUrl "MSC12_Oscar_002.jpg"
|> ImageUri.FromUrl
|> Some
}
{ SectionDefaults with
Title = Some "Details"
Facts = [ { Name = "Labels"; Value = "FOO, BAR" }
{ Name = "Version"; Value = "1.0.0" }
{ Name = "Trello Id"; Value = "1101" } ]
}
]
PotentialActions =
[
{
Name = "View in Trello"
Target = System.Uri("https://trello.com/c/1101/")
}
]
}

Office365Notification webhookUrl notification |> ignore

The result should look something like this:

![alt text](pics/msteamsnotification/msteamsnotification.png "Microsoft Teams Notification Result")

For additional information on the parameters, check out the [Office 356 Connectors API Reference](https://dev.outlook.com/connectors/reference)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions help/templates/template.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<li><a href="@Root/wix.html">WiX Setup Generation</a></li>
<li><a href="@Root/chocolatey.html">Using Chocolatey</a></li>
<li><a href="@Root/slacknotification.html">Using Slack</a></li>
<li><a href="@Root/msteamsnotification.html">Using Microsoft Teams</a></li>
<li><a href="@Root/sonarcube.html">Using SonarQube</a></li>
<li class="divider"></li>
<li><a href="@Root/deploy.html">Fake.Deploy</a></li>
Expand Down
1 change: 1 addition & 0 deletions src/app/FakeLib/FakeLib.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
<Compile Include="GitVersionHelper.fs" />
<Compile Include="Checksum.fs" />
<Compile Include="ChangeLogHelper.fs" />
<Compile Include="Office365ConnectorHelper.fs" />
</ItemGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
Expand Down
Loading