Apache Airflow Asana Provider

2.11.3 · active · verified Thu Apr 16

The `apache-airflow-providers-asana` package, currently at version 2.11.3, provides operators and hooks to seamlessly integrate Apache Airflow with Asana. It enables users to programmatically manage Asana tasks (create, update, delete, find) and projects within Airflow workflows. As a community-managed provider, it's independently versioned and released from core Apache Airflow, offering flexible integration with the Asana work management tool.

Common errors

Warnings

Install

Imports

Quickstart

This example DAG demonstrates how to create an Asana task using the `AsanaCreateTaskOperator`. It highlights the use of `asana_conn_id` to refer to an Airflow connection configured with an Asana Personal Access Token. Remember to replace placeholder GIDs with your actual Asana Workspace and Project GIDs.

import os
from datetime import datetime

from airflow import DAG
from airflow.providers.asana.operators.asana import AsanaCreateTaskOperator

# Configure your Asana Personal Access Token in an Airflow connection
# with Conn Id 'asana_default' and 'Personal Access Token' as Login.
# For production, consider using Airflow Secrets Backend.
# Example values for workspace_id and project_id below are placeholders.
# Replace 'your_workspace_id' and 'your_project_id' with actual Asana GIDs.

ASANA_CONN_ID = 'asana_default'
ASANA_WORKSPACE_GID = os.environ.get('ASANA_WORKSPACE_GID', 'your_workspace_id') # Asana Workspace GID
ASANA_PROJECT_GID = os.environ.get('ASANA_PROJECT_GID', 'your_project_id')   # Asana Project GID

with DAG(
    dag_id='asana_task_creation_example',
    start_date=datetime(2023, 1, 1),
    schedule_interval=None,
    catchup=False,
    tags=['asana', 'example'],
) as dag:
    create_asana_task = AsanaCreateTaskOperator(
        task_id='create_new_asana_task',
        asana_conn_id=ASANA_CONN_ID,
        name='Airflow-created Task',
        task_parameters={
            'workspace': ASANA_WORKSPACE_GID,
            'projects': [ASANA_PROJECT_GID],
            'notes': 'This task was created by an Apache Airflow DAG.',
            'due_on': '2026-04-30' # Example due date
        }
    )

view raw JSON →