{ "kind": "open-flow-workflow", "version": 1, "name": "Create an Asana Task from a Webhook", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_2e0afd971a7cef7c": { "name": "Receive a task name by GET", "kind": "webhook", "bodyFields": [], "method": "GET", "options": { "responseBody": { "kind": "workflow-outputs", "output": "response", "timeoutMs": 60000 }, "responseHeaders": { "Content-Type": "text/plain; charset=utf-8" }, "responseStatusCode": 200 } }, "n_cf33841b9858885f": { "inputs": { "query": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2e0afd971a7cef7c", "output": "query" } ] } }, "name": "Read the task name", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "query" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "name" } ], "name": "Read the task name", "moduleId": "n_9855b9f8a9ad5fdf", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_934407fcbc97dc02": { "inputs": { "name": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_cf33841b9858885f", "output": "name" } ] }, "workspaceId": { "kind": "value", "value": "YOUR_ASANA_WORKSPACE_ID" }, "projectIds": { "kind": "value", "value": [ "YOUR_ASANA_PROJECT_ID" ] } }, "name": "Create the task in Asana", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "name" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The workspace gid for a task created without a project." }, "nullable": true, "handle": "workspaceId" }, { "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "An Asana project gid." }, "minItems": 1, "description": "Project gids to add the new task to." }, "nullable": true, "handle": "projectIds" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "description": "The task subtype." }, "completed": { "type": "boolean", "description": "Whether the task is completed." }, "notes": { "type": "string", "description": "The task notes." }, "due_on": { "type": [ "string", "null" ], "description": "The task due date." }, "due_at": { "type": [ "string", "null" ], "description": "The task due date-time." }, "start_on": { "type": [ "string", "null" ], "description": "The task start date." }, "start_at": { "type": [ "string", "null" ], "description": "The task start date-time." }, "created_at": { "type": "string", "description": "The task creation timestamp." }, "modified_at": { "type": "string", "description": "The task update timestamp." }, "completed_at": { "type": [ "string", "null" ], "description": "The task completion timestamp." }, "permalink_url": { "type": "string", "description": "The task permalink URL." }, "approval_status": { "type": "string", "description": "The task approval status." }, "assignee": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana user." }, "workspace": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana workspace." }, "parent": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "enum": [ "default_task", "milestone", "approval", "custom" ], "description": "The task subtype." } }, "additionalProperties": true, "description": "A compact Asana task." }, "projects": { "type": "array", "items": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "description": "Projects linked to the task." }, "memberships": { "type": "array", "items": { "type": "object", "properties": { "project": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "section": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project section." } }, "additionalProperties": true, "description": "A task membership." }, "description": "Memberships returned by Asana." }, "custom_fields": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A custom field value." }, "description": "A custom field response object." }, "description": "Custom fields returned by Asana." } }, "additionalProperties": true, "description": "An Asana task." }, "nullable": false, "handle": "task" } ], "name": "Create the task in Asana", "moduleId": "n_5b8af3f0598fe0a1", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [ { "action": "asana.create_task" } ] } ] } }, "n_dee3110f5f58a090": { "inputs": { "task": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_934407fcbc97dc02", "output": "task" } ] } }, "name": "Confirm the saved task link", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "description": "The task subtype." }, "completed": { "type": "boolean", "description": "Whether the task is completed." }, "notes": { "type": "string", "description": "The task notes." }, "due_on": { "type": [ "string", "null" ], "description": "The task due date." }, "due_at": { "type": [ "string", "null" ], "description": "The task due date-time." }, "start_on": { "type": [ "string", "null" ], "description": "The task start date." }, "start_at": { "type": [ "string", "null" ], "description": "The task start date-time." }, "created_at": { "type": "string", "description": "The task creation timestamp." }, "modified_at": { "type": "string", "description": "The task update timestamp." }, "completed_at": { "type": [ "string", "null" ], "description": "The task completion timestamp." }, "permalink_url": { "type": "string", "description": "The task permalink URL." }, "approval_status": { "type": "string", "description": "The task approval status." }, "assignee": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana user." }, "workspace": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana workspace." }, "parent": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "enum": [ "default_task", "milestone", "approval", "custom" ], "description": "The task subtype." } }, "additionalProperties": true, "description": "A compact Asana task." }, "projects": { "type": "array", "items": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "description": "Projects linked to the task." }, "memberships": { "type": "array", "items": { "type": "object", "properties": { "project": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "section": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project section." } }, "additionalProperties": true, "description": "A task membership." }, "description": "Memberships returned by Asana." }, "custom_fields": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A custom field value." }, "description": "A custom field response object." }, "description": "Custom fields returned by Asana." } }, "additionalProperties": true, "description": "An Asana task." }, "nullable": false, "handle": "task" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "description": "The task subtype." }, "completed": { "type": "boolean", "description": "Whether the task is completed." }, "notes": { "type": "string", "description": "The task notes." }, "due_on": { "type": [ "string", "null" ], "description": "The task due date." }, "due_at": { "type": [ "string", "null" ], "description": "The task due date-time." }, "start_on": { "type": [ "string", "null" ], "description": "The task start date." }, "start_at": { "type": [ "string", "null" ], "description": "The task start date-time." }, "created_at": { "type": "string", "description": "The task creation timestamp." }, "modified_at": { "type": "string", "description": "The task update timestamp." }, "completed_at": { "type": [ "string", "null" ], "description": "The task completion timestamp." }, "permalink_url": { "type": "string", "description": "The task permalink URL." }, "approval_status": { "type": "string", "description": "The task approval status." }, "assignee": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana user." }, "workspace": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana workspace." }, "parent": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "enum": [ "default_task", "milestone", "approval", "custom" ], "description": "The task subtype." } }, "additionalProperties": true, "description": "A compact Asana task." }, "projects": { "type": "array", "items": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "description": "Projects linked to the task." }, "memberships": { "type": "array", "items": { "type": "object", "properties": { "project": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "section": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project section." } }, "additionalProperties": true, "description": "A task membership." }, "description": "Memberships returned by Asana." }, "custom_fields": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A custom field value." }, "description": "A custom field response object." }, "description": "Custom fields returned by Asana." } }, "additionalProperties": true, "description": "An Asana task." }, "nullable": false, "handle": "task" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "response" } ], "name": "Confirm the saved task link", "moduleId": "n_070d63ba899b5916", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_e0e3112962ae3789": { "name": "Return the Asana task link", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "response" }, { "jsonSchema": { "type": "object", "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "description": "The task subtype." }, "completed": { "type": "boolean", "description": "Whether the task is completed." }, "notes": { "type": "string", "description": "The task notes." }, "due_on": { "type": [ "string", "null" ], "description": "The task due date." }, "due_at": { "type": [ "string", "null" ], "description": "The task due date-time." }, "start_on": { "type": [ "string", "null" ], "description": "The task start date." }, "start_at": { "type": [ "string", "null" ], "description": "The task start date-time." }, "created_at": { "type": "string", "description": "The task creation timestamp." }, "modified_at": { "type": "string", "description": "The task update timestamp." }, "completed_at": { "type": [ "string", "null" ], "description": "The task completion timestamp." }, "permalink_url": { "type": "string", "description": "The task permalink URL." }, "approval_status": { "type": "string", "description": "The task approval status." }, "assignee": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana user." }, "workspace": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana workspace." }, "parent": { "type": [ "object", "null" ], "properties": { "gid": { "type": "string", "description": "The task gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The task name." }, "resource_subtype": { "type": "string", "enum": [ "default_task", "milestone", "approval", "custom" ], "description": "The task subtype." } }, "additionalProperties": true, "description": "A compact Asana task." }, "projects": { "type": "array", "items": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "description": "Projects linked to the task." }, "memberships": { "type": "array", "items": { "type": "object", "properties": { "project": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project." }, "section": { "type": "object", "properties": { "gid": { "type": "string", "description": "The resource gid." }, "resource_type": { "type": "string", "description": "The resource type." }, "name": { "type": "string", "description": "The resource name." } }, "additionalProperties": true, "description": "A compact Asana project section." } }, "additionalProperties": true, "description": "A task membership." }, "description": "Memberships returned by Asana." }, "custom_fields": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A custom field value." }, "description": "A custom field response object." }, "description": "Custom fields returned by Asana." } }, "additionalProperties": true, "description": "An Asana task." }, "nullable": false, "handle": "task" } ], "outputMappings": { "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_dee3110f5f58a090", "output": "response" } ] }, "task": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_dee3110f5f58a090", "output": "task" } ] } } } }, "edges": [ { "source": "n_2e0afd971a7cef7c", "target": "n_cf33841b9858885f" }, { "source": "n_cf33841b9858885f", "target": "n_934407fcbc97dc02" }, { "source": "n_934407fcbc97dc02", "target": "n_dee3110f5f58a090" }, { "source": "n_dee3110f5f58a090", "target": "n_e0e3112962ae3789" } ] } }, "modules": { "n_9855b9f8a9ad5fdf": { "name": "Read the task name", "imports": [], "source": "export default function asanaTaskQuery({ query }) {\n const value = query?.parameter;\n if (typeof value !== 'string' || !value.trim()) throw new Error('Provide one nonblank parameter query value for the task name');\n return { name: value.trim() };\n}\n" }, "n_5b8af3f0598fe0a1": { "name": "Create the task in Asana", "imports": [], "source": "export default async function createAsanaTask({name,workspaceId,projectIds},context){return await context.actions.call('asana.create_task',{name,workspaceId,projectIds,includeFields:['gid','name','permalink_url']});}\n" }, "n_070d63ba899b5916": { "name": "Confirm the saved task link", "imports": [], "source": "export default function asanaTaskResponse({ task }) {\n if (!task || typeof task !== 'object' || Array.isArray(task) || typeof task.gid !== 'string' || !task.gid.trim()) throw new Error('Asana did not return a saved task ID; check the project before retrying');\n if (typeof task.permalink_url !== 'string' || !/^https:\\/\\/app\\.asana\\.com\\/\\S+$/.test(task.permalink_url)) throw new Error('Asana did not return a valid task permalink; the task may already exist');\n return { task, response: 'Created Asana Task: ' + task.permalink_url };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }