Skip to content

Commit

Permalink
feat: Implement new SDK function Microsoft Teams connector
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiivanov committed Dec 8, 2022
1 parent 82a632d commit 350a70f
Show file tree
Hide file tree
Showing 35 changed files with 1,862 additions and 221 deletions.
17 changes: 1 addition & 16 deletions connectors/microsoft-teams/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
> A template for new C8 connectors.
>
> To use this template update the following resources to match the name of your connector:
>
> * [README](./README.md) (title, description)
> * [Element Template](./element-templates/template-connector.json)
> * [POM](./pom.xml) (artifact name, description)
> * [Connector Function](./src/main/java/io/camunda/connector/MyConnectorFunction.java) (rename and update `OutboundConnector` annotation)
> * [Publish Action](./.github/workflows/publish-cloud-function.yaml#L95) (name)
> * [Service Provider Interface (SPI)](./src/main/resources/META-INF/services/io.camunda.connector.api.ConnectorFunction#L1) (rename)
> * [Third-party notices template](./licenses/third-party.ftl#L34) (name)
>
> ...and delete this hint.

# Camunda Connector Template
# Camunda Microsoft Teams Connector

Find the user documentation in our [Camunda Platform 8 Docs](https://docs.camunda.io/docs/components/integration-framework/connectors/out-of-the-box-connectors/available-connectors-overview).

Expand Down
3 changes: 3 additions & 0 deletions connectors/microsoft-teams/connector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: MSTEAMS
type: io.camunda:connector-microsoft-teams:1
variables: [ authentication, data ]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "Microsoft Teams Connector",
"id": "io.camunda:connector-microsoft-teams:1",
"id": "io.camunda.connectors.MSTeams.v1",
"description": "Create, update, and send a message to your Microsoft Teams",
"documentationRef": "https://docs.camunda.io/docs/components/integration-framework/connectors/out-of-the-box-connectors/microsoft-teams/",
"version": 1,
Expand Down Expand Up @@ -691,6 +691,6 @@
}
],
"icon": {
"contents": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL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FkaWVudCBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMjA3NS4zMzMpIiB5Mj0iMzk0LjI2MSIgeDI9Ijk0Mi4yMzQiIHkxPSIxNjgzLjA3MyIgeDE9IjE5OC4wOTkiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiBpZD0iYSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNWE2MmMzIi8+PHN0b3Agb2Zmc2V0PSIuNSIgc3RvcC1jb2xvcj0iIzRkNTViZCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzM5NDBhYiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTk1LjAxIDQ2Ni41aDk1MC4zMTJjNTIuNDczIDAgOTUuMDEgNDIuNTM4IDk1LjAxIDk1LjAxdjk1MC4zMTJjMCA1Mi40NzMtNDIuNTM4IDk1LjAxLTk1LjAxIDk1LjAxSDk1LjAxYy01Mi40NzMgMC05NS4wMS00Mi41MzgtOTUuMDEtOTUuMDFWNTYxLjUxYzAtNTIuNDcyIDQyLjUzOC05NS4wMSA5NS4wMS05NS4wMXoiIGZpbGw9InVybCgjYSkiLz48cGF0aCBkPSJNODIwLjIxMSA4MjguMTkzaC0xODkuOTd2NTE3LjI5N2gtMTIxLjAzVjgyOC4xOTNIMzIwLjEyM1Y3MjcuODQ0aDUwMC4wODh6IiBmaWxsPSIjRkZGIi8+PC9zdmc+"
"contents": "data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' height='18' width='18' viewBox='-334.32495 -518.3335 2897.4829 3110.001'%3E%3Cpath d='M1554.637 777.5h575.713c54.391 0 98.483 44.092 98.483 98.483v524.398c0 199.901-162.051 361.952-361.952 361.952h-1.711c-199.901.028-361.975-162-362.004-361.901V828.971c.001-28.427 23.045-51.471 51.471-51.471z' fill='%235059C9'/%3E%3Ccircle r='233.25' cy='440.583' cx='1943.75' fill='%235059C9'/%3E%3Ccircle r='336.917' cy='336.917' cx='1218.083' fill='%237B83EB'/%3E%3Cpath d='M1667.323 777.5H717.01c-53.743 1.33-96.257 45.931-95.01 99.676v598.105c-7.505 322.519 247.657 590.16 570.167 598.053 322.51-7.893 577.671-275.534 570.167-598.053V877.176c1.245-53.745-41.268-98.346-95.011-99.676z' fill='%237B83EB'/%3E%3Cpath d='M1244 777.5v838.145c-.258 38.435-23.549 72.964-59.09 87.598a91.856 91.856 0 01-35.765 7.257H667.613c-6.738-17.105-12.958-34.21-18.142-51.833a631.287 631.287 0 01-27.472-183.49V877.02c-1.246-53.659 41.198-98.19 94.855-99.52z' opacity='.1'/%3E%3Cpath d='M1192.167 777.5v889.978a91.802 91.802 0 01-7.257 35.765c-14.634 35.541-49.163 58.833-87.598 59.09H691.975c-8.812-17.105-17.105-34.21-24.362-51.833-7.257-17.623-12.958-34.21-18.142-51.833a631.282 631.282 0 01-27.472-183.49V877.02c-1.246-53.659 41.198-98.19 94.855-99.52z' opacity='.2'/%3E%3Cpath d='M1192.167 777.5v786.312c-.395 52.223-42.632 94.46-94.855 94.855h-447.84A631.282 631.282 0 01622 1475.177V877.02c-1.246-53.659 41.198-98.19 94.855-99.52z' opacity='.2'/%3E%3Cpath d='M1140.333 777.5v786.312c-.395 52.223-42.632 94.46-94.855 94.855H649.472A631.282 631.282 0 01622 1475.177V877.02c-1.246-53.659 41.198-98.19 94.855-99.52z' opacity='.2'/%3E%3Cpath d='M1244 509.522v163.275c-8.812.518-17.105 1.037-25.917 1.037-8.812 0-17.105-.518-25.917-1.037a284.472 284.472 0 01-51.833-8.293c-104.963-24.857-191.679-98.469-233.25-198.003a288.02 288.02 0 01-16.587-51.833h258.648c52.305.198 94.657 42.549 94.856 94.854z' opacity='.1'/%3E%3Cpath d='M1192.167 561.355v111.442a284.472 284.472 0 01-51.833-8.293c-104.963-24.857-191.679-98.469-233.25-198.003h190.228c52.304.198 94.656 42.55 94.855 94.854z' opacity='.2'/%3E%3Cpath d='M1192.167 561.355v111.442a284.472 284.472 0 01-51.833-8.293c-104.963-24.857-191.679-98.469-233.25-198.003h190.228c52.304.198 94.656 42.55 94.855 94.854z' opacity='.2'/%3E%3Cpath d='M1140.333 561.355v103.148c-104.963-24.857-191.679-98.469-233.25-198.003h138.395c52.305.199 94.656 42.551 94.855 94.855z' opacity='.2'/%3E%3ClinearGradient gradientTransform='matrix(1 0 0 -1 0 2075.333)' y2='394.261' x2='942.234' y1='1683.073' x1='198.099' gradientUnits='userSpaceOnUse' id='a'%3E%3Cstop offset='0' stop-color='%235a62c3'/%3E%3Cstop offset='.5' stop-color='%234d55bd'/%3E%3Cstop offset='1' stop-color='%233940ab'/%3E%3C/linearGradient%3E%3Cpath d='M95.01 466.5h950.312c52.473 0 95.01 42.538 95.01 95.01v950.312c0 52.473-42.538 95.01-95.01 95.01H95.01c-52.473 0-95.01-42.538-95.01-95.01V561.51c0-52.472 42.538-95.01 95.01-95.01z' fill='url(%23a)'/%3E%3Cpath d='M820.211 828.193h-189.97v517.297h-121.03V828.193H320.123V727.844h500.088z' fill='%23FFF'/%3E%3C/svg%3E"
}
}
49 changes: 42 additions & 7 deletions connectors/microsoft-teams/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<parent>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-parent</artifactId>
<version>0.2.2</version>
<relativePath></relativePath>
<version>0.4.0-SNAPSHOT</version>
<relativePath/>
</parent>

<name>connector-template-internal</name>
<description>Camunda Connector Template (Internal)</description>
<artifactId>connector-template-internal</artifactId>
<name>connector-microsoft-teams</name>
<description>Camunda Microsoft Teams Connector</description>
<artifactId>connector-microsoft-teams</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>

<licenses>
<license>
Expand All @@ -25,6 +25,10 @@
</licenses>

<properties>
<version.gson-extras>1.1.0</version.gson-extras>
<version.microsoft-graph>5.41.0</version.microsoft-graph>
<version.azure-identity>1.7.1</version.azure-identity>

<license.inlineheader>Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
under one or more contributor license agreements. Licensed under a proprietary license.
See the License.txt file for more information. You may not use this file
Expand All @@ -42,6 +46,29 @@ except in compliance with the proprietary license.</license.inlineheader>
<artifactId>connector-validation</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>${version.microsoft-graph}</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>${version.azure-identity}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.danilopianini</groupId>
<artifactId>gson-extras</artifactId>
<version>${version.gson-extras}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down Expand Up @@ -134,7 +161,15 @@ except in compliance with the proprietary license.</license.inlineheader>
<dependency>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-runtime-cloud</artifactId>
<version>0.2.0</version>
<version>0.3.0</version>
</dependency>
<dependency>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-core</artifactId>
</dependency>
<dependency>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-validation</artifactId>
</dependency>
</dependencies>
<build>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. Licensed under a proprietary license.
* See the License.txt file for more information. You may not use this file
* except in compliance with the proprietary license.
*/
package io.camunda.connector;

import com.google.gson.Gson;
import io.camunda.connector.api.annotation.OutboundConnector;
import io.camunda.connector.api.outbound.OutboundConnectorContext;
import io.camunda.connector.api.outbound.OutboundConnectorFunction;
import io.camunda.connector.model.MSTeamsRequest;
import io.camunda.connector.suppliers.GraphServiceClientSupplier;
import io.camunda.connector.suppliers.GsonSupplier;

@OutboundConnector(
name = "MSTEAMS",
inputVariables = {"authentication", "data"},
type = "io.camunda:connector-microsoft-teams:1")
public class MSTeamsFunction implements OutboundConnectorFunction {

private final Gson gson;
private final GraphServiceClientSupplier graphSupplier;

public MSTeamsFunction() {
this(new GraphServiceClientSupplier(), GsonSupplier.getGson());
}

public MSTeamsFunction(final GraphServiceClientSupplier graphSupplier, final Gson gson) {
this.graphSupplier = graphSupplier;
this.gson = gson;
}

@Override
public Object execute(OutboundConnectorContext context) {

final var variables = context.getVariables();
final var msTeamsRequest = gson.fromJson(variables, MSTeamsRequest.class);

context.validate(msTeamsRequest);
context.replaceSecrets(msTeamsRequest);

return msTeamsRequest.invoke(graphSupplier);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 350a70f

Please sign in to comment.