← Asana

Create Subtask with Asana API

Pipedream makes it easy to connect APIs for Asana and 800+ other apps remarkably fast.

Trigger workflow on
HTTP requests, schedules and app events
Next, do this
Create Subtask with the Asana API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

Create a workflow to Create Subtask with the Asana API. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Configure the Create Subtask action
    1. Connect your Asana account
    2. Optional- Select a Workspace
    3. Optional- Select a Project
    4. Select a Task GID
    5. Configure Name
    6. Optional- Select a Assignee
    7. Optional- Select a Assignee Section
    8. Optional- Configure Completed
    9. Optional- Configure Due At
    10. Optional- Configure Due On
    11. Optional- Select one or more Followers
    12. Optional- Configure HTML Notes
    13. Optional- Configure Notes
    14. Optional- Configure Start On
    15. Optional- Select one or more Tags
  2. Select a trigger to run your workflow on HTTP requests, schedules or app events
  3. Deploy the workflow
  4. Send a test event to validate your setup
  5. Turn on the trigger

Details

This is a pre-built, open source component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Create Subtask on Asana
Description:Creates a new subtask and adds it to the parent task. [See the docs here](https://developers.asana.com/docs/create-a-subtask)
Version:0.3.0
Key:asana-create-subtask

Code

import asana from "../../asana.app.mjs";
import common from "../common/common.mjs";

export default {
  key: "asana-create-subtask",
  name: "Create Subtask",
  description: "Creates a new subtask and adds it to the parent task. [See the docs here](https://developers.asana.com/docs/create-a-subtask)",
  version: "0.3.0",
  type: "action",
  props: {
    ...common.props,
    task_gid: {
      label: "Task GID",
      description: "The task GID to operate on.",
      type: "string",
      propDefinition: [
        asana,
        "tasks",
        (c) => ({
          project: c.project,
        }),
      ],
    },
    name: {
      label: "Name",
      description: "Name of the subtask. This is generally a short sentence fragment that fits on a line in the UI for maximum readability. However, it can be longer.",
      type: "string",
    },
    assignee: {
      label: "Assignee",
      description: "Gid of a user.",
      type: "string",
      optional: true,
      propDefinition: [
        asana,
        "users",
      ],
    },
    assignee_section: {
      label: "Assignee Section",
      description: "The assignee section is a subdivision of a project that groups tasks together in the assignee's \"My Tasks\" list.",
      type: "string",
      optional: true,
      propDefinition: [
        asana,
        "sections",
        (c) => ({
          project: c.project,
        }),
      ],
    },
    completed: {
      label: "Completed",
      description: "True if the task is currently marked complete, false if not.",
      type: "boolean",
      optional: true,
    },
    due_at: {
      label: "Due At",
      description: "The UTC date and time on which this task is due, or null if the task has no due time. This takes an ISO 8601 date string in UTC and should not be used together with due_on.",
      type: "string",
      optional: true,
    },
    due_on: {
      label: "Due On",
      description: "The localized date on which this task is due, or null if the task has no due date. This takes a date with YYYY-MM-DD format and should not be used together with due_at.",
      type: "string",
      optional: true,
    },
    followers: {
      label: "Followers",
      description: "An array of strings identifying users. These can either be the string \"me\", an email, or the gid of a user.",
      type: "string[]",
      optional: true,
      propDefinition: [
        asana,
        "users",
      ],
    },
    html_notes: {
      label: "HTML Notes",
      description: "The notes of the text with formatting as HTML.",
      type: "string",
      optional: true,
    },
    notes: {
      label: "Notes",
      description: "Free-form textual information associated with the task (i.e. its description).",
      type: "string",
      optional: true,
    },
    start_on: {
      label: "Start On",
      description: "The day on which work begins for the task , or null if the task has no start date. This takes a date with YYYY-MM-DD format.",
      type: "string",
      optional: true,
    },
    tags: {
      propDefinition: [
        asana,
        "tags",
      ],
      optional: true,
    },
  },
  async run({ $ }) {
    const response = await this.asana._makeRequest(`tasks/${this.task_gid}/subtasks`, {
      method: "post",
      data: {
        data: {
          name: this.name,
          assignee: this.assignee,
          assignee_section: this.assignee_section,
          completed: this.completed,
          due_at: this.due_at,
          due_on: this.due_on,
          followers: this.followers,
          html_notes: this.html_notes,
          notes: this.notes,
          projects: this.project,
          start_on: this.start_on,
          tags: this.tags,
          workspace: this.workspace,
        },
      },
    }, $);

    $.export("$summary", "Successfully created subtask");

    return response;
  },
};

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
AsanaasanaappThis component uses the Asana app.
WorkspaceworkspacestringSelect a value from the drop down menu.
ProjectprojectstringSelect a value from the drop down menu.
Task GIDtask_gidstringSelect a value from the drop down menu.
Namenamestring

Name of the subtask. This is generally a short sentence fragment that fits on a line in the UI for maximum readability. However, it can be longer.

AssigneeassigneestringSelect a value from the drop down menu.
Assignee Sectionassignee_sectionstringSelect a value from the drop down menu.
Completedcompletedboolean

True if the task is currently marked complete, false if not.

Due Atdue_atstring

The UTC date and time on which this task is due, or null if the task has no due time. This takes an ISO 8601 date string in UTC and should not be used together with due_on.

Due Ondue_onstring

The localized date on which this task is due, or null if the task has no due date. This takes a date with YYYY-MM-DD format and should not be used together with due_at.

Followersfollowersstring[]Select a value from the drop down menu.
HTML Noteshtml_notesstring

The notes of the text with formatting as HTML.

Notesnotesstring

Free-form textual information associated with the task (i.e. its description).

Start Onstart_onstring

The day on which work begins for the task , or null if the task has no start date. This takes a date with YYYY-MM-DD format.

Tagstagsstring[]Select a value from the drop down menu.

Authentication

Asana uses OAuth authentication. When you connect your Asana account, Pipedream will open a popup window where you can sign into Asana and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Asana API.

Pipedream requests the following authorization scopes when you connect your account:

About Asana

Manage your team's work, projects, & tasks online