[](https://github.com/cloudcomponents/cdk-constructs)
# @cloudcomponents/cdk-codepipeline-slack
[](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build)
[](https://github.com/hupe1980/cdkdx)
[](https://www.npmjs.com/package/@cloudcomponents/cdk-codepipeline-slack)
[](https://pypi.org/project/cloudcomponents.cdk-codepipeline-slack/)
[](https://github.com/kolomied/awesome-cdk)
> Cdk component that provisions a #slack approval workflow and notification messages on codepipeline state changes


## Install
TypeScript/JavaScript:
```bash
npm install --save @cloudcomponents/cdk-codepipeline-slack
```
Python:
```bash
pip install cloudcomponents.cdk-codepipeline-slack
```
## How to use
```python
import { SlackApprovalAction, SlackNotifier } from '@cloudcomponents/cdk-codepipeline-slack';
import { Stack, StackProps } from 'aws-cdk-lib';
import { Repository } from 'aws-cdk-lib/aws-codecommit';
import { Pipeline, Artifact } from 'aws-cdk-lib/aws-codepipeline';
import { CodeCommitSourceAction } from 'aws-cdk-lib/aws-codepipeline-actions';
import { Construct } from 'constructs';
export class CodePipelineSlackApprovalStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const repository = new Repository(this, 'Repository', {
repositoryName: 'MyRepositoryName',
});
const sourceArtifact = new Artifact();
const sourceAction = new CodeCommitSourceAction({
actionName: 'CodeCommit',
repository,
output: sourceArtifact,
});
if (typeof process.env.SLACK_BOT_TOKEN === 'undefined') {
throw new Error('environment variable SLACK_BOT_TOKEN undefined');
}
const slackBotToken = process.env.SLACK_BOT_TOKEN;
if (typeof process.env.SLACK_SIGNING_SECRET === 'undefined') {
throw new Error('environment variable SLACK_SIGNING_SECRET undefined');
}
const slackSigningSecret = process.env.SLACK_SIGNING_SECRET;
if (typeof process.env.SLACK_CHANNEL_NAME === 'undefined') {
throw new Error('environment variable SLACK_CHANNEL_NAME undefined');
}
const slackChannel = process.env.SLACK_CHANNEL_NAME;
const approvalAction = new SlackApprovalAction({
actionName: 'SlackApproval',
slackBotToken,
slackSigningSecret,
slackChannel,
externalEntityLink: 'http://cloudcomponents.org',
additionalInformation: 'Would you like to promote the build to production?',
});
const pipeline = new Pipeline(this, 'MyPipeline', {
pipelineName: 'MyPipeline',
stages: [
{
stageName: 'Source',
actions: [sourceAction],
},
{
stageName: 'Approval',
actions: [approvalAction],
},
],
});
new SlackNotifier(this, 'SlackNotifier', {
pipeline,
slackBotToken,
slackSigningSecret,
slackChannel,
});
}
}
```
## Slack App Settings
Create an app that’s just for your workspace
### OAuth & Permissions
Grant the `channels::history`-Scope to the Bot in your app and Add the Bot to the configured Slack-Channel
Select Permission Scopes:

### Interactive Components
Enter the url of your api from the AWS Api Gateway and append `/slack/actions`:

## API Reference
See [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codepipeline-slack/API.md).
## Example
See more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples).
## License
[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codepipeline-slack/LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/cloudcomponents/cdk-constructs",
"name": "cloudcomponents.cdk-codepipeline-slack",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": null,
"author": "hupe1980",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/df/2a/2edb6620b1f49ccb51c9faf32a3ca2f0277766d98c94737d36fb25b87451/cloudcomponents.cdk-codepipeline-slack-2.4.0.tar.gz",
"platform": null,
"description": "[](https://github.com/cloudcomponents/cdk-constructs)\n\n# @cloudcomponents/cdk-codepipeline-slack\n\n[](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build)\n[](https://github.com/hupe1980/cdkdx)\n[](https://www.npmjs.com/package/@cloudcomponents/cdk-codepipeline-slack)\n[](https://pypi.org/project/cloudcomponents.cdk-codepipeline-slack/)\n[](https://github.com/kolomied/awesome-cdk)\n\n> Cdk component that provisions a #slack approval workflow and notification messages on codepipeline state changes\n\n\n\n\n\n## Install\n\nTypeScript/JavaScript:\n\n```bash\nnpm install --save @cloudcomponents/cdk-codepipeline-slack\n```\n\nPython:\n\n```bash\npip install cloudcomponents.cdk-codepipeline-slack\n```\n\n## How to use\n\n```python\nimport { SlackApprovalAction, SlackNotifier } from '@cloudcomponents/cdk-codepipeline-slack';\nimport { Stack, StackProps } from 'aws-cdk-lib';\nimport { Repository } from 'aws-cdk-lib/aws-codecommit';\nimport { Pipeline, Artifact } from 'aws-cdk-lib/aws-codepipeline';\nimport { CodeCommitSourceAction } from 'aws-cdk-lib/aws-codepipeline-actions';\nimport { Construct } from 'constructs';\n\nexport class CodePipelineSlackApprovalStack extends Stack {\n constructor(scope: Construct, id: string, props?: StackProps) {\n super(scope, id, props);\n\n const repository = new Repository(this, 'Repository', {\n repositoryName: 'MyRepositoryName',\n });\n\n const sourceArtifact = new Artifact();\n\n const sourceAction = new CodeCommitSourceAction({\n actionName: 'CodeCommit',\n repository,\n output: sourceArtifact,\n });\n\n if (typeof process.env.SLACK_BOT_TOKEN === 'undefined') {\n throw new Error('environment variable SLACK_BOT_TOKEN undefined');\n }\n const slackBotToken = process.env.SLACK_BOT_TOKEN;\n\n if (typeof process.env.SLACK_SIGNING_SECRET === 'undefined') {\n throw new Error('environment variable SLACK_SIGNING_SECRET undefined');\n }\n const slackSigningSecret = process.env.SLACK_SIGNING_SECRET;\n\n if (typeof process.env.SLACK_CHANNEL_NAME === 'undefined') {\n throw new Error('environment variable SLACK_CHANNEL_NAME undefined');\n }\n const slackChannel = process.env.SLACK_CHANNEL_NAME;\n\n const approvalAction = new SlackApprovalAction({\n actionName: 'SlackApproval',\n slackBotToken,\n slackSigningSecret,\n slackChannel,\n externalEntityLink: 'http://cloudcomponents.org',\n additionalInformation: 'Would you like to promote the build to production?',\n });\n\n const pipeline = new Pipeline(this, 'MyPipeline', {\n pipelineName: 'MyPipeline',\n stages: [\n {\n stageName: 'Source',\n actions: [sourceAction],\n },\n {\n stageName: 'Approval',\n actions: [approvalAction],\n },\n ],\n });\n\n new SlackNotifier(this, 'SlackNotifier', {\n pipeline,\n slackBotToken,\n slackSigningSecret,\n slackChannel,\n });\n }\n}\n```\n\n## Slack App Settings\n\nCreate an app that\u2019s just for your workspace\n\n### OAuth & Permissions\n\nGrant the `channels::history`-Scope to the Bot in your app and Add the Bot to the configured Slack-Channel\n\nSelect Permission Scopes:\n\n\n\n### Interactive Components\n\nEnter the url of your api from the AWS Api Gateway and append `/slack/actions`:\n\n\n\n## API Reference\n\nSee [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codepipeline-slack/API.md).\n\n## Example\n\nSee more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples).\n\n## License\n\n[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codepipeline-slack/LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Cdk component that provisions a #slack approval workflow and notification messages on codepipeline state changes",
"version": "2.4.0",
"project_urls": {
"Homepage": "https://github.com/cloudcomponents/cdk-constructs",
"Source": "https://github.com/cloudcomponents/cdk-constructs.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "327d5c0eeb4c58c1f347d253088b6fc8cc9544b858a17bdfe14953acb7433924",
"md5": "8bd7b4ab1f773bbf332859e217981edb",
"sha256": "a9c25d3846209fed59b5b643806664d8e5f030cf4b843a88a2f534ad53729997"
},
"downloads": -1,
"filename": "cloudcomponents.cdk_codepipeline_slack-2.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8bd7b4ab1f773bbf332859e217981edb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 1093220,
"upload_time": "2024-05-16T19:30:05",
"upload_time_iso_8601": "2024-05-16T19:30:05.557319Z",
"url": "https://files.pythonhosted.org/packages/32/7d/5c0eeb4c58c1f347d253088b6fc8cc9544b858a17bdfe14953acb7433924/cloudcomponents.cdk_codepipeline_slack-2.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "df2a2edb6620b1f49ccb51c9faf32a3ca2f0277766d98c94737d36fb25b87451",
"md5": "165910c8899373f9ccff1d81b3cbab7a",
"sha256": "73e493371090cb8bedbd5d68daae825d0cdced95417591a7d130d1186f79f878"
},
"downloads": -1,
"filename": "cloudcomponents.cdk-codepipeline-slack-2.4.0.tar.gz",
"has_sig": false,
"md5_digest": "165910c8899373f9ccff1d81b3cbab7a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 1094500,
"upload_time": "2024-05-16T19:30:09",
"upload_time_iso_8601": "2024-05-16T19:30:09.553281Z",
"url": "https://files.pythonhosted.org/packages/df/2a/2edb6620b1f49ccb51c9faf32a3ca2f0277766d98c94737d36fb25b87451/cloudcomponents.cdk-codepipeline-slack-2.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-16 19:30:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cloudcomponents",
"github_project": "cdk-constructs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cloudcomponents.cdk-codepipeline-slack"
}