How to duplicate existing Asana projects

  • 14 January 2022
  • 9 replies
  • 1160 views
How to duplicate existing Asana projects
Userlevel 7
Badge +11
  • Community Manager
  • 4442 replies

Have you ever thought to yourself, “I wish I could use Zapier to create a new Asana project from an existing project”? As some of you may already know, there is an existing feature request for this. Which is great but not ideal if you need a way to automate the creation of new projects from existing ones right now. If that sounds like you, read on for I have a solution...

It’s webhooks to the rescue again! :tada:

I’ve figured out a way to use a Webhooks by Zapier step to make a copy of an existing project in Asana. This includes copying all its attachments, due dates, members, notes, tasks, subtasks, assignee, dependencies etc. Oh, and it also allows you to automatically shift all the due dates. Cool, right?

Things we'll need

  • Asana Access Token (PAT)
  • Project GID - ID number for the project we're duplicating

Optional:

  • Paid Asana account. To take advantage of Asana's automatic due-date shifting feature you'll need a paid Asana account.
  • Team ID. If the associated team for the duplicated project needs to be different then you'll need to locate the team ID within Asana.

Please note: Webhooks is a premium feature so you'd need to be on a paid Zapier plan to use this workaround.

Getting your Asana Personal Access Token (PAT)

Asana has a guide on how to generate a Personal Access Token - Getting a Personal Access Token (PAT)
First we head over to Asana’s Developer App Management page. Then click on + New access token:
be76cb795ebde1630cb6d1821b1cd92d.png
A pop-up window should then appear where you can enter in a name for your Personal Access Token:
f68efa44203782558e2aa226fa42df15.png
Click Create token when you’re ready. This will generate the token. Be sure to copy your Personal Access Token into a safe and secure location:
0b4bd3ef577001ea900a605f7a572e79.png

Getting the Project GID

The ID number for a project is in the URL for the project's page in Asana:

d3c8e19edc163119ad0e99b17c042fd0.png

Getting the Team ID

Like with the Project ID, the ID number for a team is in the URL for the team's page in Asana:

b9418ca50bf757582b80543f06203d48.png

Setting up the Zap

First things first, you'll want to set up the trigger app for your Zap. This can be anything you like. For the purposes of this tutorial I added a New Spreadsheet Row Google Sheets step. So anytime I add a row in the connected spreadsheet, Asana will set up a duplicate a project for me. Depending on your workflow your trigger app may well be different!

After setting up the trigger, we'll need to add a Webhooks by Zapier action. Make sure to select the Custom Request option for the Action Event:

133166a8f169e921109da588dab84119.png

On the next screen, select the POST option for the Method field.

Next, for the URL we'll want to use the following (as per Asana's API documentation on duplicating projects):

https://app.asana.com/api/1.0/projects/{project_gid}/duplicate

Be sure to replace {project_gid} with the actual Project GID we obtained earlier.

In the Data field you'll want to follow the same JSON format outlined in Asana's API documentation. To help speed things up, here's some example code you can copy and edit as necessary:
{
  "data": {
    "include": [
        "members"
        "task_notes"
        "task_assignee"
        "task_subtasks"
        "task_attachments"
        "task_dates"
        "task_dependencies"
        "task_collaborators"
        "task_tags"
        "task_projects"
    ],
    "name": "Select relevant field here",
    "schedule_dates": {
        "should_skip_weekends": true,
        "start_on": "Select relevant field here"
    },
    "team": "Select relevant field or enter team ID here"
  }
}

:bulb:Shifting the due dates: The start_on value sets a date from which the shifted due dates should start from. If you’d rather set an end date for when all tasks should be completed by, change “start_on” to “due_on” instead.

In the Headers section we'll need to add two things, Authorization and Content-Type like so:

a80570c853aa9682ac59197453ba5a49.png
Make sure to replace {Personal_Access_Token} with your own Personal Access Token (PAT). And leave a space between the word Bearer and the token itself.

In the end, you should end up with something like this:

3c4891266104096f8a6dd201dfbc9c86.png
You'll see that in the above screenshot I've selected the name and start_on values from my Google Sheets step. The Project ID and Team ID were typed in but these values could also be selected from a previous step if you need them to be set dynamically.

The schedule_dates section is used to automatically schedule in the due dates. This feature requires a paid Asana plan so if you're on Asana’s free plan you'll need to remove that section from the Data field.

Testing the Zap

When we test the Webhooks step we should see a "Test was successful" message like this:

19fb6da6283c5f28fbb1254434c11a87.png
Great! Now let's check in Asana to make sure the project was definitely added:
5bf5d38e64bb80f256b8c035d6985758.png
Yep, it looks like both the original and copied version of the project are in place now. :)

Earlier I mentioned that the due dates can be automatically shifted based on the due_on or start_on value so let's check that it worked.

Here's the due dates in the original project:

c1f3e7f9d7a59ffd5613e26b9e29a2d7.png

And here are the due dates that have been shifted automatically:

c14c76e861f9333577d8282d3a7fa625.png
Neat right?

Wrapping Up

