Notion + Shortcuts + Notes : How to setup an ‘add Notes’ Shortcut — Step by Step !

Bellaha Merouane
9 min readNov 1, 2021

--

What do we want ?

We want to create a Shortcuts which will ask the user to write a note and add a title then add this note, both on Notion and Notes native app.

What do we need to do ?

  • show alerts to the user to fill the note’s body and title
  • store those in variables
  • add it to native Notes app
  • add it to Notion Notes database
  • show Success or Failure with error message

But first …

We need to link our database to a Notion Integration to be used through the Notion Api.

I made a 5min tutorial for this here :
Notion Integration setup : get secret key and database id — tutorial

Now that you are all setup, you should have those 3 variables :

host : https://api.notion.com/v1/pages

yourSecretKey : secret_xxxxxxxxxxx

yourDatabaseId : xxxxxxxxxx

We’ll use those later on this tutorial.

Let’s go !

Open your Shortcut app.

Add a new Shortcut

And let’s add some actions !

I will use add action named : Name of the Action often, this is how you can do depending of your device.

on iPhone: Tap the + button at the bottom of your screen and search for Name of the Action

on iPad: Search on the right panel for Name of the Action

1. Get and store the note’s body

We ask the user to type the body of the note through an Alert with message : Don’t wanna miss something ? and store it in a variable called bodyInput.

.
  • Add action named Ask for input

Fill the action : Ask for Text with Don’t wanna miss something ?

  • Add action named Set variable

Fill the action : Set variable bodyInput to Provided Input

2. Get and store the note’s title

We ask the user to type the title of the note through an Alert with message : Add a title : and store it in a variable called titleInput.

.

We do the same as 1. but for the title

  • Add action named Ask for input

Fill the action : Ask for Text with Add a title ?

  • Add action named Set variable

Fill the action : Set variable titleInput to Provided Input

3. Create the note in native Notes app then store the note in a variable and fill it with user inputs variables

We create the Note object with the content of the titleInput variable and store it in a variable called note.

  • Add action named Create note

👆 Tap Show More on the Action and disable : Show Compose Sheet

Fill the action : Create note with titleInput in Notes

  • Add action named Set variable

Fill the action : Set variable note to 🗒️ Note

We control that the bodyInput is not empty, if it’s the case we add it content to the note object.
Otherwise we add the string “Empty body” to the note object.

  • Add action named if

⚠️ Remove the default 1st parameter

Fill the action : if bodyInput has any value

  • Add action named Append to Note

👆 Drag and drop this action below the if statement

Fill the action : Append bodyInput to note

Otherwise

  • Add action named Append to Note

👆 Drag and drop this action below the otherwise statement

⚠️ Remove the default 1st parameter

Fill the action : Append (the string:) “Empty Note” to note

We currently have set our 3 variables :

bodyInput : the body of the note entered by the user

titleInput : the title of the note entered by the user

note : the note object from the native 🗒️ Note app filled with the 2 variables above

👍 Good to know : if you don’t have internet connexion, the rest of the script will fail but you have already created and save your note in the native 🗒️Note app. Nothing is lost !

Try it yourself, by tapping the ▶️ button and follow your shortcut instructions then check your notes.

Buckle up because the not so fun part is starting :

If you are familiar with JSON, the Notion documentation will help : https://developers.notion.com/reference/post-page

If not, follow along and stay focus.

4. Set up the Notion Api Call to POST our note in Notion

⚠️ Watch your spelling and uppercase/lowercase (iOS auto uppercase is not a gift here …), it costs me dozen of minutes of headache to find where i made a mistake as Notion Api error messages are not always very helpful.

We set up our request by adding the endpoint to call and fill the Headers with required fields.

  • Add action named Get Contents of URL

Fill the action : Get content of https://api.notion.com/v1/pages

👆 Tap Show More on the Action and Set :

  • Method = POST

👆 Tap Headers on the Action

  • Tap Add a new header 3 times and fill Key and Text :

fill 1st line : Key = Authorization | Text = Bearer yourSecretKey

⚠️ You need a whitespace between “Bearer” and “yourSecretKey”.

Result will look like : “Bearer secret_xxxxxxxxxxxx”

fill 2nd line : Key = Content-Type | Text = application/json

fill 3rd line : Key = Notion-Version | Text = 2021–08–16

Headers are set, now we have to fill the Request Body part.

Keep the default JSON option.

We set the body of our request with a JSON which contains datas we want to POST through our call in our Notion database.

