{"id":16978606,"url":"https://github.com/willdady/cdk-eventbridge-slack","last_synced_at":"2026-05-10T03:04:45.558Z","repository":{"id":173856494,"uuid":"651391521","full_name":"willdady/cdk-eventbridge-slack","owner":"willdady","description":"CDK app for forwarding events from AWS EventBridge to Slack","archived":false,"fork":false,"pushed_at":"2023-06-09T07:16:52.000Z","size":114,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T22:42:18.362Z","etag":null,"topics":["aws","cdk","serverless","slack","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willdady.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-09T06:22:20.000Z","updated_at":"2023-07-03T04:40:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"9fa56893-4ae5-4840-ada7-d439e81b164c","html_url":"https://github.com/willdady/cdk-eventbridge-slack","commit_stats":null,"previous_names":["willdady/cdk-eventbridge-slack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willdady/cdk-eventbridge-slack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Fcdk-eventbridge-slack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Fcdk-eventbridge-slack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Fcdk-eventbridge-slack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Fcdk-eventbridge-slack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willdady","download_url":"https://codeload.github.com/willdady/cdk-eventbridge-slack/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willdady%2Fcdk-eventbridge-slack/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264868456,"owners_count":23676091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cdk","serverless","slack","typescript"],"created_at":"2024-10-14T01:43:48.370Z","updated_at":"2026-05-10T03:04:40.498Z","avatar_url":"https://github.com/willdady.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CDK EventBridge Slack\n\nA simple CDK app which creates an AWS EventBridge bus and API destination for sending messages to Slack.\n\nThe motivation behind this project is to be a simple, generic solution for sending messages to Slack from AWS.\nApplications within AWS can simply send messages to the custom event bus with a payload targeting a specific Slack channel.\n\n## Install\n\nThis project requires Node v18+.\n\n```\nnpm install\n```\n\n## Setup\n\nThis typically needs to be done **once** per Slack workspace.\n\n### 1. Create an app in Slack\n\nFirst [create an app](https://api.slack.com/apps?new_app=1) in Slack.\n\nThe app must be configured with a Bot user with the `chat:write` scope.\nThis can be found under the **OAuth \u0026 Permissions** menu in your app's settings.\n\n![Scopes UI](/images/slack-scopes.png)\n\n### 2. Store bot token in AWS Secrets Manager\n\nFrom the **OAuth \u0026 Permissions** page in your app's settings copy the **Bot User OAuth Token**.\nThe value must then be stored as plain text in AWS Secrets Manager prefixed with the word `Bearer ` e.g.\n\n```\nBearer xoxb-9999999999999-4687200055635-HX6YDjXm0hz2YL3EsCDaIYDK\n```\n\nThe `arn` of this secret must be supplied as the `botOauthTokenSecretArn` property passed to the `SlackStack` constructor.\n\n## Configuration\n\nSimply instantiate and configure your `SlackStack` in `bin/cdk-eventbridge-slack.ts`.\n\n```typescript\nnew SlackStack(app, \"SlackStack\", {\n  workspaceName: \"My Workspace\",\n  botOauthTokenSecretArn:\n    \"arn:aws:secretsmanager:ap-southeast-2:999999999999:secret:slack-bot-token-QmBx39\",\n  organisationId: 'o-abcde12345' // optional\n});\n```\n\nNote `workspaceName` is used to derive the name of the event bus. \nThe workspace name is converted to kebab-case with '-slack' appended.\nFor example, the above stack instance will create an event bus named `my-workspace-slack`.\n\nTo allow publishing to the event bus cross-account within the same AWS Organisation, set `organisationId`.\nThis field is otherwise optional.\nFor more information see [Sending and receiving Amazon EventBridge events between AWS accounts](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-cross-account.html).\n\n### Enabling channels (IMPORTANT!)\n\nIn order to post messages Slack app must be added to the receiving Slack channel.\nThis can be achieved by typing `/add` in the respective channel.\n\n![Dialog for adding app to channel](images/add-app-to-channel.png)\n\n## Deployment\n\n```\nnpm run cdk -- deploy SlackStack\n```\n\n## Usage\n\nEvents sent to the EventBus created by `SlackStack` MUST contain a `message` object inside the `Detail` field.\nThe contents of the `message` object must be compatible with Slack's [postMessage API](https://api.slack.com/methods/chat.postMessage).\nAt a minimum this requires specifing a channel id in the `channel` field.\nA channel's id can be found in Slack by right-clicking on a channel and selecting **View channel details**.\nYou will find the channel's id at the bottom of channel details dialog box.\n\nThe event MUST also have `DetailType` set to `slack-message` in order for the event to match the EventBridge rule created by `SlackStack`.\n\n```json\n{\n  \"message\": {\n      \"channel\": \"C04KSNT9ABC\",\n      \"text\": \"Hello world!\"\n  }\n}\n```\n\n### Sending event via AWS CLI\n\n```json\n[\n  {\n    \"EventBusName\": \"cdk-eventbridge-slack\",\n    \"DetailType\": \"slack-message\",\n    \"Detail\": \"{\\\"message\\\":{\\\"channel\\\":\\\"C04KSNT9ABC\\\",\\\"text\\\":\\\"Hello world!\\\"}}\"\n  }\n]\n```\n\n```bash\naws events put-events --entries file://events.json\n```\n\n## Known issues\n\nIf you need to update the Slack token, it's best to redeploy your `SlackStack` instances.\nEventBridge will copy the token value from the secret you provide to [a secret it creates itself](https://docs.aws.amazon.com/secretsmanager/latest/userguide/integrating_how-services-use-secrets_events.html).\nUpdating the token secret and redeploying `SlackStack` does not cause the EventBridge secret to be updated.\n\n## References\nhttps://serverlessland.com/patterns/eventbridge-api-destinations-slack","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldady%2Fcdk-eventbridge-slack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilldady%2Fcdk-eventbridge-slack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilldady%2Fcdk-eventbridge-slack/lists"}