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.
npm install -g notion-db-notification-cli
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 name
File provider is read/write local store state file.
store:
type: 'file'
path: 'path' # path of cli tool's state file
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 key
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.
notion-db-notification {config_yml_file_to_path}
if you want to dry-run: you can use -d
option
notion-db-notification {config_yml_file_to_path} -d
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: 1000
senders:
- type: 'slack'
token: 'env:SLACK_TOKEN' # environment variable name is SLACK_TOKEN
store:
type: 'github'
token: 'env:GITHUB_TOKEN' # environment variable name is GITHUB_TOKEN
store:
type: 'github'
privateKey: 'env:GITHUB_APP_PRIVATE_KEY' # environment variable name is GITHUB_APP_PRIVATE_KEY
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~1500
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_NAME
- 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:xxx
command - change
.github/bump.yml
- publish:
npm publish --access public --workspaces
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