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!
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:
A pop-up window should then appear where you can enter in a name for your Personal Access Token:
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:
Getting the Project GID
The ID number for a project is in the URL for the project's page in Asana:
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:
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:
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"
}
}
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:
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:
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:
Great! Now let's check in Asana to make sure the project was definitely added:
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:
And here are the due dates that have been shifted automatically:
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!