Skip to content

Conversation

@kevinchiang
Copy link
Contributor

@kevinchiang kevinchiang commented Jan 21, 2022

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

  • 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
Copy link
Contributor Author

Working on text formatting and icons.

@kevinchiang
Copy link
Contributor Author

microsoftteamswebhook
Planning to use this icon.

@kevinchiang
Copy link
Contributor Author

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
Copy link
Contributor Author

@susodapop susodapop self-assigned this Jan 24, 2022
Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Thank you for submitting this!

return {
"type": "object",
"properties": {
"url": {"type": "string"},
Copy link
Member

Choose a reason for hiding this comment

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

You might want to add a title here to indicate this is a webhook URL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Screen Shot 2022-01-26 at 3 23 28 PM

:type app: redash.Redash
"""
try:
data = {
Copy link
Member

Choose a reason for hiding this comment

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

What about supporting custom templates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can try to copy what the chatwork destination did for message templates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screen Shot 2022-01-27 at 10 19 36 AM

@kevinchiang
Copy link
Contributor Author

kevinchiang commented Jan 27, 2022

@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)?

@susodapop
Copy link
Contributor

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 susodapop added the Team Review Meets PR criteria, ready for full review label Mar 3, 2022
@jnmclarty
Copy link

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?

@DougTrajano
Copy link

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

@susodapop
Copy link
Contributor

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.

@DougTrajano
Copy link

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?

@susodapop
Copy link
Contributor

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.

@kevinchiang
Copy link
Contributor Author

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

@arikfr arikfr merged commit 3280991 into getredash:master Oct 7, 2022
@arikfr
Copy link
Member

arikfr commented Oct 7, 2022

Thanks!

@tsbkw tsbkw mentioned this pull request Oct 14, 2022
10 tasks
blarghmatey pushed a commit to mitodl/redash that referenced this pull request Oct 27, 2022
* Microsoft Teams Webhook alert destination

* Text formatting and new image for Microsoft Teams Webhook

* Comment on how to build frontend

* Add title to clarify webhook URL

* Make the message into a configurable template.
AkaashK pushed a commit to tharzeez/redash that referenced this pull request Jul 18, 2023
* Microsoft Teams Webhook alert destination

* Text formatting and new image for Microsoft Teams Webhook

* Comment on how to build frontend

* Add title to clarify webhook URL

* Make the message into a configurable template.
harveyrendell pushed a commit to pushpay/redash that referenced this pull request Jan 8, 2025
* Microsoft Teams Webhook alert destination

* Text formatting and new image for Microsoft Teams Webhook

* Comment on how to build frontend

* Add title to clarify webhook URL

* Make the message into a configurable template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team Review Meets PR criteria, ready for full review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants