notion-db-notification-core v0.1.4
notion-db-notification
This cli tool is that notify created or updated page of notion database.
When you run the CLI tool, it will notify you of changes since the last time you ran it.
Usage
Install
npm install -g notion-db-notification-cli
Setup
Create config file:
scheme: 'v0'
notion:
token: 'notion_token' # your notion token
interval: 1000
store:
type: 'file'
path: 'path' # path of cli tool's state file
senders:
- type: 'slack'
token: 'slack_token' # your slack token, required scope is chat:write
channels:
- name: 'name' # channel name
slack_id: 'slack_id' # your slack channel id
sources:
- database: 'database_id' # your notion database id
channel: 'channel_name' # channel nameStore providers
File provider
File provider is read/write local store state file.
store:
type: 'file'
path: 'path' # path of cli tool's state fileGitHub provider
GitHub provider is read/write github repository store state file. (using Contents API)
# using your personal access token
store:
type: 'github'
path: 'path' # path of cli tool's state file
owner: 'owner' # owner name of github repository
repository: 'repository' # repository name of github repository
token: 'token' # github token# using your github app token
store:
type: 'github'
path: 'path' # path of cli tool's state file
owner: 'owner' # owner name of github repository
repository: 'repository' # repository name of github repository
applicationId: 1 # github app id
installationId: 1 # github app's installation id
privateKey: 'privateKey' # github app's private keyInitialization
notion-db-notification {config_yml_file_to_path} -i
This command is to add database state if not managed. So, recommend to execute this command every execution.
Running
notion-db-notification {config_yml_file_to_path}
if you want to dry-run: you can use -d optionnotion-db-notification {config_yml_file_to_path} -d
Advanced
Secure token
if you avoid to write token to config file, you can use environment variable.
notion:
token: 'env:NOTION_TOKEN' # environment variable name is NOTION_TOKEN
interval: 1000senders:
- type: 'slack'
token: 'env:SLACK_TOKEN' # environment variable name is SLACK_TOKENstore:
type: 'github'
token: 'env:GITHUB_TOKEN' # environment variable name is GITHUB_TOKENstore:
type: 'github'
privateKey: 'env:GITHUB_APP_PRIVATE_KEY' # environment variable name is GITHUB_APP_PRIVATE_KEYRatelimit for Notion API
Notion API has Rate limits.
ref: https://developers.notion.com/reference/request-limits#rate-limits
So, this tool can be set interval milli seconds for api call.
notion:
token: 'notion_token' # your notion token
interval: 1000 # recommend range of 500~1500Recipe
Notify empty title page
config file:
sources:
- database: 'database_id' # your notion database id
channel: 'channel_name' # channel name
filter: 'page.properties["YOUR_TITLE_PROPERTY_NAME"].title.length == 0' # replace YOUR_TITLE_PROPERTY_NAMEDevelopment
- install:
npm install - add package:
npm init -w packages/xxx- add manually reference at package.json
- change properties at new package.json
- add reference root tsconfig.json
npm run reference- add
npm run copy:xxxcommand - change
.github/bump.yml
- publish:
npm publish --access public --workspaces
License
This repository is under MIT License
including libraries:
- makenotion/notion-sdk-js, published by MIT License
- nodeca/js-yaml, published by MIT License
- octokit/rest.js, published by MIT License
- octokit/auth-app.js, published by MIT License
- slackapi/node-slack-sdk, published by MIT License