How to duplicate existing Asana projects

  • 14 January 2022
  • 1 reply
  • 29 views

Userlevel 7
Badge +10
  • Community Manager
  • 1089 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.

Happy Zapping! :zap:


1 reply

Userlevel 7
Badge +8

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

Reply