Workflows / Github / github_app_authorization

GitHub App Authorization Revoked Notification to Slack

Use the Github integration by MagicBell to setup a workflow when github_app_authorization triggers in Github.

Connect Github to MagicBell to receive events and trigger workflows. This guide uses the MagicBell CLI.

Add the Github integration

Save your Github webhook signing secret in MagicBell. See GitHub webhooks.

magicbell integration save_github \
  --data '{"webhook_signing_secret":"your_secret_here"}'

Copy the ID from the response and use it to build your webhook URL:

https://api.magicbell.com/v2/integrations/github/webhooks/incoming/{id}

Setup the webhook

Add a workflow

Create a workflow that triggers automatically when Github sends this event.

Workflow key

Use this key to trigger the workflow when Github sends a github_app_authorization event:

integration.github.github_app_authorization

Filter by action: GitHub sends the event type in the header and the action in the payload body. Use an if condition to filter for the revoked action:

"if": "payload.action == 'revoked'"

Example workflow

Track when users revoke GitHub App authorization.

{
  "key": "integration.github.github_app_authorization.revoked",
  "steps": [
    {
      "command": "broadcast",
      "input": {
        "action_url": "{{payload.sender.html_url}}",
        "content": "{{payload.sender.login}} revoked authorization for your GitHub App.",
        "overrides": {
          "providers": {
            "slack": {}
          }
        },
        "recipients": [
          {
            "external_id": "app-admins"
          }
        ],
        "title": "App authorization revoked"
      }
    }
  ]
}

Save with the CLI

Use the MagicBell CLI to save this workflow to your project. You can also use the Workflows API endpoint instead.

magicbell workflow save \
  --data '{"key":"integration.github.github_app_authorization.revoked","steps":[{"command":"broadcast","input":{"action_url":"{{payload.sender.html_url}}","content":"{{payload.sender.login}} revoked authorization for your GitHub App.","overrides":{"providers":{"slack":{}}},"recipients":[{"external_id":"app-admins"}],"title":"App authorization revoked"}}]}'

Event payload

Sample payload for the github_app_authorization event. Use liquid templates to access fields in your workflow.

{
  "action": "revoked",
  "sender": {
    "avatar_url": "https://avatars.githubusercontent.com/u/234567?v=4",
    "events_url": "https://api.github.com/users/john-dev/events{/privacy}",
    "followers_url": "https://api.github.com/users/john-dev/followers",
    "following_url": "https://api.github.com/users/john-dev/following{/other_user}",
    "gists_url": "https://api.github.com/users/john-dev/gists{/gist_id}",
    "gravatar_id": "",
    "html_url": "https://github.com/john-dev",
    "id": 234567,
    "login": "john-dev",
    "node_id": "MDQ6VXNlcjIzNDU2Nw==",
    "organizations_url": "https://api.github.com/users/john-dev/orgs",
    "received_events_url": "https://api.github.com/users/john-dev/received_events",
    "repos_url": "https://api.github.com/users/john-dev/repos",
    "site_admin": false,
    "starred_url": "https://api.github.com/users/john-dev/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/john-dev/subscriptions",
    "type": "User",
    "url": "https://api.github.com/users/john-dev"
  }
}
View all Github workflows →