Skip to content

Commit e8fc950

Browse files
author
fkeil
committed
Push project to GitHub
0 parents  commit e8fc950

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2921
-0
lines changed

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea/modules.xml
8+
.idea/jarRepositories.xml
9+
.idea/compiler.xml
10+
.idea/libraries/
11+
*.iws
12+
*.iml
13+
*.ipr
14+
15+
### Eclipse ###
16+
.apt_generated
17+
.classpath
18+
.factorypath
19+
.project
20+
.settings
21+
.springBeans
22+
.sts4-cache
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
build/
31+
!**/src/main/**/build/
32+
!**/src/test/**/build/
33+
34+
### VS Code ###
35+
.vscode/
36+
37+
### Mac OS ###
38+
.DS_Store

.idea/.gitignore

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Florian Keil
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# mstlib
2+
3+
[![Maven Central](https://img.shields.io/maven-central/v/de.scplabs/mstlib.svg)](https://search.maven.org/artifact/de.scplabs/mstlib)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
6+
**mstlib** is a lightweight Java library for building and sending [Microsoft Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using) Incoming Webhook Adaptive Cards with ease.
7+
8+
This library simplifies the process of creating rich messages using Adaptive Cards and posting them to Teams channels via incoming webhooks.
9+
10+
---
11+
12+
## 🚀 Features
13+
14+
- Create Adaptive Cards in Java with a fluent API
15+
- Post cards directly to Microsoft Teams via Incoming Webhooks
16+
- Supports text blocks, images, facts and more
17+
18+
---
19+
20+
## 📦 Installation
21+
22+
Add the following to your `pom.xml` (Maven):
23+
24+
```xml
25+
<dependency>
26+
<groupId>de.scplabs</groupId>
27+
<artifactId>mstlib</artifactId>
28+
<version>1.0.0</version>
29+
</dependency>
30+
```
31+
32+
---
33+
34+
## 🔧 Usage
35+
36+
### 1. Create a Webhook URL
37+
38+
Follow [Microsoft's documentation](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook) to create an Incoming Webhook for your Teams channel.
39+
40+
### 2. Build and Send a Card
41+
42+
```java
43+
import de.scplabs.mstlib.IncomingWebhookBuilder;
44+
import de.scplabs.mstlib.Webhook;
45+
46+
public class Main {
47+
public static void main(String[] args) {
48+
IncomingWebhookBuilder builder = new IncomingWebhookBuilder("WEBHOOK_URL");
49+
Webhook wh = builder
50+
.addTextBlock("Hello Teams!").getStyle(FontStyle.BOLD).prev()
51+
.addTextBlock("This is a sample Adaptive Card.").prev()
52+
.build();
53+
54+
wh.execute();
55+
}
56+
}
57+
```
58+
59+
---
60+
61+
## 🧩 Components Supported
62+
### Card Elements
63+
- ✅ TextBlock
64+
- ✅ Image
65+
- ✅ Media
66+
- ✅ MediaSource
67+
- ✅ CaptionSource
68+
- ✅ RichTextBlock
69+
- ✅ TextRun
70+
71+
### Containers
72+
- ✅ Container
73+
- ✅ ColumnSet
74+
- ✅ Column
75+
- ✅ FactSet
76+
- ✅ Fact
77+
- ✅ ImageSet
78+
- ✅ Table
79+
- ✅ TableCell
80+
81+
### Types
82+
- ✅ BackgroundImage
83+
84+
---
85+
86+
## 🛠️ Building Locally
87+
88+
```bash
89+
git clone https://github.com/Flo0205/mstlib.git
90+
cd mstlib
91+
mvn clean install
92+
```
93+
94+
---
95+
96+
## 📄 License
97+
98+
MIT License. See [LICENSE](./LICENSE) for details.
99+
100+
---
101+
102+
## 🤝 Contributing
103+
104+
Pull requests are welcome!
105+
If you’d like to improve or extend the library, please open an issue or PR.
106+
107+
---
108+
109+
110+
111+
Created by [Florian Keil](https://github.com/Flo0205)

dependency-reduced-pom.xml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>de.scplabs</groupId>
5+
<artifactId>mstlib</artifactId>
6+
<name>mstlib</name>
7+
<version>1.0.0</version>
8+
<description>A Java library for building and sending Microsoft Teams IncomingWebhook Adaptive Cards.</description>
9+
<url>https://github.com/Flo0205/mstlib</url>
10+
<developers>
11+
<developer>
12+
<id>Flo0205</id>
13+
<name>Florian Keil</name>
14+
<email>[email protected]</email>
15+
</developer>
16+
</developers>
17+
<licenses>
18+
<license>
19+
<name>MIT License</name>
20+
<url>https://opensource.org/licenses/MIT</url>
21+
<distribution>repo</distribution>
22+
</license>
23+
</licenses>
24+
<scm>
25+
<connection>scm:git:https://github.com/Flo0205/mstlib.git</connection>
26+
<url>https://github.com/Flo0205/mstlib</url>
27+
</scm>
28+
<build>
29+
<plugins>
30+
<plugin>
31+
<groupId>org.sonatype.central</groupId>
32+
<artifactId>central-publishing-maven-plugin</artifactId>
33+
<version>0.7.0</version>
34+
<extensions>true</extensions>
35+
<configuration>
36+
<publishingServerId>central</publishingServerId>
37+
</configuration>
38+
</plugin>
39+
<plugin>
40+
<artifactId>maven-gpg-plugin</artifactId>
41+
<version>1.5</version>
42+
<executions>
43+
<execution>
44+
<id>sign-artifacts</id>
45+
<phase>verify</phase>
46+
<goals>
47+
<goal>sign</goal>
48+
</goals>
49+
</execution>
50+
</executions>
51+
</plugin>
52+
<plugin>
53+
<artifactId>maven-source-plugin</artifactId>
54+
<version>3.2.1</version>
55+
<executions>
56+
<execution>
57+
<id>attach-sources</id>
58+
<phase>verify</phase>
59+
<goals>
60+
<goal>jar</goal>
61+
</goals>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
<plugin>
66+
<artifactId>maven-javadoc-plugin</artifactId>
67+
<version>3.6.0</version>
68+
<executions>
69+
<execution>
70+
<id>attach-javadocs</id>
71+
<phase>verify</phase>
72+
<goals>
73+
<goal>jar</goal>
74+
</goals>
75+
</execution>
76+
</executions>
77+
</plugin>
78+
</plugins>
79+
</build>
80+
<profiles>
81+
<profile>
82+
<id>shaded</id>
83+
<build>
84+
<plugins>
85+
<plugin>
86+
<artifactId>maven-shade-plugin</artifactId>
87+
<version>3.5.0</version>
88+
<executions>
89+
<execution>
90+
<phase>package</phase>
91+
<goals>
92+
<goal>shade</goal>
93+
</goals>
94+
<configuration>
95+
<shadedArtifactAttached>true</shadedArtifactAttached>
96+
<shadedClassifierName>shaded</shadedClassifierName>
97+
<filters>
98+
<filter>
99+
<artifact>*:*</artifact>
100+
<excludes>
101+
<exclude>META-INF/*.SF</exclude>
102+
<exclude>META-INF/*.DSA</exclude>
103+
<exclude>META-INF/*.RSA</exclude>
104+
<exclude>META-INF/LICENSE</exclude>
105+
<exclude>META-INF/NOTICE</exclude>
106+
<exclude>META-INF/MANIFEST.MF</exclude>
107+
<exclude>META-INF/versions/**/module-info.class</exclude>
108+
<exclude>module-info.class</exclude>
109+
</excludes>
110+
</filter>
111+
</filters>
112+
<transformers>
113+
<transformer />
114+
<transformer />
115+
<transformer>
116+
<mainClass />
117+
</transformer>
118+
</transformers>
119+
</configuration>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
</plugins>
124+
</build>
125+
</profile>
126+
</profiles>
127+
<properties>
128+
<maven.compiler.target>17</maven.compiler.target>
129+
<maven.compiler.source>17</maven.compiler.source>
130+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
131+
</properties>
132+
</project>

0 commit comments

Comments
 (0)