Possible to script a "send this record to Asana"?

Would love to know if it is possible to use the Script Block for something like this - basically, send a record to an Asana Board and create a ticket with certain fields.

Is that possible?

Hi Hal,

You can send a new record (or new record in view) to Asana using Zapier (Airtable zapier triggers here). However, note that this will not sync the airtable record in Asana (e.g. changes to the record will not be reflected in Asana or vice-versa).

I’m not very familiar with Asana but if they have an API you could periodically sync between Airtable and Asana using something like Parabola or scripting block (this would be manually triggered).

Best
Aron

Want to learn Airtable? Join me for a webinar at airtable.com/webinar

Hi @Hal_Atkins - yes you can use the scripting block to create records in Asana using their API. Here’s a basic skeleton script:

let url = 'https://app.asana.com/api/1.0/tasks';

let headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
};

let myData = {
  "data": {
    "name": "Test task",
    "projects": [
      "YOUR_PROJECT_ID"
    ]
  }    
}

let apiResponse = await fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(myData),
})
let data = await apiResponse.json();
console.log(data);

You’ll notice that there’s no interaction with your base in this script, so that’s obviously something you’ll need to do, i.e. define a table, query a table, iterate through the records and so on. This script was just to prove you could do a POST request from the scripting block to Asana and create the task. There’s a lot more to the Asana API too - assignees, due dates, parent tasks etc, so all of this could be added in as needed to the data object.


If this answers your question, please consider marking it as the "solution". If not, please post again for more help. Thanks!
3 Likes

Thanks @JonathanBowen - really appreciate the sample code as well!

1 Like

Also, if Asana accepts Webhooks, you can create a URL to send data to Asana about your current record.

Asana supports both inbound and outbound webhooks, so it is possible, but it’s not as simple as it might seem as this thread indicates. Inbound webhooks are equally complex to REST calls.

Ah, good to know. Some apps use a webhook that is just a simple URL.

You can also use Integromat to communicate between Airtable and Asana.

It’s not really app-dependent; more aligned with the use case and the direction of the hook, inbound or outbound.

Imagine a desperately-needed outbound webhook from Airtable that serves no other purpose that to alert an external process that a record has changed and the field(s) that we modified. A simple GET will do it. Whereas, an inbound hook that supports a complex payload including the possibility of a base64 image will require a far different design.

And while I’m a fan of glue-factory solutions like Integromat for quick and satisfying PoCs, many companies get nervous when their data has to cross multiple continents and countries where privacy laws are lax. Personally, the privacy issue doesn’t typically concern me; it’s more the issue of multiple hops to achieve one task which leads to deeper abstract integration designs and more points of failure.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.