Integration services

We would like to start auto-posting when we do stable releases of our components. In this case, we want to send a message to a specific slack or microsoft teams room. Could these integrations be added to the events?

Basically we want these events to be hit if:

- branch is master
- IsCiBuild == false

Then post a message:

Released %configurationanem% v%version% has been released






Hi Geert,

You can currently send a Slack message using the Http Request build event handler. This can be done most simply using Slack Incoming Web Hooks. e.g.

Http Request
Server Url: https://hooks.slack.com/
Resource: /services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Method: Post
Data Format: Json

Body
Request Body: {“text”: “This is a message from ContinuaCI using Wweb API. Build <$Build.LinkUrl$|$Build.Version$> of configuration ‘$Configuration.Name$’ has been released. :smile:”}

When To Run
Build Event : On Build Completed
Build Status : Successful

Conditions
%IsCIBuild% Equals “false”
$Source.RepoName.Branch$ Equals "master"

You will need to add the web hook integration to the channel first to get the correct resource URL. 

You can also do this using the Slack Web API

Http Request
Server Url: https://slack.com/
Resource: /api/chat.postMessage
Method: Post
Data Format: Json
Authentication Type: Access token as parameter

Authentication
Authentication Parameters Type: Query String
Access Token Key Name: token
Access Token: ************

Parameters
POST Parameters:
    channel=#continuaci
    text=This is a message from ContinuaCI using incoming web hook. Build <$Build.LinkUrl$|$Build.Version$> of configuration ‘$Configuration.Name$’ has been released. :smile: 
    pretty=1

When To Run
Build Event : On Build Completed
Build Status : Successful

Conditions
%IsCIBuild% Equals “false”
$Source.RepoName.Branch$ Equals "master"

You will need to create a Slack App for your team and give it permissions to send messages so that you have an OAuth Access Token to use for authentication. 

We haven’t tried this with Microsoft Team Rooms but you should be able to work this out from this page

This is very nice, thanks for the detailed explanation. I created an app in slack and we can now see apps and components releases in our releases channels. Thanks!

This leads to another feature request (low priority obviously). I now need to add this to about 6 projects and 50 configurations, which is quite tedious. It would be nice if this could be done on the project level or if it was possible to edit configurations without the user interface (e.g. a very simplified “raw mode” using yaml or something like that).

For now I will go through all of this manually, but this is just for future references.

Hi Geert,

Great that you got it working. Yes, we noted that project-level events would be useful when we were playing with this yesterday, and already added it to the to-do list. We have been working on the export and import of configurations to and from a yaml file. There’s still quite a bit to do on validation and testing. We plan to include it in a major version release, along with some other new features , in the next  few months.