COMMENT
Created by Alex Sherwood aka @aNotioneer. More Apple Shortcuts and Notion templates at anotioneer.com.
Creators - please feel free to copy and adapt this Shortcut, all I ask is that you mention where the original version came from.
SHORTCUTS
Run
Settings | Record Expenses

Shortcut Result
SCRIPTING
Get dictionary from
Shortcut Result

Dictionary
SCRIPTING
Get
Value
for
API Key
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
API Version
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
Database ID
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
Name Label
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
Category Name
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
Category Type
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
Number Name
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
Date Name
in
Settings

Dictionary Value
NETWORK
Get contents of
https://api.notion.com/v1/databases/
Database ID
Options Under Construction

Contents of URL
SCRIPTING
Get
Value
for
object
in
Fetch Database Response

Dictionary Value
SCRIPTING
If
Fetch Database Response Object
is
error
SCRIPTING
Get
Value
for
message
in
Fetch Database Response

Dictionary Value
SCRIPTING
Show alert
Informational Message
SCRIPTING
Otherwise
SCRIPTING
End If

If Result
SCRIPTING
Get
Value
for
properties.
Category Name
.
Category Type
.options
in
Fetch Database Response

Dictionary Value
SCRIPTING
Repeat with each item in
Category Options

Repeat Results
SCRIPTING
Get
Value
for
name
in
Repeat Item

Dictionary Value
SCRIPTING
End Repeat

Repeat Results
SCRIPTING

Provided Input
SCRIPTING
Choose from
Category Names

Chosen Item
SCRIPTING
If
Category Type
is
select
TEXT
{
"name": "
Chosen Categories
"
}

Text
VARIABLES
Set variable
Categories JSON
to
Single Category JSON
SCRIPTING
Otherwise
SCRIPTING
Repeat with each item in
Chosen Categories

Repeat Results
TEXT
{
"name": "
Repeat Item
"
}

Text
SCRIPTING
End Repeat

Repeat Results
TEXT
Combine
Repeat Results
with
Custom
,

Combined Text
TEXT
[
Combined Categories JSON
]

Text
VARIABLES
Set variable
Categories JSON
to
Categories Array
SCRIPTING
End If

If Result
SCRIPTING

Provided Input
TEXT
{
"parent": {
"database_id": "
Category Name
"
},
"properties": {
"
Current Date
": {
"title": [
{
"text": {
"content": "
Amount
"
}
}
]
},
"
Category Type
": {
"
Date Name
":
Expense Name
},
"
Number Name
": {
"date": {
"start": "
Database ID
"
}
},
"
Name Label
": {
"number":
Categories JSON
}
}
}

Text
NETWORK
Get contents of
https://api.notion.com/v1/pages/
Options Under Construction

Contents of URL
SCRIPTING
Get
Value
for
object
in
Create Page Response

Dictionary Value
SCRIPTING
If
Create Page Response Object
is
error
SCRIPTING
Get
Value
for
message
in
Create Page Response

Dictionary Value
SCRIPTING
Show alert
Informational Message
SCRIPTING
Show alert
Informational Message
SCRIPTING
Otherwise
SCRIPTING
Show alert
Informational Message
SCRIPTING
End If

If Result