= Teams

Posts a message to a link:https://www.microsoft.com/en-ww/microsoft-teams[Teams] room. You must create a custom webhook for this announcer to work.

1. Log into Teams.
2. Click on the `Apps` icon.
3. Click on the `Connectors` menu item.
4. Click on `Incoming Webhook` and add it to a team.
5. Configure the webhook.
6. Copy the generated webhook URL.

IMPORTANT: Webhooks are not protected, anyone with access to the webhook URI can send messages to the target room. Prefer
setting the `JRELEASER_TEAMS_WEBHOOK` environment variable over explicitly setting a value in the configuration DSL.

include::partial$legend.adoc[]

[tabs]
====
YAML::
+
[source,yaml]
[subs="+macros"]
----
announce:
  # icon:dot-circle[]
  teams:

    # Enable or disable this announcer.
    # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
    # Defaults to `NEVER`.
    # icon:dot-circle[]
    active: ALWAYS

    # Defines the connection timeout in seconds.
    # Defaults to `20`.
    # icon:dot-circle[]
    connectTimeout: 20

    # Defines the read timeout in seconds.
    # Defaults to `60`.
    # icon:dot-circle[]
    readTimeout: 6

    # The webhook associated with a specific Teams room.
    # If left unspecified, the `JRELEASER_TEAMS_WEBHOOK`
    # environment variable must be defined.
    # icon:exclamation-triangle[] icon:eye-slash[]
    webhook: __DO_NOT_SET_HERE__

    # Path to a template file that contains the message.
    # Review the available xref:configuration:name-templates.adoc[].
    # Defaults to `src/jreleaser/templates/teams.tpl`.
    # icon:exclamation-triangle[]
    messageTemplate: path/to/template/teams.tpl

    # Additional properties used when evaluating templates.
    # icon:dot-circle[] icon:file-alt[]
    extraProperties:
      # Key will be capitalized and prefixed with `teams`, i.e, `teamsFoo`.
      foo: bar
----
TOML::
+
[source,toml]
[subs="+macros"]
----
# icon:dot-circle[]
[announce.teams]

  # Enable or disable this announcer.
  # Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
  # Defaults to `NEVER`.
  # icon:dot-circle[]
  active = "ALWAYS"

  # Defines the connection timeout in seconds.
  # Defaults to `20`.
  # icon:dot-circle[]
  connectTimeout = 20

  # Defines the read timeout in seconds.
  # Defaults to `60`.
  # icon:dot-circle[]
  readTimeout = 60

  # The webhook associated with a specific Teams room.
  # If left unspecified, the `JRELEASER_TEAMS_WEBHOOK`
  # environment variable must be defined.
  # icon:exclamation-triangle[] icon:eye-slash[]
  webhook = "__DO_NOT_SET_HERE__"

  # Path to a template file that contains the message.
  # Review the available xref:configuration:name-templates.adoc[].
  # Defaults to `src/jreleaser/templates/teams.tpl`.
  # icon:exclamation-triangle[]
  messageTemplate = "path/to/template/teams.tpl"

  # Additional properties used when evaluating templates.
  # icon:dot-circle[] icon:file-alt[]
  extraProperties.foo = "bar"
  # Key will be capitalized and prefixed with `teams`, i.e, `teamsFoo`.
