Skip to content

Servatom/Notion-DiscordBot

Repository files navigation

Notion-DiscordBot

Build StatusVisits Badge

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:

  1. Go to Notion and create a new Integration. Note the internal Integration.

  2. 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
  1. Click on the three dots and press Open as page


  1. 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

  1. Also press share again, press Invite and then click on the integration you made earlier

Bot Usage:

  1. Setup
  2. Add Record
  3. Search
  4. Delete
  5. Upload Files
  6. Change Prefix

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>

Example:

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>

Example:

Deleting Record through tags:

*delete <Tag 1>

For multiple tags: *delete <Tag 1> <Tag2>......<Tag N>

Deleting Record through title:

*delete <title>

Example:

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

  1. Drag your file to the chat in discord, add comment to the file you uploaded


Here servatom is tag for the file.

  1. It will then ask the title of the file you uploaded:


  1. The database will be updated:


Changing Prefix

To change the bot prefix, type *prefix, * being the deault prefix.




🎓 All maintainers in this project are under-graduate students in the Department of Computer Science and Engineering, TIET @ Thapar University

👦 Raghav Sharma
      Email: raghav.sharma17@outlook.com
      GitHub: @raghavTinker

👩 Rupanshi Jain
      Email: jainrupanshi@outlook.com
      GitHub: @rdotjain

Special thanks to Animesh Gupta for giving us better ideas to make this project better and for spreading the word.