Asana Integration

Connecting Asana to Retool

Connecting to Asana

To build Retool apps with your Asana data you'll first need to create a resource for querying the Asana API. Resources sit on top of our integrations and store the authentication and metadata fields required for you to connect to a data source.

Get started by navigating to the Resources page, clicking Create new, and then selecting Asana as your resource type.

You have two options for authenticating your Asana account in Retool. You can either use oAuth2 or provide Retool with an Asana personal access token to use when querying the Asana APIs.

You can read more about what type of authentication Asana recommends for different use cases here but essentially:

  • use a personal access token if you want all API calls to Asana to be made on behalf of a single user
  • use oAuth2 if you want API calls to be made on the behalf of the user currently logged in (i.e if Rebecca is using your Retool app to add tasks to an Asana project they will show up in Asana as created by Rebecca)

Connecting with oAuth2

To connect Asana to Retool with oAuth2 simply give your resource a unique name and hit Create resource. Once the resource is created and you begin using it in your app, all users who open your app will be asked to grant Retool permission to make calls on their behalf.

If you want to test the oAuth2 integration and see what users of your application will see, you can press the "Test oAuth integration" button to authenticate your account (this will create the resource for you). Otherwise, just hit "Create resource" and start building.

After your Retool application's users have granted Retool access to call Asana APIs on their behalf, Retool will take care of validating and refreshing their tokens as well as re-requesting access if necessary.

Connecting with oAuth2 in an on-prem deployment

🚧

Only necessary for on-premise deployments

If you're using Retool cloud, see the steps described above

If you have an on-premise deployment of Retool, you'll need to register an application with Asana to get a Client ID and Client Secret and provide those to Retool.

Start by going to the Asana Developers Console and adding a new app.

Once you've given your application a descriptive name and created it, you'll be given a Client ID and Client Secret.

Copy those to the Retool resource configuration page

Finally, copy the "OAuth callback URL" field provided by Retool into the "Redirect URLs" section of the Asana Developer Console app page and press Add. The final page should look like this.

Now you can hit "Create resource" in Retool and start building with your Asana integration.

Connecting with a personal access token

To connect to Asana with a personal access token, you'll need to create a new token in the Asana Developers Console and provide it to Retool.

We recommend creating a new secret API key specifically for Retool. Using a Retool-specific key ensures that your Retool apps will not be impacted but updates to the default secret key, and that other applications or services that are using your Asana API key are not impacted if you need to turn off Retool access. Remember to give your key a clear name.

Access the Asana Developer Console at https://app.asana.com/0/developer-console

Next, provide this token to Retool by creating a new Asana resource and clicking "Continue with Personal Token"

and paste your token into the provided field. Press "Create resource" and start building!

📘

How does Retool use the personal access token?

Retool uses the personal access token you provide to authenticate requests to the Asana API. Requests are authenticated using bearer auth — meaning Retool automatically adds a Authorization: Bearer YOUR_TOKEN header to all Asana API requests made with Retool.

If you'd like to learn more about how personal access tokens work refer to Asana's personal access token documentation.

Querying Asana

You can now select your newly-created Asana resource from the Resource dropdown when creating queries in your Retool apps.

You can display the results of Asana queries as with any other query in Retool. You will have to examine the response to see which part of it you actually want to display. A good place to start looking is always in the top-level data field - {{asanaQuery.data}}.

If you're getting UNAUTHORIZED errors while building apps with this resource, it means you haven't authenticated your session with the OAuth2 flow. You can do this by pressing the Re-auth API button in the query editor and trying to run the query again.

Reading data

GET /tasks endpoint with the project specified from a dropdown.

Updating data

POST /tasks/{task_gid} endpoint. Make sure to pass in the task_gid.

Bulk updating data

Since there is no native bulk edit endpoint, you'll need to create a JS query to loop through the .recordUpdates array, trigger the edit query for each edited row with the additionalScope passed in, then trigger the get all query (getTasksForProject in this example) to render the new data in the table.

Code sample here:

const updates = taskTable.recordUpdates.forEach((each, i)=>{
  editTaskName.trigger({
    additionalScope: {"name":each.name, "gid":each.gid},
    onSuccess: function(data){
      if(i == taskTable.recordUpdates.length-1){
        getTasksForProject.trigger()
      }
    }
  }) 
})

JS query to trigger the editTaskName query, with the name and gid passed in for each row.

{{gid}} and {{name}} will both be undefined until they get passed in as additionalScope from the JS query above.

Updated 9 days ago


Asana Integration


Connecting Asana to Retool

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.