Skip to content

Microsoft Teams notification service not updating correctly via API

Summary

If attempting to update a Microsoft Teams notification service via the REST API v4, some fields are not correctly updated. I'm at least noticing this on the following fields:

  • issues_events
  • confidential_issues_events
  • merge_request_events
  • notify_only_broken_pipelines
  • notify_only_default_branch

Steps to reproduce

By running the following request with curl to the REST API v4 endpoint for our project:

curl -X PUT -H "PRIVATE-TOKEN: MY_TOKEN" -H "Content-Type: application/json" -d '{"webhook":"MY_URL","notify_only_broken_pipelines":false,"notify_only_default_branch":false,"push_events":false,"issues_events":false,"confidential_issues_events":false,"merge_requests_events":true,"tag_push_events":false,"note_events":false,"confidential_note_events":false,"pipeline_events":false,"wiki_page_events":false}' "https://gitlab.com/api/v4/projects/MY_PROJECT_ID/services/microsoft-teams" 

I get the following response:

{"id":MY_NOTIFICATION_ID,"title":"Microsoft Teams Notification","created_at":"2019-03-29T13:45:57.325Z","updated_at":"2019-03-29T14:18:58.174Z","active":true,"push_events":false,"issues_events":true,"confidential_issues_events":true,"merge_requests_events":true,"tag_push_events":false,"note_events":false,"confidential_note_events":false,"pipeline_events":false,"wiki_page_events":false,"job_events":true,"properties":{"webhook":"MY_URL","notify_only_broken_pipelines":true,"notify_only_default_branch":true}}

Observe how fields I previously mentioned are still true even after I attempted to set them to false in my request.

What is the expected correct behavior?

I expect all the fields I attempt to update in my Microsoft Teams notification to properly propagate. The documentation on this API is, however, not complete as it lists webhook as the only field the API endpoint supports (see this page in the docs).

Reading through the code for this, however, it seems like this is intended to propagate just fine and I see little differentiating code between this endpoint and how for example Slack notifications are managed.