unsplash / mercury

The guide of souls to the underworld.
https://unsplash.github.io/mercury/
MIT License
3 stars 0 forks source link

Heroku webhooks #11

Closed samhh closed 1 year ago

samhh commented 1 year ago

Heroku webhooks could offer support for notifications for the following:

Otto does at least the latter.

Now, the docs... https://devcenter.heroku.com/articles/webhook-events

samhh commented 1 year ago

Here's what a webhook event looks like in case of env var change:

{
    "id": "ID_HERE",
    "data": {
        "id": "ID_HERE",
        "app": {
            "id": "ID_HERE",
            "name": "HEROKU_APP_NAME_HERE",
            "process_tier": "production"
        },
        "slug": {
            "id": "ID_HERE",
            "commit": "63e09a1fb86d246071fd53aef364e7db94497c4d",
            "commit_description": ""
        },
        "user": {
            "id": "ID_HERE",
            "email": "EMAIL_HERE"
        },
        "stack": "heroku-20",
        "status": "succeeded",
        "current": true,
        "pstable": {
            "web": {
                "slug": {
                    "id": "ID_HERE"
                },
                "command": "/path/to/bin/here"
            }
        },
        "version": 6401,
        "created_at": "2023-06-02T19:42:21Z",
        "updated_at": "2023-06-02T19:42:21Z",
        "description": "Set ENV_VAR1, ENV_VAR2 config vars",
        "addon_plan_names": [
            "ADDON_HERE"
        ],
        "output_stream_url": null
    },
    "actor": {
        "id": "ID_HERE",
        "email": "EMAIL_HERE"
    },
    "action": "create",
    "version": "application/vnd.heroku+json; version=3",
    "resource": "release",
    "sequence": null,
    "created_at": "2023-06-02T19:42:21.933129Z",
    "updated_at": "2023-06-02T19:42:21.933135Z",
    "published_at": "2023-06-02T19:42:22Z",
    "previous_data": {},
    "webhook_metadata": {
        "attempt": {
            "id": "ID_HERE"
        },
        "delivery": {
            "id": "ID_HERE"
        },
        "event": {
            "id": "ID_HERE",
            "include": "api:release"
        },
        "webhook": {
            "id": "ID_HERE"
        }
    }
}

It looks like we'd need to parse data.description.

samhh commented 1 year ago

Same with rollbacks, data.description will look like for example "Rollback to v6385".

samhh commented 1 year ago

6435ddbc5ab45610d62dd5592380af70dfd35c03...485cccd993a6a6d1c89ad199b6b5dad475ec29c8