Forum Discussion
Webhook from SonarQube
I am setting up an automated code analysis system with SonarQube which reports into Teams.
I an using the Incomming Webhook in teams which is working fine work other products, but just not for SonarQube. I set up the webhook in SonarQube and I can see that it in fact is pushing notifications. I just don´t see them in Teams. I would like either a add-on for SonarQube like there is for Yammer, Jenkins etc. or some guidance on what to do.
Note
* I am using the same type of webhook in Teams for Uptime-robot and that one work fine.
* I am getting a error code 400
Payload sent to Teams
------------
{
"serverUrl": "http://localhost:9000",
"taskId": "XXXXXXXX",
"status": "SUCCESS",
"analysedAt": "2020-08-04T21:02:00+0200",
"revision": "xxxxxxxxxxxxxx",
"changedAt": "2020-08-04T21:02:00+0200",
"project": {
"key": "xxx",
"name": "xxx",
"url": "http://localhost:9000/dashboard?id=xxx"
},
"branch": {
"name": "master",
"type": "BRANCH",
"isMain": true,
"url": "http://localhost:9000/dashboard?id=xxx"
},
"qualityGate": {
"name": "Sonar way",
"status": "OK",
"conditions": [
{
"metric": "new_reliability_rating",
"operator": "GREATER_THAN",
"value": "1",
"status": "OK",
"errorThreshold": "1"
},
{
"metric": "new_security_rating",
"operator": "GREATER_THAN",
"value": "1",
"status": "OK",
"errorThreshold": "1"
},
{
"metric": "new_maintainability_rating",
"operator": "GREATER_THAN",
"value": "1",
"status": "OK",
"errorThreshold": "1"
},
{
"metric": "new_coverage",
"operator": "LESS_THAN",
"status": "NO_VALUE",
"errorThreshold": "80"
},
{
"metric": "new_duplicated_lines_density",
"operator": "GREATER_THAN",
"status": "NO_VALUE",
"errorThreshold": "3"
},
{
"metric": "new_security_hotspots_reviewed",
"operator": "LESS_THAN",
"status": "NO_VALUE",
"errorThreshold": "100"
}
]
},
"properties": {}
}
-----
Update
I seems that Teams no not accept the json format that SonarQube sends see here: community sonarsource webhook
Different companies already provide a SonarQube webhook, just look at Jira, jenkins tec. Then why not Microsoft? If Teams cannot accept different formats or provide a connector to SonarQube, then I´ll need to go back to Slack, which is what I am trying to avoid.
- Gousia_BegumMicrosoft
JimmyD1315 Currently Teams only accepts a JSON payload to the webhook URL. This payload will be in the form of O365 Connector card. You can refer to the payload sample here.