/clip yesterday
と入力すると、昨日一日の投稿をEvernoteに送ってくれる。/clip yesterday
を手動ではなくcronなどで自動実行したい。#! /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:
@wgkoro
さんに教えていただきました。