# Sending Notifications to a Slack Webhook

Note: This documentation is for FAKE 5. The old documentation can be found here!

API-Reference

## Adding a Webhook Integration to a Channel

Follow the instructions for setting up an incoming webhook integration. When finished, you should have a Webhook URL that looks like "https://hooks.slack.com/services/some/random/text".

## Sending a Notification to the Webhook

  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32:  open Fake.Api // The webhook URL from the integration you set up let webhookUrl = "https://hooks.slack.com/services/some/random/text" Slack.SendNotification webhookUrl (fun p -> {p with Text = "My Slack Notification!\n!" Channel = "@SomeoneImportant" IconEmoji = ":ghost:" Attachments = [| {Slack.NotificationAttachmentDefaults with Fallback = "Attachment Plain" Text = "Attachment Rich" Pretext = "Attachment Pretext" Color = "danger" Fields = [| {Slack.NotificationAttachmentFieldDefaults with Title = "Field Title 1" Value = "Field Value 2"} {Slack.NotificationAttachmentFieldDefaults with Title = "Field Title 1" Value = "Field Value 2"}|] } {Slack.NotificationAttachmentDefaults with Fallback = "Attachment 2 Plain" Text = "Attachment 2 Rich" Pretext = "Attachment 2 Pretext" Color = "#FFCCDD" }|] }) |> printfn "Result: %s" 

The result should look something like this:

For additional information on the parameters, check out Slack's Webhook Documentation

val webhookUrl : string

Full name: apislack.webhookUrl
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn