You know how to list tasks. Time to add one from Python. What do you think the params look like?
Probably a title at minimum? And maybe a status like needsAction to mark it incomplete?
Exactly. GOOGLETASKS_INSERT_TASK takes a title, an optional status, and a tasklist_id. For the default list, passing the string "@default" works — Google maps that to your primary list automatically:
result = toolset.execute_action(Action.GOOGLETASKS_INSERT_TASK, {
"title": "Review PR",
"tasklist_id": "@default",
"status": "needsAction",
})@default is a magic string the API recognizes? Instead of a real list ID?
Google uses that token for "whatever the user's default list is." Saves you a lookup call just to find your own primary list. Every Google client treats the magic token identically, so the same three lines work whether you have one list or ten. The function stays short:
def create_task(title: str) -> dict:
result = toolset.execute_action(Action.GOOGLETASKS_INSERT_TASK, {
"title": title,
"tasklist_id": "@default",
"status": "needsAction",
})
return resultWhy hard-code "needsAction" instead of letting the caller pass a status?
A newly created task is virtually always open — "needsAction" is the safe default. You can always add a status parameter later. Starting with the common case keeps the function's signature small and the caller's life simple.
So once this runs, the task actually shows up in Google Tasks on my phone within seconds?
Phone, web, any Google client. You just wrote your name onto Google's servers. Every function from here that touches Tasks uses this same three-line skeleton.
TL;DR: GOOGLETASKS_INSERT_TASK needs a title, a tasklist_id, and a status — pass "@default" to aim at your primary list without any lookup.
Action.GOOGLETASKS_INSERT_TASK"@default" maps to the user's primary task list"needsAction" marks the task as still openid, title, status| Value | Meaning |
|---|---|
needsAction | open / to-do |
completed | done, tucked under the strikethrough |
You know how to list tasks. Time to add one from Python. What do you think the params look like?
Probably a title at minimum? And maybe a status like needsAction to mark it incomplete?
Exactly. GOOGLETASKS_INSERT_TASK takes a title, an optional status, and a tasklist_id. For the default list, passing the string "@default" works — Google maps that to your primary list automatically:
result = toolset.execute_action(Action.GOOGLETASKS_INSERT_TASK, {
"title": "Review PR",
"tasklist_id": "@default",
"status": "needsAction",
})@default is a magic string the API recognizes? Instead of a real list ID?
Google uses that token for "whatever the user's default list is." Saves you a lookup call just to find your own primary list. Every Google client treats the magic token identically, so the same three lines work whether you have one list or ten. The function stays short:
def create_task(title: str) -> dict:
result = toolset.execute_action(Action.GOOGLETASKS_INSERT_TASK, {
"title": title,
"tasklist_id": "@default",
"status": "needsAction",
})
return resultWhy hard-code "needsAction" instead of letting the caller pass a status?
A newly created task is virtually always open — "needsAction" is the safe default. You can always add a status parameter later. Starting with the common case keeps the function's signature small and the caller's life simple.
So once this runs, the task actually shows up in Google Tasks on my phone within seconds?
Phone, web, any Google client. You just wrote your name onto Google's servers. Every function from here that touches Tasks uses this same three-line skeleton.
TL;DR: GOOGLETASKS_INSERT_TASK needs a title, a tasklist_id, and a status — pass "@default" to aim at your primary list without any lookup.
Action.GOOGLETASKS_INSERT_TASK"@default" maps to the user's primary task list"needsAction" marks the task as still openid, title, status| Value | Meaning |
|---|---|
needsAction | open / to-do |
completed | done, tucked under the strikethrough |
Create a free account to get started. Paid plans unlock all tracks.