kelvinau / Google-Trends-Slackbot

Hackathon Demo in UBC Local Hack Day 2018 - A Slackbot that picks a Google Trends item and tells the summary of the top three.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Trends Slackbot

Hackathon Demo in UBC Local Hack Day 2018

A Slackbot that picks a Google Trends item and tells the summary of the top three.

Frightgeist 2018 Rankings for Halloween Costumes

MLB Playoofs Most searched players

Setup

  • Upload this repository to the Slack Request URL location, and add config.ini for BOT_TOKEN, DB_SERVER, DB_ADMIN, DB_PASSWORD, DB_NAME, and DB_TABLE
  • Setup bot (https://api.slack.com/bot-users) and enable app_mention in Event Subscriptions
  • DB Table - CREATE TABLE {DB_TABLE} ( channel VARCHAR(256), user VARCHAR(256), conversation LONGTEXT, primary key (channel, user) );

How to use

Mention your bot and type top trend e.g.@bot top trend

What I learnt

Relying on Slackbot for the GUI is the biggest mistake

  • Multi-line message is still not supported as of December 01, 2018 (earliest request started in 2015 https://twitter.com/slackhq/status/592923143309787136?lang=en)
  • No custom styling for the option dropdown in interactive messages. If an item is too long, it is trimmed with '...'
  • The request structures from Slack to your own server can be quite different, e.g. normal message (application/json) vs interactive messages (application/x-www-form-urlencoded with a key payload).

About

Hackathon Demo in UBC Local Hack Day 2018 - A Slackbot that picks a Google Trends item and tells the summary of the top three.


Languages

Language:PHP 100.0%