<aside> 📣 此文章连接至部落格的贴文:《在 Notion 创建 Habit Tracker》 链接1:https://sogoleo.wordpress.com/2023/04/29/notion-habit-tracker/ 链接2:https://sogoleo.blogspot.com/2023/04/notion-habit-tracker.html

</aside>

部落格上这篇文章《在 Notion 创建 Habit Tracker》的纲要如下:

  1. 在 Notion 创建 Habit Traker 的缘起
  2. Habit Tracker 的主页面
  3. 创建两个重要的资料库:Daily Habits 和 Weekly Habits 的资料库。
  4. 在 Habit Tracker (主页面) 创建 synced block,然后将两个重要的资料库放进 synced block 里。
  5. Habit Tracker 的页面设计
  6. 编写两个资料库相关的程式 (formula) 和 relation 的功能
  7. 用 Apple Shortcuts 编写自动化程序与之配合的原因

<aside> ✍️ 然后,此文章主要补充如何使用 Notion 的 API 和如何编写能通过 iPhone 的 Shortcuts 应用在 Daily Habits 资料库里创建新页的程序及使用自动化的功能。

</aside>


自动化程序的编写

  1. 到 Notion API 网站 (https://developers.notion.com/) 获取 token:

    Go to My Integration

    Go to My Integration

    Create new integration

    Create new integration

    Name your integration

    Name your integration

    Get your token

    Get your token


  2. 邀请 Integration 的机器人到你的资料库里。

    Share and invite the integration bot to your database

    Share and invite the integration bot to your database

    Select the integration bot and invite it to your database.

    Select the integration bot and invite it to your database.


  3. 在 iOS Shortcuts 的程序里编写 JSON 语法

    1. 在创建 daily habit 的新页面要附加 relation property 时遇到了一些难题,原来是要在两个资料库 (Daily Habits 和 Weekly Habits) 里都必须邀请 integration 的 bot 进来才能让机器人找到所要资料库里指定要添加的 relation property 的页面。
    2. Shortcuts 程序里包含的 json 语法能让程序通过 API 在 Daily Habits 资料库里创建新的页面,语法里也包含了指定哪一个星期的 weed id 要放到 relation property 里,如下:

包含 json 语法的 Shortcuts 程序

包含 json 语法的 Shortcuts 程序

日期的设定如下图:

记得要设定成 ISO 8601 的

记得要设定成 ISO 8601 的

然后,Get contents of … 的设定如下:

Bearer 后空一格,然后加上 API 的 KEY

Bearer 后空一格,然后加上 API 的 KEY