dodonki1223 / qiita_trend_slack_notifier

qiita_trendを使用したslack通知スクリプト

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

qiita_trend_slack_notifier

qiita_trendgemを使用したSlack通知用のスクリプトです

SlackNotifySample

使用方法

Slackアプリの登録

まずは通知させるためのSlack Appを作成します。
Slack Appリンクをクリックしてページに遷移して下さい。

SlackAppページ

Create New Appをクリックします。

SlackAppCreate

App Name,Development Slack Warkspaceを記述してCreate Appをクリックします。

SlackWebhookBotton

Incoming Webhooksをクリックします。

SlackWebhookSetting

Off→Onに変更し、Add New Webhook to Workspaceをクリックします。

SlackWebhookChannelSetting

投稿先を設定してインストールします。

SlackWebhookUrl

copyをクリックすることでWebhook用のURLをコピーできます。

WebHookURLとQiitaにログインするためのユーザーとパスワードの設定を行う

config.rbを書き換えます WeeklyとMonthlyを使用しない場合はユーザー名とパスワードの設定は必要ありません

# frozen_string_literal: true

require 'qiita_trend'
require './qiita_notifier/configuration'

QiitaNotifier.configure do |config|
  # Qiitaでログイン出来るユーザー名とパスワードをセットしてください
  config.user_name = 'user_name'    ← Qiitaにログインするユーザー名
  config.password = 'password'     ← Qiitaにログインするパスワード
  # Slackで作成したアプリのWebHookURLを設定してください
  config.web_hook_url = 'web_hook_url' ← 設定したWebHookURL
  # config.channel = '' ⇐ channelを任意選択したい場合に設定してください
end

QiitaTrend.configure do |config|
  config.user_name = QiitaNotifier.configuration.user_name
  config.password = QiitaNotifier.configuration.password
end

実行コマンド

# dailyのトレンドをSlackに通知
$ ruby notify_trend.rb

# dailyのトレンドでNEWのものだけをSlackに通知
$ ruby notify_trend.rb --new

# personalのトレンドをSlackに通知
$ ruby notify_trend.rb -t personal

# personalのトレンドでNEWのものだけをSlackに通知
$ ruby notify_trend.rb -t personal --new

About

qiita_trendを使用したslack通知スクリプト


Languages

Language:Ruby 100.0%