Add Task from Notion through Alfred

Jacob Mathew
Jun 10, 2023

Created a way to add my task directly to Notion through Alfred. Thanks #ChatGPT for the assist.

  1. Get a Notion API code
  2. Find out the Notion Database ID where you want to add a page.
  3. In Alfred Workflows: add Key Word, then below script.

For anyone interested here is the code:

#!/bin/bash

# Replace with your Notion API key
NOTION_API_KEY="NOTION API KEY goes here"

# Replace with your Notion database ID
NOTION_DATABASE_ID="Database ID goes here"

# Get the title from the Alfred query
TITLE="$1"

# Make the API request to create a new page
curl -X POST https://api.notion.com/v1/pages \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Content-Type: application/json" \
-H "Notion-Version: 2021-08-16" \
--data "{
\"parent\": { \"database_id\": \"$NOTION_DATABASE_ID\" },
\"properties\": {
\"title\": {
\"title\": [
{
\"text\": {
\"content\": \"$TITLE\"
}
}
]
}
}
}"

#Alfred #Notion #TaskManager

--

--