This project that will sync your Notion tasks to your Habitica account like creation tasks depending of their priority, their status (todo or complete) and close them in order to score in Habitica.
Download or clone the repo :
git clone https://github.com/vandaref/from_notion_to_habitica.git
- Follow the instructions -> API_Habitica
- Get your Habitica API Token (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX)
- Get your User ID (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX)
- Create an integration -> Notion Integrations
- Get your integration token (secret_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
- Get your databaseId -> Get your databaseId
- How get your databaseId :
- Try to share your database and copy the link
- https://www.notion.so/yourusername/**XXXXXXXXXXXXXXXXXXX**?v=...
- Finally, in Notion, select the database that you want to sync with Habitica. Look for Connections (in settings) and choose the integration that you created.
Your tasks must follow those properties guidelines :
-
Property : Name
- Name : Name
- Type : title
-
Property : Priotity
- Name : Priority
- Type : select
- Values : Low, Medium, High
-
Property : Status
- Name : Status
- Type : select
- Values : Completed, etc. (one of then must be Completed)
In order to respect this part of the code :
for i in data['results']:
name = i['properties']['Name']['title'][0]['text']['content']
status = i['properties']['Status']['select']['name']
priority = i['properties']['Priority']['select']['name']
Update the values in the script depending on your own API etc.
Start the script. I suggest to make a cron in order to execute the script few times in a day. (cf. How to create a cron)
python3 from_notion_to_habitica.py