---
name: metabase_update_notification
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def metabase_update_notification(client: MetabaseClient, notification_id: int, **fields) -> dict"
description: "Actualiza una notificacion existente de Metabase (alerta o suscripcion). Permite modificar active, handlers, subscriptions o payload. Endpoint: PUT /api/notification/:id."
tags: [metabase, notification, update, api, python, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params:
  - name: client
    desc: "instancia autenticada de MetabaseClient"
  - name: notification_id
    desc: "ID de la notificacion a modificar"
  - name: "**fields"
    desc: "campos a actualizar: active (bool), handlers (list[dict]), subscriptions (list[dict]), payload (dict)"
output: "dict: notificacion actualizada con id, active, payload_type, payload, subscriptions, handlers, updated_at"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/metabase/notifications.py"
---

## Ejemplo

```python
# Desactivar una alerta
updated = metabase_update_notification(client, 99, active=False)
print(updated["active"])  # False

# Cambiar destinatarios
updated = metabase_update_notification(
    client,
    99,
    handlers=[{
        "channel_type": "channel/email",
        "recipients": [
            {"type": "notification-recipient/user", "user_id": 2},
        ],
    }],
)

# Cambiar cron a diario a las 7am
updated = metabase_update_notification(
    client,
    99,
    subscriptions=[{
        "type": "notification-subscription/cron",
        "cron_schedule": "0 7 * * *",
    }],
)
```

## Notas

Solo se envian los campos que se pasan como kwargs.
Para reactivar una alerta previamente desactivada usar active=True.
