> ## Documentation Index
> Fetch the complete documentation index at: https://help.nextmatter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate with Asana

> You can integrate with Asana to automatically create a task in Asana in a workspace, project, and section from a Next Matter workflow.

<Tip>
  Check out our ready-made templates available when you add a step and select **Templates > 3rd party templates**. You can use the templates to create a set of pre-configured steps. Need a specific template? Click the **Contact us** button in the top right of the page and let us know.
</Tip>

## Before you begin

To start integrating, you need the following data from Asana:

* your Personal Access Token (see [Asana documentation](https://developers.asana.com/docs/personal-access-token))

* your workspace, project, and task IDs. These can be extracted from URLs. For example, a task URL is constructed in the following way: [`https://app.asana.com/0/PROJECT_ID/TASK_ID`](https://app.asana.com/0/PROJECT_ID/TASK_ID)

* your Asana section ID. You can query for it with [this call](https://developers.asana.com/reference/getsection).

* your task name. You can use Asana search to get it.

## Dynamically assign tasks in Asana

### 1. Get assignee\_ID

1. Create a step in **Integration > Custom integration** with the following settings:

   * Method: GET

   * URL: [`https://app.asana.com/api/1.0/users/USER_EMAIL`](https://app.asana.com/api/1.0/users/USER_EMAIL)

   * Headers: Content-type: `application/json`

   * Headers: Authorization: `ASANA_PERSONAL_ACCESS_TOKEN`

   * Headers: Accept: `application/json`

2. In the **Settings**, click **+ Add a variable**.

3. Enter the following variable values:Name: `assignee_id`Value: `$.data.gid`

4. Save your changes.

### 2. Create a task in Asana from Next Matter

1. Create a step in **Integration > Custom integration** with the following settings:

   <CodeGroup>
     ```json JSON theme={null}
     {
        "data": {
           "approval_status": "pending",
           "assignee": "{2. Get Assignee Id - Integration step - assignee_id (string)}",
           "due_at": "2022-07-25T00:00:00+0000",
           "followers": ["{1. Enter Task details - Task assignee - User Selection (user email)}"],
           "name": "{1. Enter Task details - Task name - Input}",
           "html_notes": "<body>{1. Enter Task details - Task details - Input} </body>",
           "projects": ["ASANA_PROJECT_ID"],
           "start_at": "2022-07-11T00:00:00+0000",
           "workspace": "ASANA_WORKSPACE_ID"
        }
     }
     ```
   </CodeGroup>

   * **Method**: POST

   * **URL**: [`https://app.asana.com/api/1.0/tasks`](https://app.asana.com/api/1.0/tasks)

   * **Headers**: Content-type: `application/json`

   * **Headers**: Authorization: `ASANA_PERSONAL_ACCESS_TOKEN`

   * **Headers**: Accept: `application/json`

   * **Body** (an example)

2. In the **Settings**, click **+ Add a variable**.

3. Enter the following variable values:Name: `task_id`Value: `$.data.gid`

4. Save your changes.

### 3. Update the task section

This is an optional step. In case your Asana project is organized in sections, you can add a step to move the just-created task to the correct section.

1. Create a step in **Integration > Custom integration** with the following settings:

   * **Method**: GET

   * **URL**: [`https://app.asana.com/api/1.0/users/USER_EMAIL`](https://app.asana.com/api/1.0/users/USER_EMAIL)

   * **Headers**: Content-type: `application/json`

   * **Headers**: Authorization: `ASANA_PERSONAL_ACCESS_TOKEN`

   * **Headers**: Accept: `application/json`

2. In the **Settings**, click **+ Add a variable**.

3. Enter the following variable values:Name: `assignee_id`Value: `$.data.gid`

4. Save your changes.

### 4. Move a task to a specific Asana section

1. Create a step in **Integration > Custom integration** with the following settings:

   <CodeGroup>
     ```json JSON theme={null}
     { "data": { "task": "{Data reference to task_id}" } }
     ```
   </CodeGroup>

   * **Method**: POST

   * **URL**: [`https://app.asana.com/api/1.0/sections/SECTION_ID/addTask`](https://app.asana.com/api/1.0/sections/SECTION_ID/addTask)

   * **Headers**: Content-type: `application/json`

   * **Headers**: Authorization: `ASANA_PERSONAL_ACCESS_TOKEN`

   * **Headers**: Accept: `application/json`

   * **Body** (an example)

2. Save your changes.
