Created
August 19, 2018 05:58
-
-
Save hyuki/9c4c98e9ca92893a4477eb7536372086 to your computer and use it in GitHub Desktop.
Script to send "/clip yesterday" to your channel. (Slack-Evernote integration)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# | |
# clip-yesterday.rb - Script to send "/clip yesterday" to your channel. | |
# | |
# WARNING: This script uses Slack Legacy Tokens. Use at your own risk. | |
# | |
# Author: hyuki | |
# Based on: | |
# * https://github.com/wgkoro/lambda_slack_command | |
# * https://api.slack.com/custom-integrations/legacy-tokens | |
# * https://twitter.com/WG_koro/status/1029657575971741696 | |
require 'uri' | |
require 'open-uri' | |
# $ grep CLIP_YESTERDAY ~/.bash_profile | |
# export CLIP_YESTERDAY_TOKEN=xoxp-0000000000-0000000000-000000000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | |
# export CLIP_YESTERDAY_CHANNEL_ID=C00000000 | |
params = { | |
'token' => ENV['CLIP_YESTERDAY_TOKEN'], | |
'channel' => ENV['CLIP_YESTERDAY_CHANNEL_ID'], | |
'command' => '/clip', | |
'text' => 'yesterday', | |
} | |
open("https://slack.com/api/chat.command?#{URI.encode_www_form(params)}") do |f| | |
puts f.readlines | |
end | |
# vim: set filetype=ruby: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment