2

I want to automate the setup for my daily journal which generally has the title "Daily Journal @today"

The body of my post request looks like this:

body: {
        parent: { database_id: databaseId },
        properties: {
          title: {
            title:[
              {
                "text": {
                  "content": "Daily ..." // how do I add an at mention here, @today
                }
              }
            ]
          },
          date: new Date().toISOString()
        }
      },

how do I put an at mention in the title?

2 Answers2

1

I figured I can do this

title:[
          {
            "text": {
              "content": "Mind Cap "
            }
          },
          {
            "mention": {
              type: "date",
              date: {
                "start": new Date().toISOString().substr(0,10)
              }
            }
          }
        ]

But it still isn't the nice "@Today" mention

1

You can add it as a title, and you can supply it as rich text. An example of that is below. Likewise, you can add it to a date property field. I've added an example below the rich text.

{
   "parent":{
      "database_id":"{{database}}"
   },
   "properties":{
      "Name":{
         "title":[
            {
               "text":{
                  "content":"A Test Page"
               }
            },
            {
               "type":"mention",
                "mention": {
                    "type": "date",
                        "date": {
                        "start": "2021-07-28T11:00:00.000-04:00"
                        }
                }
            }
         ]
      },
      "sample_text":{
         "rich_text":[
            {
               "type":"mention",
                "mention": {
                    "type": "date",
                        "date": {
                        "start": "2021-07-11T11:00:00.000-04:00"
                        }
                }
            },
            {
               "type":"text",
               "text":{
                  "content":"Some more text with "
               }
            },
            {
               "type":"text",
               "text":{
                  "content":"some"
               },
               "annotations":{
                  "italic":true,
                  "bold": false,
                  "underline": false,
                  "strikethrough": true,
                  "color": "blue"
               }
            },
            {
               "type":"text",
               "text":{
                  "content":" "
               }
            },
            {
               "type":"text",
               "text":{
                  "content":"fun"
               },
               "annotations":{
                  "bold":true,
                  "underline": false,
                  "strikethrough": false
               }
            },
            {
               "type":"text",
               "text":{
                  "content":" "
               }
            },
            {
               "type":"text",
               "text":{
                  "content":"formatting"
               },
               "annotations":{
                  "color":"pink"
               }
            }
         ]
      },
      "Time": {
            "date": { "start": "2021-08-08T01:00:00.000-05:00" }
        }
    }
}
adlopez15
  • 3,449
  • 2
  • 14
  • 19