Notifier attributes
field | type | description |
---|---|---|
id | string | unique ID identifying the notifier |
created_at | date | date of creation of the notifier |
updated_at | date | when was the notifier updated |
name | string | name of the notifier |
active | boolean | is the notifier active or not |
type | string | notifier type |
app_id | string | app reference |
platform_id | string | notification platform used by this notifier |
send_all_alerts | boolean | should the notifier accept all alerts |
send_all_events | boolean | should the notifier accept all events |
selected_event_ids | []string | list of events accepted by this notifier |
type_data | object | notification platform dependant additional data |
The type_data
Object depends of the platform_id which is used.
field | type | description |
---|---|---|
user_ids | []string | IDs of users (owner and collaborators) |
emails | []string | Additional email addresses |
field | type | description |
---|---|---|
webhook_url | string | URL to send the event payloads |
Example object:
{
"id": "no-824fd8bb-0efe-4b7b-9605-1b98110abeef",
"name": "My notifier",
"active": true,
"type": "slack",
"platform_id": "5982f145d48c3600273ef089",
"created_at": "2018-05-14T11:46:42.077+02:00",
"updated_at": "2019-04-10T20:51:32.298+02:00",
"send_all_alerts": false,
"send_all_events": false,
"selected_event_ids": [],
"app_id": "53e45e576461730a0c021817",
"app": "my-app",
"type_data": {
"webhook_url": "https://hooks.slack.com/services/AAAAAAAAAAA/BBBBBBBBBBB/cccccddddeeeefffff"
}
}
Notifications are app events sent to a custom HTTP endpoint. You can refer to our ‘Events’ documentation to know the notification JSON format.
Example of a deployment notification:
{
"id": "54dcdd4a73636100011a0000",
"created_at" : "2015-02-12T18:05:14.226+01:00",
"user" : {
"username" : "johndoe",
"email" : "john@doe.com",
"id" : "51e6bc626edfe40bbb000001"
},
"app_id" : "5343eccd646173000a140000",
"app_name": "appname",
"type": "deployment",
"type_data": {
"deployment_id" : "5343eccd646aa3012a140230",
"deployment_type": "deployment",
"pusher": "johndoe",
"stack": "scalingo-18",
"last_commits": {
"commits": [],
"remaining": 0
},
"git_ref" : "0123456789abcdef",
"git_ref_url": "https://github.com/johndoe/appname/commit/0123456789abcdef",
"status": "success",
"duration": 40,
"finished_at": "2020-04-16T14:55:05.338+00:00"
}
}
GET https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers
List all the provisioned notifiers for a given application.
Example
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $BEARER_TOKEN" \
-X GET https://$SCALINGO_API_URL/v1/apps/example-app/notifiers
Returns 200 OK
{
"notifiers": [
{
"id": "no-824fd8bb-0efe-4b7b-9605-1b98110abeef",
"name": "My notifier",
"active": true,
"type": "slack",
"platform_id": "5982f145d48c3600273ef089",
"created_at": "2018-05-14T11:46:42.077+02:00",
"updated_at": "2019-04-10T20:51:32.298+02:00",
"send_all_alerts": false,
"send_all_events": false,
"selected_event_ids": [],
"app_id": "53e45e576461730a0c021817",
"app": "my-app",
"type_data": {
"webhook_url": "https://hooks.slack.com/services/AAAAAAAAAAA/BBBBBBBBBBB/cccccddddeeeefffff"
}
},
{
"id": "no-253ea554-bfe3-419c-aaaa-0bfc5bf51beef",
"name": "Default 'myapp' notifier",
"active": true,
"type": "email",
"platform_id": "59c52ac27651ce002c1d4620",
"created_at": "2017-10-30T14:43:15.777+01:00",
"updated_at": "2018-11-09T14:51:56.515+01:00",
"send_all_alerts": false,
"send_all_events": false,
"selected_event_ids": [
"59c52a9c7651ce001f62f578"
],
"app_id": "59f72c73fb0de600aaa1234aaa",
"app": "myapp",
"type_data": {
"user_ids": [
"us-07c2180c-b4b4-123a-1234-fabcdbea"
],
"emails": []
}
}
]
}
POST https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers
Add a notifier to the application.
notifer.platform_id
notifer.name
notifer.send_all_alerts
(optional)notifer.send_all_events
(optional)notifer.type_data
(optional)notifer.selected_event_ids
(optional)notifer.active
(optional)notifier.selected_events
: arrays of event namescurl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $BEARER_TOKEN" \
-X POST https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers \
-d '{"notifiers":{"platform_id": "5982f145d48c3600273ef08a", "active": true, "name": "My Custom Webhook", "type_data": {"webhook_url": "https://myapp.fr/webhook/scalingo"}}}'
Returns 201 Created
GET https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers/[:notifier_id]
Example request
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $BEARER_TOKEN" \
-X GET https://$SCALINGO_API_URL/v1/apps/myapp/notifiers/no-253ea554-bfe3-419c-aaaa-0bfc5bf51beef
Returns 200 OK
{
"notifier": {
"id": "no-253ea554-bfe3-419c-aaaa-0bfc5bf51beef",
"name": "Default 'myapp' notifier",
"active": true,
"type": "email",
"platform_id": "59c52ac27651ce002c1d4620",
"created_at": "2017-10-30T14:43:15.777+01:00",
"updated_at": "2018-11-09T14:51:56.515+01:00",
"send_all_alerts": false,
"send_all_events": false,
"selected_event_ids": [
"59c52a9c7651ce001f62f578"
],
"app_id": "59f72c73fb0de600aaa1234aaa",
"app": "myapp",
"type_data": {
"user_ids": [
"us-07c2180c-b4b4-123a-1234-fabcdbea"
],
"emails": []
}
}
}
PATCH https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers/[:notifier_id]
Change notifier attributes
notifier.active
notifier.name
notifier.send_all_alerts
notifier.send_all_events
notifier.type_data
notifier.selected_event_ids
notifier.selected_events
: arrays of event namescurl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $BEARER_TOKEN" \
-X PATCH https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers/[:notifier_id] \
-d '{"notifier": {"type_data": { "webhook_url": "https://myendpoint.com" }, active: "false"}}}'
Returns 200 OK
POST https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers/[:notifier_id]/test
Send a test notification to the notifier
curl -H "Authorization: Bearer $BEARER_TOKEN" \
-X POST https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers/[:notifier_id]/test
DELETE https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers/[:notifier_id]
Request deprovisionning of the notifier.
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $BEARER_TOKEN" \
-X DELETE https://$SCALINGO_API_URL/v1/apps/[:app]/notifiers/[:notifier_id]
Returns 204 No Content