


The SlackResponse is just a helper formatting the response as expected by Slack.Slack is a communication platform used by businesses to keep in touch with their employees. Further, as the Slack WebHook can return data, we use the Response property on the WebHookHandlerContext to define the data we want to return. Slack sends WebHook data in the form of HTML Form data so we read it as a NameValueCollection. As stated in the blog Introducing Microsoft ASP.NET WebHooks Preview, the preferred way to do this is to set it in the Azure Portal: This is done by setting the MS_WebHookReceiverSecret_Slack app setting for your Web Application to the value of the secret Token obtained from before. The second part is to set the secret token so that it can be verified by the receiver. The first part of the configuration is done in WebApiConfig.cs where you add line 17 like this:ģ: public static void Register(HttpConfiguration config)ġ2: routeTemplate: "api/ġ7: config.InitializeReceiveSlackWebHooks() After having installed the .Slack Nuget package into your ASP.NET application, this happens exactly like show in the blog Introducing Microsoft ASP.NET WebHooks Preview: The last part is to configure the WebHook receiver. The URI must have the form Configuring Receiver Fill in whatever trigger words and WebHook URI, and copy the Token for use later. Pick the Outgoing WebHooks integration, select Add Outgoing WebHooks Integration and look for the fields Trigger Words, URLs, and Token. Then you configure the WebHook using what they call an Integration as follows: To setup Slack WebHooks you need a Slack account. For example, if you have a trigger word AskMe: then you can get the WebHook to respond like this: In addition, it is possible for the WebHook to send data back to the channel which is very useful.

Slack provides an interesting model where you can set up a WebHook to be fired when a certain trigger word is used in one of their messaging channels. In the blog Introducing Microsoft ASP.NET WebHooks Preview, we gave an overview of how to work with Microsoft ASP.NET WebHooks.