4.1 set parent

  • 👆Tap on Add a new field

choose Dictionary

fill field : Key = parent

  • 👆Tap on 0 items and tap 👆 Add a new item

choose Text

fill fields : Key = database_id | Text = yourDatabase

  • We are done with parent, go back to the Request Body part

4.2 set properties

  • 👆Tap on Add a new field

choose Dictionary

fill field : Key = properties

  • 👆Tap on 0 items and tap 👆 Add a new item

choose Dictionary

fill field : Key = Name (this is the name of the default column on Notion Database, if you change it on Notion Database, change it here accordingly)

  • 👆Tap on 0 items and tap 👆 Add a new item

choose Array

fill field : Key = title

  • 👆Tap on 0 items and tap 👆 Add a new item

choose Dictionary

  • 👆Tap on 0 items and tap 👆 Add a new item

choose Dictionary

fill field : Key = text

  • 👆Tap on 0 items and tap 👆 Add a new item

choose Text

fill fields : Key = content | Text = titleInput (variable)

  • We are done with properties, go back to the Request Body part

4.3 set children

  • 👆Tap on Add a new field

choose Array

fill field : Key = children

  • Tap 👆 Add a new item

choose Dictionary

  • 👆Tap on 0 items and tap 👆 Add a new item

choose Text

fill fields : Key = object | Text = block

⚠️ Stay on the same screen

  • 👆Tap on Add a new field

choose Text

fill fields : Key = type | Text = paragraph

⚠️ Stay on the same screen

  • 👆Tap on Add a new field

choose Dictionary

fill Key = paragraph

  • 👆Tap on 0 items and tap 👆 Add a new item:

choose Array

fill field : Key = text

  • 👆Tap on 0 items and tap 👆 Add a new item:

choose Dictionary

  • 👆Tap on 0 items and tap 👆 Add a new item:

choose Text

fill fields : Key = type | Text = text

⚠️ Stay on the same screen

  • 👆Tap on Add a new field

choose Dictionary

fill field : Key = text

  • 👆Tap on 0 items and tap 👆 Add a new item:

choose Text

fill fields : Key = content | Text = bodyInput (variable)

Congratulations, the hard part is behind us, we are almost done.

Before going further, we’re gonna control that the POST is correctly setup.

5. Adding an Action to control the POST response then remove it

We’re gonna display the response of our POST in a list.

  • Add action named Choose from List

Fill the action : Choose from Content of URL

Play your Shortcut by tapping the ▶️ button.

If the result looks like the screen on the left we’re good to continue.

Otherwise if it looks like the screen on the right, you messed up somewhere :

  • check your spelling
  • redo the part 4

You can delete the last action you just added : Choose from Content of URL

6. Managing the POST response

We store the result of our call in a Dictionary variable ( key: value storage ) called result and get the value of the key id.

  • Add action named Set variable

Fill the action : Set variable result to Contents of URL

  • Add action named Get dictionary Value

Fill the action : Get Value for id in result (variable)

If the value of the key id exist, it means that the POST is a success, as this is the id of the note we just added to Notion, so show an alert with message : Note saved 👌.

  • Add action named if

Fill the action : if ⚙️Dictionary Value has any value

  • Add action named Show alert

👆 Drag and drop this action below the if statement

Fill the action : Show alert (the string:) “Note saved 👌”

Otherwise

We get the value of the key message of result, which contains the error message of the call response and store in a variable called errorMessage, then we show an alert with title: Error 😭 and body: with message: errorMessage.

  • Add action named Get dictionary Value

👆 Drag and drop this action below the otherwise statement

Fill the action : Get Value for message in result (variable)

  • Add action named Set variable

👆 Drag and drop this action below the Get dictionary Value action

Fill the action : Set variable errorMessage to ⚙️Dictionary Value

  • Add action named Show alert

👆 Drag and drop this action below the Set variable action

Fill the action : Show alert (the string:) “with message: errorMessage (variable)”

👆 Tap Show more button and add Title: Error 😭

And we’re done !

  • Save your shortcut
  • Set the title and the icon
  • Add it to your Home screen

Wanna try the error handling ? Try it by adding a typo in the Notion-Version field for example and see how error are handled.

Then confirm that the shortcut works well by adding a note with it, then check your Notion workspace/Notes Database and your native Notes app on your phone. Your note should on both app.

Would you be interested in a tutorial on how to push an existing note from your Notes native app to Notion Database ?

Feel free to comment, clap and share !

Cheers !

--

--