Code (JavaScript/Python/etc) Alert Destination


#1

Has there ever been discussion around adding feature to Re:dash that would execute some ad-hoc code as an alert destination? JavaScript would be my first choice of language for this and an environment similar to Zapier Code would suit my use case.

The use case for a such a feature is to schedule a query against our BigQuery datastore and use the results to tag users in Intercom. The scheduling and running of the query is already built into Re:dash and triggering alerts on those queries is supported as well. While tagging users in Intercom is a very specific problem, it’s one that would be quite easy with access to the query results and a JavaScript runtime with the fetch function.

I’m going to prototype the solution using webhook alert destinations + Zapier, but if that goes well would consider adding a proof-of-concept to Re:dash using PyV8 or something similar.


#2

Interesting idea. What would Redash pass to the arbitrary code? I can think of a few options:

  • The full results set
  • The text of the alert
  • The date and time of the alert along with the alert parameters

It’s important to minimize the attack surface if someone authors a malevolent script and circulates it. I think we would want a gallery of sorts that shows available integrations, even those provided by the community, so each one can be signed. The worst possible case would be less-technical users pasting unknown javascript into a console somewhere.