Notion put is a generic script that allows to insert data from a json file in a Notion database. The interest of this script is that during the update of the data the information in the database is simply updated on the page which allows to keep the already existing backlink to other Notion page
-
Before getting started, create an integration and find the token. → Learn more about authorization.
-
Then save your api key(token) as your os environment variable
$ export NOTION_TOKEN="{your integration token key}"
- Notionput requires
db_id
of the Notion database - Notionput requires
json_file
formatted as in the example below
{
"entries": [{
"_id": "tweetid1",
"type": "Twitter",
"fields": {
"message": "blah blah",
"author": "Elon",
"location": "paris"
},
"body": {
"type": "embed",
"content": "<tweet_url>"
}
}]
}
- The keys between the braces of
fields
can be modified but the same name must be assigned to the column in the database - Example of use of the script :
python3 main.py -i d08f397181941f990c7ed767a653 -f data.json
Note Works with python version 3.10 or later
- If you want to increase the number of input data, you must first delete the elements in the database from the same source.