---
name: metabase_create_dashboard_subscription
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def metabase_create_dashboard_subscription(client: MetabaseClient, dashboard_id: int, cron_schedule: str, recipients: list[dict]) -> dict"
description: "Crea una suscripcion periodica a un dashboard de Metabase. Envia el dashboard completo por email segun el cron configurado. Endpoint: POST /api/notification."
tags: [metabase, notification, subscription, dashboard, create, 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: dashboard_id
    desc: "ID del dashboard a enviar periodicamente"
  - name: cron_schedule
    desc: "expresion cron de 5 campos (ej: '0 8 * * 1-5' = lun-vie 8am, '0 9 * * 1' = lunes 9am)"
  - name: recipients
    desc: "lista de destinatarios: usuario Metabase {'type': 'notification-recipient/user', 'user_id': N} o email externo {'type': 'notification-recipient/raw-value', 'details': {'email': 'x@y.com'}}"
output: "dict: suscripcion creada con id, active, payload_type, payload, subscriptions, handlers, created_at"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/metabase/notifications.py"
---

## Ejemplo

```python
# Suscripcion: enviar dashboard de ventas cada lunes a las 8am
sub = metabase_create_dashboard_subscription(
    client,
    dashboard_id=42,
    cron_schedule="0 8 * * 1",
    recipients=[
        {"type": "notification-recipient/user", "user_id": 5},
        {"type": "notification-recipient/raw-value", "details": {"email": "gerencia@aurgi.com"}},
    ],
)
print(sub["id"], sub["payload"]["dashboard_id"])
```

## Notas

Requiere Metabase 0.57+. Reemplaza el antiguo /api/pulse.
El dashboard se envia completo con todas sus cards renderizadas.
Para suscripciones diarias laborales usar cron "0 8 * * 1-5".
