Integrating Azure Deployment to Slack

I've been using Slack for some of projects. I really like its features: chat, discussions, notifications, etc.
Some of my websites deployed automatically to Azure after I check in to my repo. I can get notification when the repo is updated (I use bitbucket / github), but unfortunately currently there is no direct integration from Azure Deployment to Slack. So I decided to create a custom WebHook. The only thing I need to add is an API which acts as a bridge between Azure Deployment and Slack. In this case, I use Azure Mobile Service because it's very easy to create and I can code it directly on my browser.

Here is how I do it:

  • Create a new Slack Incoming WebHook https://{teamname}
    After it's created, we'll be given a webhook url
  • Setup a new Azure Mobile Services API After Deployment is done, Kudu (engine behind Azure deployment) will be able to do a POST request. More details can be found here.
    In the API, I only need to expose the POST method to public. the script looks something like this: = function (request, response) {  
    var body = request.body;
    var req = require('request');
    var payload = {
        "text": "Deployed by: " + + ".\nDeployment message: " + body.message
        url: '{{Slack webhook url}}',
        method: 'POST',
        body: JSON.stringify(payload),
        headers: { "Content-Type": "application/json" }
    }, function (err, result) {
        response.send(statusCodes.OK, { message: 'Hello World!' });
  • Setup Kudu Incoming Web Hook If we open your azurewebsites with this format: https://{{yoursite}
    we'll be brought to the Kudu control panel of your website. All we need to do in here is to navigate to Tools- Web Hooks, then add the Azure Mobile Service url. Currently it only supports PostDeployment Action, which means the API will be only called after deployment is done.

Once the setup is done, everytime a deployment is done, Kudu will call our API which will trigger notification on Slack!!!

Abdurrachman Habibi

Read more posts by this author.