2017-12-16 13:29:19 +01:00
---
id: notifications
2018-03-05 07:13:01 +01:00
title: "Notificaciones"
2017-12-16 13:29:19 +01:00
---
2018-03-05 07:13:01 +01:00
Las notificaciones fueron introducidas con la idea de usar webhooks para Slack, pero también se puede enviar un *payload* a cualquier endpoint. Actualmente solo activo para los comandos `publish` / `create` .
2017-12-16 13:29:19 +01:00
2018-03-05 07:13:01 +01:00
## Uso
2017-12-16 13:29:19 +01:00
2018-03-05 07:13:01 +01:00
Un ejemplo con ** hipchat**:
2017-12-16 13:29:19 +01:00
2018-03-05 07:13:01 +01:00
#### Notificación sencilla
2017-12-16 13:29:19 +01:00
```yaml
notify:
method: POST
headers: [{'Content-Type': 'application/json'}]
endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
content: '{"color":"green","message":"New package published: * {{ name }}* ","notify":true,"message_format":"text"}'
```
2018-03-05 07:13:01 +01:00
#### Múltiples notificaciones
2017-12-16 13:29:19 +01:00
```yaml
notify:
'example-package-1'
method: POST
headers: [{'Content-Type': 'application/json'}]
endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
content: '{"color":"green","message":"New package published: * {{ name }}* ","notify":true,"message_format":"text"}'
'example-package-2'
method: POST
headers: [{'Content-Type': 'application/json'}]
endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
content: '{"color":"green","message":"New package published: * {{ name }}* ","notify":true,"message_format":"text"}'
'example-package-3'
method: POST
headers: [{'Content-Type': 'application/json'}]
endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
content: '{"color":"green","message":"New package published: * {{ name }}* ","notify":true,"message_format":"text"}'
```
2018-03-05 07:13:01 +01:00
## Configuración
2017-12-16 13:29:19 +01:00
2018-03-05 07:13:01 +01:00
| Propiedad | Tipo | Requerido | Soporte | Por Defecto | Descripción |
| ------------------- | ------------ | --------- | ------- | ----------- | -------------------------------------------------------------------------------------------- |
| method | string | No | all | | HTTP verb |
| packagePattern | string | No | all | | Solo ejecutar esta notificación si el nombre del paquete coincide con la expresión regular |
| packagePatternFlags | string | No | all | | Any flags to be used with the regular expression |
| headers | array/object | Yes | all | | If this endpoint requires specific headers, set them here as an array of key: value objects. |
| endpoint | string | Yes | all | | set the URL endpoint for this call |
| content | string | Yes | all | | any Handlebar expressions |