Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microsoft Teams webhook support for notifications #4971

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add Microsoft Teams webhook support for notifications
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
kolchfa-aws committed Sep 6, 2023
commit 301df0f64acaa8e5c9d9fdf14caf458ee05766a8
37 changes: 21 additions & 16 deletions _observing-your-data/notifications/api.md
Original file line number Diff line number Diff line change
@@ -23,18 +23,19 @@ If you want to programmatically define your notification channels and sources fo

To retrieve a list of all supported notification configuration types, send a GET request to the `features` resource.

#### Sample Request
#### Example request

```json
GET /_plugins/_notifications/features
```

#### Sample Response
#### Example response

```json
{
"allowed_config_type_list" : [
"slack",
"microsoft_teams",
"chime",
"webhook",
"email",
@@ -53,13 +54,13 @@ GET /_plugins/_notifications/features

To retrieve a list of all notification configurations, send a GET request to the `configs` resource.

#### Sample Request
#### Example request

```json
GET _plugins/_notifications/configs
```

#### Sample Response
#### Example response

```json
{
@@ -121,6 +122,7 @@ email.recipient_list | The channel's recipient list.
email_group.recipient_list | The channel's list of email recipient groups.
smtp_account.method | The email encryption method.
slack.url | The Slack channel's URL.
microsoft_teams.url | The Microsoft Teams channel's URL.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
microsoft_teams.url | The Microsoft Teams channel's URL.
microsoft_teams.url | The Microsoft Teams channel URL.

chime.url | The Amazon Chime connection's URL.
webhook.url | The webhook's URL.
smtp_account.host | The domain of the SMTP account.
@@ -136,7 +138,7 @@ ses_account.from_address | The Amazon SES account's sender email address.

To create a notification channel configuration, send a POST request to the `configs` resource.

#### Sample Request
#### Example request

```json
POST /_plugins/_notifications/configs/
@@ -176,6 +178,9 @@ The create channel operation accepts multiple `config_types` as possible notific
"slack": {
"url": "https://sample-chime-webhoook"
}
"microsoft_teams": {
"url": "https://sample.webhook.office.com/1234567"
}
"chime": {
"url": "https://sample-amazon-chime-webhoook"
}
@@ -236,7 +241,7 @@ POST /_plugins/_notifications/configs/
}
```

#### Sample Response
#### Example response

```json
{
@@ -249,13 +254,13 @@ POST /_plugins/_notifications/configs/

To get a channel configuration by `config_id`, send a GET request and specify the `config_id` as a path parameter.

#### Sample Request
#### Example request

```json
GET _plugins/_notifications/configs/<config_id>
```

#### Sample Response
#### Example response

```json
{
@@ -286,7 +291,7 @@ GET _plugins/_notifications/configs/<config_id>

To update a channel configuration, send a POST request to the `configs` resource and specify the channel's `config_id` as a path parameter. Specify the new configuration details in the request body.

#### Sample Request
#### Example request

```json
PUT _plugins/_notifications/configs/<config_id>
@@ -303,7 +308,7 @@ PUT _plugins/_notifications/configs/<config_id>
}
```

#### Sample Response
#### Example response

```json
{
@@ -316,13 +321,13 @@ PUT _plugins/_notifications/configs/<config_id>

To delete a channel configuration, send a DELETE request to the `configs` resource and specify the `config_id` as a path parameter.

#### Sample Request
#### Example request

```json
DELETE /_plugins/_notifications/configs/<config_id>
```

#### Sample Response
#### Example response

```json
{
@@ -334,13 +339,13 @@ DELETE /_plugins/_notifications/configs/<config_id>

You can also submit a comma-separated list of channel IDs you want to delete, and OpenSearch deletes all of the specified notification channels.

#### Sample Request
#### Example request

```json
DELETE /_plugins/_notifications/configs/?config_id_list=<config_id1>,<config_id2>,<config_id3>...
```

#### Sample Response
#### Example response

```json
{
@@ -357,13 +362,13 @@ DELETE /_plugins/_notifications/configs/?config_id_list=<config_id1>,<config_id2

To send a test notification, send a GET request to `/feature/test/` and specify the channel configuration's `config_id` as a path parameter.

#### Sample Request
#### Example request

```json
GET _plugins/_notifications/feature/test/<config_id>
```

#### Sample Response
#### Example response

```json
{
4 changes: 2 additions & 2 deletions _observing-your-data/notifications/index.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ The Notifications plugin provides a central location for all of your notificatio

You can use either OpenSearch Dashboards or the REST API to configure notifications. Dashboards offers a more organized way of selecting a channel type and selecting which OpenSearch plugin sources you want to use, whereas the REST API lets you programmatically define your notification channels for better versioning and reuse later on.

1. Use the Dashboards UI to first create a channel that receives notifications from other plugins. Supported communication channels include Amazon Chime, Amazon Simple Notification Service (Amazon SNS), Amazon Simple Email Service (Amazon SES), email through SMTP, Slack, and custom webhooks. After you’ve configured your channel and plugin sources, send messages and start tracking your notifications from the Notifications plugin's dashboard.
1. Use the Dashboards UI to first create a channel that receives notifications from other plugins. Supported communication channels include Amazon Chime, Amazon Simple Notification Service (Amazon SNS), Amazon Simple Email Service (Amazon SES), email through SMTP, Slack, Microsoft Teams, and custom webhooks. After you’ve configured your channel and plugin sources, send messages and start tracking your notifications from the Notifications plugin's dashboard.

2. Use the Notifications REST API to configure all of your channel's settings. To use the API, you must have your notification's name, description, channel type, which OpenSearch plugins to use as sources, and other associated URLs or groups.

@@ -23,7 +23,7 @@ You can use either OpenSearch Dashboards or the REST API to configure notificati
In OpenSearch Dashboards, choose **Notifications**, **Channels**, and **Create channel**.

1. In the **Name and description** section, specify a name and optional description for your channel.
2. In the **Configurations** section, select the channel type and enter the necessary information for each type. For more information about configuring a channel that uses Amazon SNS or email, refer to the sections below. If you want to use Amazon Chime or Slack, you need to specify the webhook URL. For more information about using webhooks, see the documentation for [Slack](https://api.slack.com/messaging/webhooks) and [Amazon Chime](https://docs.aws.amazon.com/chime/latest/ug/webhooks.html).
2. In the **Configurations** section, select the channel type and enter the necessary information for each type. For more information about configuring a channel that uses Amazon SNS or email, refer to the sections below. If you want to use Amazon Chime or Slack, you need to specify the webhook URL. For more information about using webhooks, see the documentation for [Slack](https://api.slack.com/messaging/webhooks), [Microsoft Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/what-are-webhooks-and-connectors), and [Amazon Chime](https://docs.aws.amazon.com/chime/latest/ug/webhooks.html).
kolchfa-aws marked this conversation as resolved.
Show resolved Hide resolved

If you want to use custom webhooks, you must specify more information: parameters and headers. For example, if your endpoint requires basic authentication, you might need to add a header with an authorization key and a value of `Basic <Base64-encoded-credential-string>`. You might also need to change `Content-Type` to whatever your webhook requires. Popular values are `application/json`, `application/xml`, and `text/plain`.