{"id":5110,"library":"apache-airflow-providers-opsgenie","title":"Opsgenie Provider for Apache Airflow","description":"The `apache-airflow-providers-opsgenie` package integrates Apache Airflow with Opsgenie, a modern incident management platform. It allows Airflow DAGs to create, close, and manage alerts and incidents within Opsgenie, enhancing observability and response capabilities for workflows. The current version is 5.10.3, and it follows the frequent release cadence typical of Apache Airflow providers.","status":"active","version":"5.10.3","language":"en","source_language":"en","source_url":"https://github.com/apache/airflow/tree/main/airflow/providers/opsgenie","tags":["Airflow","Provider","Opsgenie","Alerting","Incident Management","DevOps"],"install":[{"cmd":"pip install apache-airflow-providers-opsgenie","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required base for all Airflow providers. Minimum version 2.11.0 is needed for provider version 5.x.x.","package":"apache-airflow","optional":false},{"reason":"Official Python SDK for interacting with the Opsgenie API, used by the provider's hooks and operators.","package":"opsgenie-sdk","optional":false}],"imports":[{"symbol":"OpsgenieCreateAlertOperator","correct":"from airflow.providers.opsgenie.operators.opsgenie import OpsgenieCreateAlertOperator"},{"symbol":"OpsgenieCloseAlertOperator","correct":"from airflow.providers.opsgenie.operators.opsgenie import OpsgenieCloseAlertOperator"},{"symbol":"OpsgenieNotifier","correct":"from airflow.providers.opsgenie.notifications.opsgenie import OpsgenieNotifier"},{"symbol":"OpsgenieAlertHook","correct":"from airflow.providers.opsgenie.hooks.opsgenie import OpsgenieAlertHook"}],"quickstart":{"code":"import os\nfrom datetime import datetime\nfrom airflow.models.dag import DAG\nfrom airflow.providers.opsgenie.operators.opsgenie import (\n    OpsgenieCreateAlertOperator,\n    OpsgenieCloseAlertOperator,\n)\n\n# Ensure 'opsgenie_default' connection is configured in Airflow UI:\n# Admin -> Connections\n# Conn Id: opsgenie_default\n# Conn Type: Opsgenie\n# Host: (Optional, defaults to https://api.opsgenie.com)\n# Password: Your Opsgenie API Key (e.g., os.environ.get('OPSGENIE_API_KEY', ''))\n\nwith DAG(\n    dag_id=\"opsgenie_alert_example_dag\",\n    schedule_interval=None,\n    start_date=datetime(2023, 1, 1),\n    catchup=False,\n    tags=[\"opsgenie\", \"alerting\"],\n) as dag:\n    create_alert = OpsgenieCreateAlertOperator(\n        task_id=\"create_opsgenie_alert\",\n        message=\"High priority alert from Airflow DAG!\",\n        recipients=[\"team_id:your_team_id\"], # Or 'email:your_email@example.com'\n        priority=\"P1\",\n        teams=[{\"name\": \"your_team_name\"}],\n        description=\"Automated alert for critical workflow failure.\",\n        tags=[\"airflow\", \"critical\", \"pipeline\"],\n        opsgenie_conn_id=\"opsgenie_default\",\n    )\n\n    # In a real scenario, this would typically be triggered by another task's success or failure\n    close_alert = OpsgenieCloseAlertOperator(\n        task_id=\"close_opsgenie_alert\",\n        identifier=\"{{ task_instance.xcom_pull(task_ids='create_opsgenie_alert')['alert_id'] }}\",\n        identifier_type=\"id\",\n        user=\"Airflow Automated System\",\n        note=\"Alert successfully resolved by downstream tasks.\",\n        opsgenie_conn_id=\"opsgenie_default\",\n    )\n\n    create_alert >> close_alert\n","lang":"python","description":"This quickstart demonstrates how to use the `OpsgenieCreateAlertOperator` to trigger an alert and `OpsgenieCloseAlertOperator` to resolve it within an Airflow DAG. It assumes an Opsgenie connection named `opsgenie_default` is configured in the Airflow UI with the Opsgenie API Key. The `alert_id` from the created alert is XCom-pulled to close the corresponding alert."},"warnings":[{"fix":"Ensure your Apache Airflow environment is upgraded to at least 2.11.0 before installing or upgrading this provider. After Airflow upgrade, run `airflow upgrade db` if prompted.","message":"The current version of `apache-airflow-providers-opsgenie` (5.x.x) requires Apache Airflow version 2.11.0 or higher. Installing on older Airflow versions (<2.11.0) will automatically upgrade Airflow, potentially causing database migration issues if not handled manually.","severity":"breaking","affected_versions":"< 5.0.0"},{"fix":"Migrate your DAGs to use `OpsgenieCreateAlertOperator` and `OpsgenieCloseAlertOperator` (or `OpsgenieDeleteAlertOperator`) and update import paths accordingly. Refer to the provider's changelog for specific operator and hook changes.","message":"The `OpsgenieAlertOperator` was removed in provider version 5.0.0. It has been replaced by `OpsgenieCreateAlertOperator` for creating alerts and `OpsgenieDeleteAlertOperator` for deleting alerts. Additionally, the `hooks.opsgenie_alert` import path was removed.","severity":"breaking","affected_versions":">= 5.0.0"},{"fix":"Review existing usages of `OpsgenieAlertHook` to adapt to the new constructor signature, method names (`create_alert`), return types, and payload key formatting (e.g., `visible_to` instead of `visibleTo`).","message":"In provider version 3.0.0, significant changes were introduced to `OpsgenieAlertHook`. The constructor no longer accepts additional arguments or keyword arguments, `get_conn` now returns an `opsgenie_sdk.AlertApi` object instead of a `requests.Session`, and the `execute` method was replaced by `create_alert`. Payload keys for fields like `visible_to` and `request_id` were also standardized to use snake_case instead of camelCase.","severity":"breaking","affected_versions":">= 3.0.0"},{"fix":"Configure an Airflow connection with 'Conn Type: Opsgenie' and set your API Key in the 'Password' field. Ensure the `conn_id` used in your operators/notifiers matches this connection ID.","message":"To authenticate with Opsgenie, you must create an Airflow connection. The Opsgenie API Key should be stored in the 'Password' field of an 'Opsgenie' type connection in the Airflow UI (Admin -> Connections). The default connection ID is `opsgenie_default`.","severity":"gotcha","affected_versions":"All"},{"fix":"If facing installation issues, try `pip install --upgrade pip==20.2.4` or `pip install apache-airflow-providers-opsgenie --use-deprecated=legacy-resolver`.","message":"For new Airflow installations, especially when `pip` version 20.3 was released, resolver issues could occur. While less common with modern `pip` versions, if you encounter installation errors, downgrading pip or using `--use-deprecated=legacy-resolver` might be necessary.","severity":"gotcha","affected_versions":"Older pip versions (e.g., pip 20.3)"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}