API · Notificaciones
Crear, consultar, cancelar y probar envíos; plantillas.
Base: https://api.pushhub.daertec.com. Todas las respuestas usan { errCode, errMsg, data, meta }. Autenticación y llaves · Catálogo de errores
GET/v1/notifications
Listado de envios (notifications:read)
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
appId | query | string | |
status | query | string | |
source | query | "api" | "panel" | "campaign" | "recurring" | |
page | query | integer | |
perPage | query | integer |
Respuestas: 200
curl -X GET "https://api.pushhub.daertec.com/v1/notifications" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"POST/v1/notifications
Crear un envio (sk_ con notifications:send). Se encola y responde 202.
Llave: sk_
Destinos: devices {ids|tokens}, external_users {ids}, topic {name}, all, test_devices. Con una llave en modo test
el envio solo alcanza a los dispositivos de prueba. segment/filters, media y schedule distinto de now llegan en la Fase 4.
validateOnly=true valida y estima sin crear. Errores: 2001/2002 validacion, 2003 payload > 4 KB, 2004 plataforma,
2011 programacion, 4005 Idempotency-Key reutilizada con otro cuerpo. 2002 con errors.content = [blocked]: el
contenido enlaza a un dominio o URL bloqueados por la plataforma.
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
Idempotency-Key | header | string | Repetir la misma clave (24 h) devuelve la notificacion original sin duplicar |
Cuerpo
| Campo | Tipo | Descripción |
|---|---|---|
contentType | "alert" | "data_only" | "silent" | |
content | object | Por idioma, ej. { es: { title, subtitle, body } } |
variables | object | Reemplazan {{nombre}} en el texto |
data | object | |
deepLink | string | máx. 500 caracteres |
badge | integer | |
sound | string | default o un sonido registrado en la app (2002 si no existe) |
ttlSeconds | integer | 0–2419200 |
priority | "high" | "normal" | |
android | object | |
android.channelId | string | |
android.collapseKey | string | |
android.color | string | |
android.tag | string | |
android.icon | string | |
ios | object | |
ios.interruptionLevel | "passive" | "active" | "time-sensitive" | "critical" | |
ios.threadId | string | |
ios.collapseId | string | |
ios.relevanceScore | number | |
ios.mutableContent | boolean | |
appId | string | |
target* | object | |
target.type* | "devices" | "external_users" | "topic" | "segment" | "filters" | "all" | "test_devices" | |
target.segmentId | string | |
target.rules | object | Arbol AND/OR (maximo 3 niveles, 20 condiciones). Campos: platform, language, country, timezone, external_user_id, app_version, last_seen, tag (con key), topic, notifications_enabled, capability. |
target.ids | string[] | |
target.tokens | string[] | |
target.name | string | |
platforms | "android" | "ios"[] | |
category | "transactional" | "marketing" | |
schedule | object | now; at {sendAt, timezone}: hora fija (sin offset = en timezone; por defecto la de la empresa); local_time {date, time}: esa hora en la zona de cada dispositivo (~26 h). Maximo 365 dias. Errores 2011 / 2012. |
schedule.type | "now" | "at" | "local_time" | |
schedule.sendAt | string | |
schedule.timezone | string | |
schedule.date | string | |
schedule.time | string | |
schedule.windowMinutes | integer | Envio gradual · 0–1440 |
schedule.expireAt | string | No enviar despues (tambien limita el TTL) |
validateOnly | boolean | |
templateId | string | Plantilla: lo enviado en la peticion tiene prioridad; exige sus variables (2001) |
media | object | Solo la URL viaja en el payload. Android: imagen grande (o poster de GIF/video); iOS: mutable-content + _ph.media para la extension. Un archivo en proceso solo se acepta en programadas (4009 si es inmediata). |
media.type | "image" | "gif" | "audio" | "video" | |
media.mediaId | string | |
media.url | string | https externa (requiere type) |
media.fallback | "poster" | "none" | |
largeIcon | object | Imagen (Android, via SDK) |
largeIcon.mediaId | string | |
largeIcon.url | string | |
actions | object[] | máx. 3 elementos |
Respuestas: 200202422
curl -X POST "https://api.pushhub.daertec.com/v1/notifications" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA" \
-H "Idempotency-Key: pedido-123" \
-H "Content-Type: application/json" \
-d '{
"appId": "ID_DE_TU_APP",
"target": {
"type": "external_users",
"ids": [
"cliente-123"
]
},
"content": {
"es": {
"title": "Tu pedido va en camino",
"body": "Llega hoy entre 2 y 4 p. m."
},
"en": {
"title": "Your order is on its way",
"body": "Arriving today between 2 and 4 p.m."
}
},
"data": {
"orderId": "A-1029"
},
"deepLink": "miapp://pedidos/A-1029",
"category": "transactional"
}'POST/v1/notifications/test
Consola de pruebas sincrona (hasta 10 destinos; no consume cuota; limite diario 3006)
Llave: sk_
Devuelve por destino result, interpretation y suggestion en espanol, provider_response (estado HTTP, codigo, cuerpo, latencia) y el request sin el token completo. mode validate_only solo para FCM.
Cuerpo
| Campo | Tipo | Descripción |
|---|---|---|
contentType | "alert" | "data_only" | "silent" | |
content | object | Por idioma, ej. { es: { title, subtitle, body } } |
variables | object | Reemplazan {{nombre}} en el texto |
data | object | |
deepLink | string | máx. 500 caracteres |
badge | integer | |
sound | string | |
ttlSeconds | integer | 0–2419200 |
priority | "high" | "normal" | |
android | object | |
android.channelId | string | |
android.collapseKey | string | |
android.color | string | |
android.tag | string | |
android.icon | string | |
ios | object | |
ios.interruptionLevel | "passive" | "active" | "time-sensitive" | "critical" | |
ios.threadId | string | |
ios.collapseId | string | |
ios.relevanceScore | number | |
ios.mutableContent | boolean | |
appId | string | |
useTestDevices | boolean | |
targets | object[] | máx. 10 elementos |
mode | "send" | "validate_only" | |
environment | "auto" | "sandbox" | "production" | |
rawPayload | object | Payload final escrito a mano que reemplaza al generado: fcm = mensaje FCM v1 (sin token), apns = cuerpo APNs (debe incluir aps). PushHub pone el token y las cabeceras de APNs. Maximo 4 KB; error 2002 si no es valido. |
rawPayload.fcm | object | |
rawPayload.apns | object |
Respuestas: 200429
curl -X POST "https://api.pushhub.daertec.com/v1/notifications/test" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA" \
-H "Content-Type: application/json" \
-d '{
"appId": "ID_DE_TU_APP",
"targets": [
{
"token": "TOKEN_DEL_DISPOSITIVO"
}
],
"content": {
"es": {
"title": "Prueba",
"body": "Hola desde la consola de pruebas"
}
},
"mode": "send"
}'GET/v1/notifications/{id}
Estado y contadores de un envio
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200404
curl -X GET "https://api.pushhub.daertec.com/v1/notifications/ID_ID" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"PATCH/v1/notifications/{id}
Editar una programada: cuerpo completo, o solo {schedule} para reprogramar (4009 si ya salio)
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200
curl -X PATCH "https://api.pushhub.daertec.com/v1/notifications/ID_ID" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"GET/v1/notifications/{id}/deliveries
Entregas por dispositivo
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string | |
status | query | "queued" | "accepted" | "failed" | "invalid_token" | "expired" | "skipped" | |
page | query | integer | |
perPage | query | integer |
Respuestas: 200
curl -X GET "https://api.pushhub.daertec.com/v1/notifications/ID_ID/deliveries" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"POST/v1/notifications/{id}/cancel
Cancelar (solo si aun esta en cola; si no, 4004)
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200409
curl -X POST "https://api.pushhub.daertec.com/v1/notifications/ID_ID/cancel" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"POST/v1/notifications/{id}/send-now
Enviar ya una programada (4009 si no esta programada)
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200
curl -X POST "https://api.pushhub.daertec.com/v1/notifications/ID_ID/send-now" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"GET/v1/templates
Plantillas de la app (enviar con templateId + variables; notifications:read)
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
appId | query | string |
Respuestas: 200
curl -X GET "https://api.pushhub.daertec.com/v1/templates" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"