Github Package Published Notification to Slack & Email
Use the Github integration by MagicBell to setup a workflow when package 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
- Setup a webhook in Github with the URL from the last step.
- Select the package event.
- If you already have a webhook configured, make sure it includes this event.
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 package event:
integration.github.packageFilter 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 published action:
"if": "payload.action == 'published'"Example workflow
Announce new package versions to the team.
{
"key": "integration.github.package.published",
"steps": [
{
"command": "broadcast",
"input": {
"action_url": "{{payload.package.html_url}}",
"content": "{{payload.sender.login}} published {{payload.package.name}} version {{payload.package.package_version.version}}. {{payload.package.package_version.summary}}",
"overrides": {
"providers": {
"slack": {}
}
},
"recipients": [
{
"external_id": "engineering-team"
}
],
"title": "Package {{payload.package.name}} v{{payload.package.package_version.version}} published"
}
}
]
}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.package.published","steps":[{"command":"broadcast","input":{"action_url":"{{payload.package.html_url}}","content":"{{payload.sender.login}} published {{payload.package.name}} version {{payload.package.package_version.version}}. {{payload.package.package_version.summary}}","overrides":{"providers":{"slack":{}}},"recipients":[{"external_id":"engineering-team"}],"title":"Package {{payload.package.name}} v{{payload.package.package_version.version}} published"}}]}'Event payload
Sample payload for the package event. Use liquid templates to access fields in your workflow.
{
"action": "published",
"organization": {
"avatar_url": "https://avatars.githubusercontent.com/u/111111",
"description": "Building great software",
"id": 111111,
"login": "acme"
},
"package": {
"created_at": "2025-01-16T18:00:00Z",
"description": "A useful package",
"ecosystem": "npm",
"html_url": "https://github.com/acme/project/packages/123456",
"id": 123456,
"name": "my-package",
"namespace": "acme",
"owner": {
"id": 111111,
"login": "acme",
"type": "Organization"
},
"package_type": "npm",
"package_version": {
"html_url": "https://github.com/acme/project/packages/123456/versions/789012",
"id": 789012,
"name": "1.2.3",
"summary": "Bug fixes and performance improvements",
"target_commitish": "main",
"target_oid": "abc123def456789012345678901234567890abcd",
"version": "1.2.3"
},
"updated_at": "2025-01-16T18:00:00Z"
},
"repository": {
"default_branch": "main",
"full_name": "acme/project",
"html_url": "https://github.com/acme/project",
"id": 987654321,
"name": "project",
"node_id": "MDEwOlJlcG9zaXRvcnk5ODc2NTQzMjE=",
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/111111",
"html_url": "https://github.com/acme",
"id": 111111,
"login": "acme",
"type": "Organization"
},
"private": false,
"visibility": "public"
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/u/234567",
"html_url": "https://github.com/john-dev",
"id": 234567,
"login": "john-dev",
"node_id": "MDQ6VXNlcjIzNDU2Nw==",
"type": "User"
}
}