API · Campañas
Envíos recurrentes programados.
Base: https://api.pushhub.daertec.com. Todas las respuestas usan { errCode, errMsg, data, meta }. Autenticación y llaves · Catálogo de errores
GET/v1/campaigns
Campanas recurrentes (notifications:read)
Llave: sk_
Respuestas: 200
curl -X GET "https://api.pushhub.daertec.com/v1/campaigns" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"POST/v1/campaigns
Crear campana recurrente (notifications:send)
Llave: sk_
Cuerpo
| Campo | Tipo | Descripción |
|---|---|---|
appId | string | |
name* | string | |
notification* | object | |
notification.contentType | "alert" | "data_only" | "silent" | |
notification.content | object | Por idioma, ej. { es: { title, subtitle, body } } |
notification.variables | object | Reemplazan {{nombre}} en el texto |
notification.data | object | |
notification.deepLink | string | máx. 500 caracteres |
notification.badge | integer | |
notification.sound | string | default o un sonido registrado en la app (2002 si no existe) |
notification.ttlSeconds | integer | 0–2419200 |
notification.priority | "high" | "normal" | |
notification.android | object | |
notification.ios | object | |
notification.appId | string | |
notification.target* | object | |
notification.platforms | "android" | "ios"[] | |
notification.category | "transactional" | "marketing" | |
notification.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. |
notification.validateOnly | boolean | |
notification.templateId | string | Plantilla: lo enviado en la peticion tiene prioridad; exige sus variables (2001) |
notification.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). |
notification.largeIcon | object | Imagen (Android, via SDK) |
notification.actions | object[] | máx. 3 elementos |
recurrence* | object | |
recurrence.freq* | "daily" | "weekly" | "monthly" | |
recurrence.interval | integer | 1–52 |
recurrence.weekdays | "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun"[] | |
recurrence.monthDay | integer | Si el mes no lo tiene, el ultimo dia · 1–31 |
recurrence.monthWeek | object | |
recurrence.time* | string | |
recurrence.timezone | string | |
recurrence.startDate | string | |
recurrence.endDate | string | |
recurrence.count | integer | 1–1000 |
Respuestas: 201422
curl -X POST "https://api.pushhub.daertec.com/v1/campaigns" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA" \
-H "Content-Type: application/json" \
-d '{
"appId": "ID_DE_TU_APP",
"name": "Recordatorio semanal",
"notification": {
"target": {
"type": "topic",
"name": "ofertas"
},
"content": {
"es": {
"title": "Ofertas de la semana",
"body": "Mira lo nuevo"
}
},
"category": "marketing"
},
"recurrence": {
"freq": "weekly",
"weekdays": [
"mon"
],
"time": "09:00",
"timezone": "America/Santo_Domingo"
}
}'GET/v1/campaigns/{id}
Detalle: proximas 5 ocurrencias y notificaciones creadas
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200
curl -X GET "https://api.pushhub.daertec.com/v1/campaigns/ID_ID" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"PATCH/v1/campaigns/{id}
Editar nombre, notificacion o recurrencia
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200
curl -X PATCH "https://api.pushhub.daertec.com/v1/campaigns/ID_ID" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"DELETE/v1/campaigns/{id}
Cancelar
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200
curl -X DELETE "https://api.pushhub.daertec.com/v1/campaigns/ID_ID" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"POST/v1/campaigns/{id}/pause
Pausar
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200
curl -X POST "https://api.pushhub.daertec.com/v1/campaigns/ID_ID/pause" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"POST/v1/campaigns/{id}/resume
Reanudar (no envia las ocurrencias perdidas durante la pausa)
Llave: sk_
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id* | path | string |
Respuestas: 200
curl -X POST "https://api.pushhub.daertec.com/v1/campaigns/ID_ID/resume" \
-H "Authorization: Bearer sk_test_TU_LLAVE_SECRETA"