You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c73c917
Browse filesBrowse the repository at this point in the historyBrowse files
Destination keys must be unique, stable identifiers of 1–128 letters, digits,
1027
+
underscores or hyphens, starting with a letter or digit. Keep keys stable when
1028
+
changing routing. Each destination requires a label, team ID, and channel ID.
1029
+
Approve only standard channels in the configured tenant. Duplicate keys or
1030
+
channels and unknown configuration fields are rejected. An empty mapping leaves
1031
+
Teams unconfigured.
1032
+
1033
+
For `team_id`, use the Teams thread ID, for example `19:example@thread.tacv2`,
1034
+
not the Microsoft 365 group GUID shown as the Team ID in Graph or the Teams
1035
+
admin center. In Teams, open the team's **More options (…) > Get link to team**.
1036
+
Copy the value between `/l/team/` and `/conversations` and URL-decode it
1037
+
(`%3A` becomes `:` and `%40` becomes `@`). Do not use the link's `groupId` parameter.
1038
+
For `channel_id`, use **Get link to channel** and URL-decode the value immediately
1039
+
after `/l/channel/`. See Microsoft's [Teams link formats](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-link-teams).
1040
+
The installation callback matches `team_id` exactly. A group GUID will cause
1041
+
installation events to return 403 and leave the destination without an active
1042
+
installation.
1043
+
1044
+
Merge `ALERT_REPORTS` into your existing feature flags. Teams is enabled by valid
1045
+
`ALERT_REPORTS_TEAMS` configuration and the installed `teams` extra. Restart the web
1046
+
server and workers after changing configuration or rotating a secret. Apply the migration
1047
+
before accepting installation events. The scheduler, broker, and worker setup
1048
+
from the earlier Alerts and Reports instructions still applies; the Teams SDK
1049
+
does not run another web server. Attachment-free Teams alerts do not need a
1050
+
browser or screenshot worker.
1051
+
1052
+
### Register the Microsoft app
1053
+
1054
+
Use a Microsoft Entra application restricted to your organization and an Azure
1055
+
Bot registration with the same application ID and tenant. Create a client secret
1056
+
and put its **value** in `TEAMS_CLIENT_SECRET`. Enable the Microsoft Teams channel
1057
+
on the bot registration. Set its messaging endpoint to
1058
+
`https://superset.example/api/v1/teams/events/`, using your public HTTPS host and
Replace the package `id` with a new UUID and `botId` with your configured application
1098
+
ID. Replace the example URLs with your organization's published pages. Include
1099
+
`manifest.json`, a 32×32 transparent outline icon, and a 192×192 color icon at the
1100
+
root of the app ZIP. Have your Teams administrator approve the package and allow
1101
+
installation in the selected teams. Install it in each approved team after the
1102
+
callback is reachable. Configure each standard channel's actual team and channel
1103
+
identifiers on the server; display labels and Microsoft 365 group names are not
1104
+
routing IDs. Do not add personal or group-chat scopes, file support, or
1105
+
private/shared channel capabilities.
1106
+
1107
+
Installing the app updates the installation record for its team, but does not
1108
+
approve any destinations. Configure the allowlist separately. Uninstalling marks
1109
+
the installation inactive; reinstalling refreshes its verified service URL and
1110
+
reactivates the same record. If an initial installation happened before callback
1111
+
routing was ready, remove and reinstall the app to deliver a fresh event.
1112
+
Lifecycle events require a timezone-qualified source timestamp. Older events are
1113
+
acknowledged without changing installation state, and removal wins timestamp ties.
1114
+
Removal records are retained even when the installation event has not arrived.
1115
+
1116
+
### Route the callback
1117
+
1118
+
Your ingress must forward `POST /api/v1/teams/events/` (including the trailing
1119
+
slash) to Flask, preserving the Authorization header and JSON body. The callback
1120
+
accepts bodies up to 256 KiB, or a smaller deployment body limit, and returns 413
1121
+
for oversized requests before JSON parsing, SDK authentication, or database access.
1122
+
Do not send this path through a browser login redirect or an ingress SSO challenge. Keep TLS
1123
+
termination and the configured public URL consistent. Other Superset routes keep
1124
+
their normal authentication and CSRF requirements; do not exempt the whole API.
1125
+
The callback validates Microsoft's connector token, application, tenant, approved
1126
+
team, and signed service URL before changing installations.
1127
+
1128
+
Allow outbound connectivity from the web server for connector signing keys and
1129
+
from workers for Entra token acquisition and the verified Bot Framework service
1130
+
URL. Use the public Microsoft cloud endpoints supported by this adapter. Changing
1131
+
the bot identity requires matching configuration on both web and worker processes
1132
+
and a new verified installation for that identity.
1133
+
1134
+
### Create a Teams alert
1135
+
1136
+
1. Install the app in each approved team once the callback is reachable.
1137
+
2. In **Alerts & reports**, create an alert and disable attachments.
1138
+
3. Choose **Teams** as the notification method and select an approved destination
1139
+
by its display label. Add another Teams notification method to notify another
1140
+
channel.
1141
+
4. Save the alert and check its execution logs after delivery.
1142
+
1143
+
Each alert creates a separate channel post containing its name, optional
1144
+
description, and an **Open in Superset** link when link inclusion is enabled.
1145
+
Execution errors show a generic failure message rather than SQL diagnostics.
1146
+
1147
+
You can save an alert before installing the bot, but delivery requires an active
1148
+
installation. Saved destinations that are no longer configured remain visible
1149
+
as unavailable. Restore the destination's stable key or select a replacement.
1150
+
Credentials are managed in deployment configuration, not in the alert editor.
1151
+
1152
+
### Configure a recipient through the API
1153
+
1154
+
Use recipient type `Teams`, `recipient_config_json` containing only
1155
+
`{"target": "ops"}`, and `report_format="NONE"`. Replace `ops` with a configured
1156
+
destination key. Create, update, and delivery validation enforce the same
1157
+
restrictions, including partial updates to saved alerts.
1158
+
1159
+
The protected destination API returns keys, labels, and installation availability,
1160
+
without credentials or routing details.
1161
+
1162
+
### Troubleshooting
1163
+
1164
+
| Symptom | Check |
1165
+
| --- | --- |
1166
+
| Teams is absent from the editor | Install the extra, enable `ALERT_REPORTS`, provide valid Teams configuration, choose an alert, and disable attachments. |
1167
+
| Destination says “Bot installation required” | Check the bot is installed in the configured team and the callback received its installation event. Saving is allowed before installation; delivery requires an active record. |
1168
+
| Saved destination says “Unavailable” | Restore the original stable key or choose an approved replacement. Configuration changes do not rewrite saved recipients. |
1169
+
| Callback returns 404 | Check `ALERT_REPORTS_TEAMS` is configured, the ingress path/prefix, and that the request reached this deployment. |
1170
+
| Callback returns 503 | Check the optional SDK is installed and the deployment configuration passes validation. A busy callback worker returns 503 after waiting at most one second for its authentication lock. |
1171
+
| Callback returns 401 or 403 | Check connector token authentication, bot application/tenant IDs, approved team, signed service URL, and that ingress preserved Authorization. Browser cookies cannot authenticate this route. |
1172
+
| Delivery fails authorization | Check installation status, secret value/expiry, bot registration, and channel access. A second 401 after one refresh or a 403 ends delivery. |
1173
+
| Save fails after a configuration change | Restore the integration/key or explicitly remove/replace Teams recipients. Partial updates validate the merged schedule, including format and schedule type. |
1174
+
| Delivery times out or exhausts retries | Check Entra and Bot Framework connectivity and worker execution context. The 60-second retry budget includes token acquisition and cleanup and is capped by the execution deadline. Use a supported prefork worker with finite `working_timeout` and `ALERT_REPORTS_WORKING_TIME_OUT_KILL=True` for the outer task limit. |
1175
+
| A duplicate channel post appears | A response can be lost after Teams accepted a post. Bounded retries may create another root post; delivery is not exactly-once. |
1176
+
1177
+
Use the existing alert execution logs to inspect success and failure. Do not copy
1178
+
access tokens, credentials, raw SDK responses, or SQL diagnostics into channel
1179
+
messages or issue reports. Rotate credentials through deployment configuration;
1180
+
there is no browser credential-management page.
1181
+
1182
+
### Delivery timeouts and retries
1183
+
1184
+
Delivery allows up to four attempts within a cooperative 60-second retry budget,
1185
+
limited by the remaining report execution deadline. Requests have socket timeouts
1186
+
of at most 10 seconds. Throttling honors Microsoft's retry delay, and expired
1187
+
authentication can refresh once. A lost response can cause duplicate posts.
1188
+
1189
+
Socket timeouts do not bound DNS resolution or an entire streaming response. For
1190
+
an outer time limit, use a Celery prefork worker with
keep `ALERT_REPORTS_WORKING_TIME_OUT_KILL=True`, and set a finite schedule
1193
+
`working_timeout`. These limits cover the entire alert task, including query
1194
+
execution and delivery. Hard task termination cannot guarantee resource cleanup.
1195
+
985
1196
:::resources
986
1197
987
1198
-[Tutorial: Automated Alerts and Reporting via Slack/Email in Superset](https://dev.to/ngtduc693/apache-superset-topic-5-automated-alerts-and-reporting-via-slackemail-in-superset-2gbe)
0 commit comments