Webhooks by Zapier is such a great way to get around feature gaps and limitations. Hopefully this is useful to you and inspires you to find other ways to use Webhooks by Zapier in your workflows.

 

If you have any trouble with this workflow, you can always ask in the Community for help! The Community is best place to help you with your Webhooks questions as the Zapier Support Team offer limited support for code and webhooks steps. 

Happy Zapping! :zap:


9 replies

Userlevel 7
Badge +9

This is amazing! Thanks for taking the time to figure this out and share with us, @SamB:slight_smile:

I’m getting the following message when testing the Zap - "Could not parse request data, invalid JSON".  I followed all steps exactly - not 100% sure as to what’s going on.

 

{

  "data": {

    "include": [

    "members"

    "task_notes"

    "task_assignee"

    "task_subtasks"

    "task_attachments"

    "task_dates"

    "task_dependencies"

    "task_collaborators"

    "task_tags"

    "task_projects"

  ],

"name": "1. First Name:Matt1. Last Name:Smith",

"schedule_dates": {

    "should_skip_weekends": true,

    "start_on": "1. Start Date:2022-02-17"

  },

  "team": "1201817218763785"

}

}

Userlevel 1

I’m getting the following message when testing the Zap - "Could not parse request data, invalid JSON".  I followed all steps exactly - not 100% sure as to what’s going on.

 

{

  "data": {

    "include": [

    "members"

    "task_notes"

    "task_assignee"

    "task_subtasks"

    "task_attachments"

    "task_dates"

    "task_dependencies"

    "task_collaborators"

    "task_tags"

    "task_projects"

  ],

"name": "1. First Name:Matt1. Last Name:Smith",

"schedule_dates": {

    "should_skip_weekends": true,

    "start_on": "1. Start Date:2022-02-17"

  },

  "team": "1201817218763785"

}

}

 

There’s an error in the code here, there need to be commas after each item inside the “include” array. It should look like this:

 

{

  "data": {

    "include": [

    "members",

    "task_notes",

    "task_assignee",

    "task_subtasks",

    "task_attachments",

    "task_dates",

    "task_dependencies",

    "task_collaborators",

    "task_tags",

    "task_projects"

  ],

"name": "1. First Name:Matt1. Last Name:Smith",

"schedule_dates": {

    "should_skip_weekends": true,

    "start_on": "1. Start Date:2022-02-17"

  },

  "team": "1201817218763785"

}

}

 

 

Note the commas after “members”, “task_notes”, etc, but NOT after the last one, “task_projects”.

I’m getting this error message when I test my zap: “For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors” I followed all the steps exactly like it was mentioned in the post, can’t figure out what I did wrong. This is the request data in my zap: 

Method: POST
URL: https://app.asana.com/api/1.0/projects/(my-project-id)/duplicate
Data Pass-Through?:
Data:
{
"data": {
"include": [
"members",
"task_notes",
"task_assignee",
"task_subtasks",
"task_attachments",
"task_dates",
"task_dependencies",
"task_collaborators",
"task_tags",
"task_projects"
],
"name": "Jonathan HR",
"schedule_dates": {
"should_skip_weekends": true,
"start_on": "Start Date: 2022-02-17"
},
"team": "1202155436720328"
}
}
Unflatten: true
Basic Auth:
Headers:
Authorization: Bearer (+my token)
Content-Type: application/json
EMPTY FIELDS:
Data Pass-Through?: empty (optional)
Basic Auth: empty (optional)

 

 

Also getting an error like this. Do you guys offer support in building this?

Userlevel 7
Badge +12

Hi @Jsilva!

I’m sorry that you’re having trouble with this workflow. The best thing to do is to start a new post in the Community letting us know where you think you’re having trouble so other members can offer their suggestions. If it’s the webhook step that you’re having trouble with, make sure to post your question in the ‘Webhooks and Code’ section of the Community so that folks with experience of that can take a look 😊

Userlevel 1
Badge +1

Hi @Andy2545, @Jsilva and @msmith89,

I was getting an error too after adding the commas.

Removing the “task_collaborators”, line fixed it for me.

In addition, I removed the “schedule_dates” section as my template does not have dates.

 

Thank you, @SamB for the post!

 

Userlevel 1

I hope someone could help me please.

I followed the instructions fully. Originally, I got the error message  "Could not parse request data, invalid JSON". but when I saw this above, I added commas and removed “task_collaborators” as recommended by some others.

Now I am getting a different error message - The app returned "No matching route for request"

 

{ "data": { "include": [ "members", "task_notes", "task_assignee", "task_subtasks", "task_attachments", "task_dates", "task_dependencies", "task_tags", "task_projects" ], "name": "1. Person ID Name:Laura Mills Onboarding", "schedule_dates": { "should_skip_weekends": true, "start_on": "Select relevant field here" }, "team": "Select relevant field or enter team ID here" } }

 

Hi, all!

Thank you all for your interest in a way to duplicate or copy a project with the Asana integration. I'm happy to let you know that a new Create Project From Template action is now available.

Can you give that a try and see if that works for your needs?

If you run into any problems or have any questions, please don't hesitate to let us know. We are here to help!

Reply