Code Monkey home page Code Monkey logo

notion-deglacer's Introduction

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

notion-deglacer's People

Contributors

mh4gf avatar songmu avatar spinute avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.