redash icon indicating copy to clipboard operation
redash copied to clipboard

Microsoft Teams Webhook alert destination

Open kevinchiang opened this issue 3 years ago • 11 comments

What type of PR is this? (check all applicable)

  • [x] New Alert Destination

Description

Create a new alert destination for Microsoft Teams Webhooks

Related Tickets & Documents

https://discuss.redash.io/t/microsoft-teams-integration/852

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Screen Shot 2022-01-21 at 3 31 15 PM Screen Shot 2022-01-21 at 3 33 26 PM Screen Shot 2022-01-21 at 3 33 35 PM

kevinchiang avatar Jan 21 '22 23:01 kevinchiang

Working on text formatting and icons.

kevinchiang avatar Jan 21 '22 23:01 kevinchiang

microsoftteamswebhook Planning to use this icon.

kevinchiang avatar Jan 21 '22 23:01 kevinchiang

Screen Shot 2022-01-21 at 4 16 49 PM Screen Shot 2022-01-21 at 4 16 58 PM Screen Shot 2022-01-21 at 4 18 27 PM Screen Shot 2022-01-21 at 4 22 29 PM

kevinchiang avatar Jan 22 '22 00:01 kevinchiang

MS Alert Webhook documentation here: https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference

kevinchiang avatar Jan 22 '22 00:01 kevinchiang

@arikfr , one thing I noticed during testing is that a trigger is fired when the criteria is met and when the criteria is reset. Is that correct (I see it here now https://redash.io/help/user-guide/alerts/setting-up-an-alert#Alert-Statuses)? Is that info in the new_state argument (new_state seems the three options here: https://github.com/getredash/redash/blob/master/redash/models/init.py#L970)?

kevinchiang avatar Jan 27 '22 19:01 kevinchiang

I noticed during testing is that a trigger is fired when the criteria is met and when the criteria is reset. Is that correct?

Yes.

Is that info in the new_state argument (new_state seems the three options here:

Yes. Related docs:

UNKNOWN means Redash does not have enough data to evaluate the alert criteria. You will see this status immediately after creating your Alert until the query has executed. You will also see this status if there was no data in the query result or if the most recent query result doesn’t include the Value Column you configured.

susodapop avatar Mar 03 '22 19:03 susodapop

If for some reason this doesn't make it into the next release, could the patch from #5726 ship tactically (it's super tiny), and then reverted in this PR?

jnmclarty avatar Mar 31 '22 12:03 jnmclarty

Any update about this work? There's an official way to implement this MS Teams in the current release (such as a plugin)?

DougTrajano avatar Jul 30 '22 15:07 DougTrajano

This will be included in the next release later this summer.

Yes, alert destinations are pluggable just like query runners 👌 This one should be compatible with any installation of Redash V10.

susodapop avatar Jul 30 '22 22:07 susodapop

This will be included in the next release later this summer.

Yes, alert destinations are pluggable just like query runners 👌 This one should be compatible with any installation of Redash V10.

how can I add it to my current instance so? Do we have a tutorial for that?

DougTrajano avatar Aug 23 '22 16:08 DougTrajano

how can I add it to my current instance so? Do we have a tutorial for that?

We don't but working on publishing a doc with a strategy for this. There are a few different approaches. Probably the easiest is to copy the file into your local copy of the source code and then issue a COPY command in the Dockerfile that places it into your containers.

susodapop avatar Aug 24 '22 14:08 susodapop

In case anyone wants to bring this into their existing install, your Dockerfile should look something like this. (double check the base image)

FROM redash/redash:8.0.0.b32245

USER root

# upgrade to fix vulnerabilities and enable ldap
RUN apt update && apt install -y sudo linux-libc-dev
RUN pip install --upgrade pip && pip install --upgrade ldap3 Werkzeug==0.16.1

USER redash

COPY microsoft_teams_webhook.py /app/redash/destinations/microsoft_teams_webhook.py
COPY microsoft_teams_webhook.png /app/client/dist/images/destinations/microsoft_teams_webhook.png

Then set the environment variable

REDASH_ADDITIONAL_DESTINATIONS: redash.destinations.microsoft_teams_webhook

kevinchiang avatar Sep 21 '22 20:09 kevinchiang

Thanks!

arikfr avatar Oct 07 '22 06:10 arikfr