# Update a Microsoft Teams integration

Updates the settings of a Microsoft Teams integration, the same settings as its **Configure** page. Send only the parameters you wish to change.

Connect the integration in **Errors** → [Integrations](https://errors.betterstack.com/team/0/integrations/) first, since connecting Microsoft Teams needs you to authorize Better Stack in Microsoft Teams.

[endpoint]
base_url = "https://errors.betterstack.com"
path = "/api/v1/microsoft-teams-integrations/{id}"
method = "PATCH"

[[path_param]]
name = "id"
description = "The ID of the Microsoft Teams integration, the number in the URL of its **Configure** page."
required = true
type = "string"

[[body_param]]
name = "notifications"
description = "The **Notify me when** toggles to change, as booleans. Toggles you leave out keep their value. The keys are `spikes`, `spike_protection`, `new_releases`, `new_errors`, `occurrence_milestones`, `occurrence_threshold`, `affected_users_threshold`, `automatically_reopened`."
required = false
type = "object"

[[body_param]]
name = "occurrence_threshold_count"
description = "How many occurrences within `occurrence_threshold_interval` trigger `notifications.occurrence_threshold`. A positive whole number."
required = false
type = "integer"

[[body_param]]
name = "occurrence_threshold_interval"
description = "The interval of the occurrence threshold: `minute`, `hour`, `day`, or `week`."
required = false
type = "string"

[[body_param]]
name = "affected_users_threshold_count"
description = "How many affected users in total trigger `notifications.affected_users_threshold`. A positive whole number."
required = false
type = "integer"

[[body_param]]
name = "tag_filter"
description = "Only send messages for errors where at least one exception has every tag listed, with one of its values, replacing the whole list. Each row is an object with a `tag` and its `values`, a list of strings. Use a tag once, at most 10 rows, 50 values per tag and 200 characters per tag or value. Send `[]` for every error. New releases and spike protection aren't filtered."
required = false
type = "array of objects"

[[body_param]]
name = "routes"
description = "Which applications' errors go to which channels, replacing the whole list. Each route is an object with `applications`, a list of objects with an `application_id` and optionally its `environments`, and `channels`, a list of at least one object with the `id` of a standard channel in the team the Better Stack app was added to. An empty `applications` means any application. An application in no route gets no messages, unless a route has an empty `applications`. Send `[]` to send every error to the channel the Better Stack app was added to."
required = false
type = "array of objects"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content-Type"
description = "application/json"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = '''Returns the updated Microsoft Teams integration.'''
body = '''{
  "data": {
    "id": "55",
    "type": "microsoft_teams_integration",
    "attributes": {
      "team_id": "t123456",
      "team_name": "My team",
      "notifications": {
        "spikes": true,
        "spike_protection": true,
        "new_releases": true,
        "new_errors": true,
        "occurrence_milestones": true,
        "occurrence_threshold": false,
        "affected_users_threshold": false,
        "automatically_reopened": false
      },
      "occurrence_threshold_count": 10,
      "occurrence_threshold_interval": "minute",
      "affected_users_threshold_count": 10,
      "tag_filter": [],
      "microsoft_teams_team_name": "Engineering",
      "microsoft_teams_channel_name": "General",
      "routes": [
        {
          "applications": [
            { "application_id": 1234, "environments": ["production"] }
          ],
          "channels": [
            { "id": "19:a1b2c3d4e5f6@thread.tacv2", "name": "Checkout errors" }
          ]
        },
        {
          "applications": [],
          "channels": [
            { "id": "19:f6e5d4c3b2a1@thread.tacv2", "name": "General" }
          ]
        }
      ]
    }
  }
}'''

[[response]]
status = 401
description = '''Unauthorized'''
body = '''{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}'''

[[response]]
status = 404
description = '''Not Found'''
body = '''{
  "errors": "Resource with the provided ID was not found"
}'''

[[response]]
status = 422
description = '''Returned when a value can't be applied. The error says which and why.'''
body = '''{
  "errors": "Unknown Microsoft Teams channel \"19:0a1b2c3d@thread.tacv2\" in routes[0]. Use the ID of a standard channel in the team the Better Stack app was added to."
}'''
[/responses]

#### Example cURL

```shell
[label Send an application's errors to its own channel]
curl --request PATCH \
  --url https://errors.betterstack.com/api/v1/microsoft-teams-integrations/55 \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "routes": [
      {
        "applications": [
          { "application_id": 1234, "environments": ["production"] }
        ],
        "channels": [
          { "id": "19:a1b2c3d4e5f6@thread.tacv2" }
        ]
      },
      {
        "applications": [],
        "channels": [
          { "id": "19:f6e5d4c3b2a1@thread.tacv2" }
        ]
      }
    ]
  }'
```
