Notion-DiscordBot
A discord bot consuming Notion API to add and retrieve data from Notion databases.
Instructions to use the bot:
Invite the bot using Bot Invite Link and run *setup
To self-host the bot, read SETUP.md.
Creating Notion Database:
-
Go to Notion and create a new Integration. Note the internal Integration.
-
Then in Notion create in a new page create a table like this (Tag being optional field):
4 columns where:
- Contributor is of property type Title
- URL of url type
- Title of text type
- Tag of multi-select type
- Click on the three dots and press Open as page
- Then press share and copy the URL. The URL will look something like this: https://www.notion.so/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX?v=YYYYYYYYYYYYYYYYYYYYYYYYY
Note down the X part of the url (RED part)
This is your database id
- Also press share again, press Invite and then click on the integration you made earlier
Bot Usage:
Setup Bot:
Run *setup
command and enter notion api key (the one you got after creating integration) and notion database id.
Adding Record:
*add <URL_YOU_WANT_TO_RECORD>
=> This will add a new record to your database (if tagging is enabled, it will add a misc
tag)
*add <URL_YOU_WANT_TO_RECORD> <TAG>
=> This will add a new record to your database with the <TAG>
tag
For multiple tags:
*add <URL_YOU_WANT_TO_RECORD> <TAG>,<TAG1>,<TAG2>
Sample database populated by the bot:
Searching Record through tags:
*search <Tag1>
For multiple tags: /search <Tag1> <Tag2>.....<TagN>
Searching Record through title:
*title <title>
Deleting Record through tags:
*delete <Tag 1>
For multiple tags: *delete <Tag 1> <Tag2>......<Tag N>
Deleting Record through title:
*delete <title>
Uploading files
NOTE: In the below images the prefix used is: *
You can upload any file to the notion database. It can be a pdf, png, jpeg etc.
Here a png file is being uploaded
- Drag your file to the chat in discord, add comment to the file you uploaded
Here servatom
is tag for the file.
- It will then ask the title of the file you uploaded:
- The database will be updated:
Changing Prefix
To change the bot prefix, type *prefix
, *
being the deault prefix.
Email: [email protected]
GitHub: @raghavTinker
Email: [email protected]
GitHub: @rdotjain
Special thanks to Animesh Gupta for giving us better ideas to make this project better and for spreading the word.