Treasure Data to Slack bridge.
This is a little Sinatra app that bridges between Treasure Data's HTTP PUT result output functionality and Slack's Incoming Webhook API.
So, it's like
--------------------- HTTP(S) PUT ---------- -------
| Treasure Data table |-------------->| td2slack |------------------->| Slack |
--------------------- abc.com/hello ---------- render hello.erb -------
-
Set the env variable
SLACK_WEBHOOK_URL
to be a Slack incoming webhook URL. -
The path of the app corresponds to the ERB template under
/views
. So, if you specify the path/daily_stats
, the template/views/daily_stats.erb
is rendered as a Slack message. -
The special variable
@td
holds the table data as a JSON whose keys are column names and values are column values. Ex: if the result output iscol1 col2 100 hello 200 world Then,
@td
is{"col1" => [100,200], "col2" => ["hello","world"]}
Apache 2.0 License