Utilize a AdaptiveCard and publish it to a MS-Teams channel via webhook workflow.
Special thanks goes to Roland Seidel for the idea and his reference implementation.
- Version 0.5.0
- support blocking thread executor for batch / cli usage
⚠️ Breaking: removed deprecated config parameter
- Version 0.4.0 is the first version supporting AdaptiveCards
- Version 0.2.3 is the last version supporting Java 8
<dependency>
<groupId>com.baloise.open</groupId>
<artifactId>ms-teams-connector</artifactId>
<version>0.5.0</version>
</dependency>final String uri = "webhook_url";
final MessagePublisher channelPublisher = MessagePublisher.getInstance(uri);Now you can publish any message using MessagePublisher (e.g., create and publish a simple message)
final AdaptiveCard msg = AdaptiveCardFactory.createSimpleAdaptiveCard("Title", "Hello **World**");
ScheduledFuture<?> publishedFuture = channelPublisher.publish(msg);MessageCardFactory builder extends the "SimpleMessageCard" by adding facts. Facts are key-value pairs added as table below the text.
AdaptiveCardFactory.builder("A crisp title", "A little more descriptive text.")
.withFact("Status", "Failure")
.withFact("Reason", "Out of memory")
.build();| Parameter | Default | Description |
|---|---|---|
| PROPERTY_RETRIES | 3 | Defines the number of retries to publish the message in case of unsuccessful answer from webhook. Accepts any positive integer > 0. |
| PROPERTY_RETRY_PAUSE | 60 | Defines the pause time between PROPERTY_RETRIES in seconds. Accepts any positive integer > 0. |
| PROPERTY_WEBHOOK_URI | none | The URI to your webhook. Required property provided either as String or URI. |
| PROPERTY_PROXY_URI | none | The URI to your web proxy. |
| PROPERTY_BLOCKING | false | Set to true to block main thread until message was sent or max retries time is reached. Default is sending messages asynchronously. |
Alternatively you can also specify a system environment variable named https_proxy to connect via a proxy URL.

