Skip to content
Treasure Data to Slack app
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
views
Gemfile
Gemfile.lock
README.md
app.json
app.rb
config.ru
td2slack.svg

README.md

td2slack

Treasure Data to Slack bridge.

What is this?

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   -------

How does it work?

  • 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 is

    col1 col2
    100 hello
    200 world

    Then, @td is

    {"col1" => [100,200], "col2" => ["hello","world"]}

Easy Deploy on Heroku

Deploy

License

Apache 2.0 License

You can’t perform that action at this time.