deglacer

package module
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

deglacer

MIT License GoDoc

NotionリンクをSlack上で展開してくれる君

Description

notion-deglacerはprivateなNotionリンクがSlackに投稿された際に、それを展開してくれるSlack Appです。以下の機能を備えています。

  • Notionの記事タイトル展開

Installation

  1. Notion APIのIntegrationsをInternal integrationsで作成し、tokenを取得
  2. Slack App作成
  3. notion-deglacerのデプロイ
  4. 2で作ったappに、3のURLを登録する
  5. Slack Appのbotユーザーをチャンネルに招待する
  6. 展開したいページでIntegrationを許可する
1. Notion APIのIntegrationsをInternal integrationsで作成し、tokenを取得

Getting Started を参考にしながらアクセストークンを取得してください。

2. Slack Appの作成
  1. https://api.slack.com/apps の Create New App からアプリ作成
  2. 左メニュー OAuth & Permissions を開き、Scopesでlink:writeを追加
  3. 左メニュー Event Subscriptions を開く
    • App unfurl domains を展開し、 Add Domain で、 www.notion.so を入力し、Save Changes
  4. 左メニュー Install App を開き、 Install App to Workspace -> Allow
  5. OAuth Access Token が表示されるのでメモ (SLACK_TOKEN)
  6. Basic Information を開き App CredentialsのSigning Secretをメモ (SLACK_SIGNING_SECRET)

※後で戻ってくるので、Slack Appの管理画面は開いたままにしておく。

3. deglacerのデプロイ

deglacerはGoで書かれたWebアプリケーションなので、任意の場所で簡単に動かせますが、HerokuやGoogle App Engineを利用するのがより簡単でしょう。動作のためには以下の環境変数が必要です。

  • NOTION_TOKEN: 手順1で取得したNotionのアクセストークン
  • SLACK_TOKEN: 手順2-5で取得したSlack Appのトークン
  • SLACK_SIGNING_SECRET: 手順2-6で取得したリクエスト署名検証secret
Herokuで動かす場合

以下のボタンからデプロイできます。

Deploy

4. 2で作ったappに、3のURLを登録する
  • 左メニュー Event Subscriptions を開き、 Request URL に 3でデプロイしたdeglacerのURLを入力
  • Verified と表示されたら Enable Events を On にして Save Changes
5. Slack Appのbotをチャンネルに招待する

Bot名は、左メニューのApp Homeから確認してください。

6. 展開したいページでIntegrationを許可する

API経由でのアクセスをするためには、そのページでIntegrationを許可する必要があります。
Grant Integrations

現状ワークスペースレベルで全てのページを許可することはできないようです。
とはいえ親ページで許可をすれば子孫のページでも適用されるため、サイドバーの各ページで許可をすれば面倒ですが解決は可能です。

これで準備完了です。

See Also

notion-deglacerはSongmuさんのリポジトリをフォークして作られています。
https://github.com/Songmu/deglacer
Webサーバーの処理、Slackへの送信処理の大半をそのまま利用させていただいています。この場をお借りして御礼申し上げます。ありがとうございました!

Author

miya

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(argv []string) error

Types

This section is empty.

Directories

Path Synopsis
cmd
deglacer command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址