----
JSON::
+
[source,json]
[subs="+macros"]
----
{
  "announce": {
    // icon:dot-circle[]
    "teams": {

      // Enable or disable this announcer.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // icon:dot-circle[]
      "active": "ALWAYS",

      // Defines the connection timeout in seconds.
      // Defaults to `20`.
      // icon:dot-circle[]
      "connectTimeout": 20,

      // Defines the read timeout in seconds.
      // Defaults to `60`.
      // icon:dot-circle[]
      "readTimeout": 60,

      // The webhook associated with a specific Teams room.
      // If left unspecified, the `JRELEASER_TEAMS_WEBHOOK`
      // environment variable must be defined.
      // icon:exclamation-triangle[] icon:eye-slash[]
      "webhook": "__DO_NOT_SET_HERE__",

      // Path to a template file that contains the message.
      // Review the available xref:configuration:name-templates.adoc[].
      // Defaults to `src/jreleaser/templates/teams.tpl`.
      // icon:dot-circle[] icon:exclamation-triangle[]
      "messageTemplate": "path/to/template/teams.tpl",

      // Additional properties used when evaluating templates.
      // icon:dot-circle[] icon:file-alt[]
      "extraProperties": {
        // Key will be capitalized and prefixed with `teams`, i.e, `teamsFoo`.
        "foo": "bar"
      }
    }
  }
}
----
Maven::
+
[source,xml]
[subs="+macros,verbatim"]
----
<jreleaser>
  <!--
    icon:dot-circle[]
  -->
  <announce>
    <!--
      icon:dot-circle[]
    -->
    <teams>

      <!--
        Enable or disable this announcer.
        Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
        Defaults to `NEVER`.
        icon:dot-circle[]
      -->
      <active>ALWAYS</active>

      <!--
        Defines the connection timeout in seconds.
        Defaults to `20`.
        icon:dot-circle[]
      -->
      <connectTimeout>20</connectTimeout>

      <!--
        Defines the read timeout in seconds.
        Defaults to `60`.
        icon:dot-circle[]
      -->
      <readTimeout>60</readTimeout>

      <!--
        The webhook associated with a specific Teams room.
        If left unspecified, the `JRELEASER_TEAMS_WEBHOOK` environment variable must be defined.
        icon:exclamation-triangle[] icon:eye-slash[]
      -->
      <webhook>__DO_NOT_SET_HERE__</webhook>

      <!--
        Path to a template file that contains the message.
        Review the available xref:configuration:name-templates.adoc[].
        Defaults to `src/jreleaser/templates/teams.tpl`.
        icon:dot-circle[] icon:exclamation-triangle[]
      -->
      <messageTemplate>path/to/template/teams.tpl</messageTemplate>

      <!--
        Additional properties used when evaluating templates.
        icon:dot-circle[] icon:file-alt[]
      -->
      <extraProperties>
        <!--
          Key will be capitalized and prefixed with `teams`, i.e, `teamsFoo`.
        -->
        <foo>bar</foo>
      </extraProperties>
    </teams>
  </announce>
</jreleaser>
----
Gradle::
+
[source,groovy]
[subs="+macros"]
----
jreleaser {
  announce {
    // icon:dot-circle[]
    teams {

      // Enable or disable this announcer.
      // Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
      // Defaults to `NEVER`.
      // icon:dot-circle[]
      active = 'ALWAYS'

      // Defines the connection timeout in seconds.
      // Defaults to `20`.
      // icon:dot-circle[]
      connectTimeout = 20

      // Defines the read timeout in seconds.
      // Defaults to `60`.
      // icon:dot-circle[]
      readTimeout = 60

      // The webhook associated with a specific Teams room.
      // If left unspecified, the `JRELEASER_TEAMS_WEBHOOK`
      // environment variable must be defined.
      // icon:exclamation-triangle[] icon:eye-slash[]
      webhook = '__DO_NOT_SET_HERE__'

      // Path to a template file that contains the message.
      // Review the available xref:configuration:name-templates.adoc[].
      // Defaults to `src/jreleaser/templates/teams.tpl`.
      // icon:dot-circle[] icon:exclamation-triangle[]
      messageTemplate = 'path/to/template/teams.tpl'

      // Additional properties used when evaluating templates.
      // Key will be capitalized and prefixed with `teams`, i.e, `teamsFoo`.
      // icon:dot-circle[] icon:file-alt[]
      extraProperties.put('foo', 'bar')
    }
  }
}
----
====

The message must follow the link:https://docs.microsoft.com/en-us/outlook/actionable-messages/adaptive-card[Adaptive Card]
format.

The template file may be initialized using the `template` command.
