From f3cff2d92e8f495953c9a328bc7d57fdc8dfec85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fitcan=20U=C3=87UM?= Date: Sun, 25 Dec 2022 21:13:57 +0300 Subject: [PATCH] feat: expose event listener lambda alias, add missing event parsing tests, refactor documentation --- .projenrc.ts | 2 + API.md | 11 + LICENSE | 226 ++---------------- README.md | 74 +++++- ...AWSCDK-Slack-Event-Bus-Architecture.drawio | 1 + docs/AWSCDK-Slack-Event-Bus-Architecture.png | Bin 0 -> 25434 bytes package-lock.json | 2 +- package.json | 2 +- src/index.ts | 32 ++- .../internal/slack/slack-parse-event.test.ts | 58 +++++ 10 files changed, 189 insertions(+), 219 deletions(-) create mode 100644 docs/AWSCDK-Slack-Event-Bus-Architecture.drawio create mode 100644 docs/AWSCDK-Slack-Event-Bus-Architecture.png create mode 100644 test/unit/internal/slack/slack-parse-event.test.ts diff --git a/.projenrc.ts b/.projenrc.ts index 85e948d..7b832f5 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -22,6 +22,8 @@ const project = new awscdk.AwsCdkConstructLibrary({ "events-api", ], + license: "Unlicense", + cdkVersion: MIN_CDK_VERSION, defaultReleaseBranch: "main", diff --git a/API.md b/API.md index e92315c..fb83e30 100644 --- a/API.md +++ b/API.md @@ -99,6 +99,7 @@ Any object. | --- | --- | --- | | node | constructs.Node | The tree node. | | eventBus | aws-cdk-lib.aws_events.EventBus | *No description.* | +| eventListenerLambdaLiveAlias | aws-cdk-lib.aws_lambda.IFunction | *No description.* | --- @@ -124,6 +125,16 @@ public readonly eventBus: EventBus; --- +##### `eventListenerLambdaLiveAlias`Required + +```typescript +public readonly eventListenerLambdaLiveAlias: IFunction; +``` + +- *Type:* aws-cdk-lib.aws_lambda.IFunction + +--- + ## Structs diff --git a/LICENSE b/LICENSE index d645695..68a49da 100644 --- a/LICENSE +++ b/LICENSE @@ -1,202 +1,24 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.md b/README.md index 2b50281..8cab7e0 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,75 @@ # @wisegpt/awscdk-slack-event-bus +

+ API ยท + Changelog +

+ +

+ Unlicense + Build badge + Release badge +

+ +
+ This library was created to fulfill the need of integrating Slack as a Event Source for [AWS EventBridge](https://aws.amazon.com/eventbridge/). -Library exposes an AWS CDK Construct that; +## Architecture +![AWSCDK-Slack-Event-Bus-Architecture](docs/AWSCDK-Slack-Event-Bus-Architecture.png) -1. Creates [EventBus](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-events.EventBus.html) to send all events to +1. Creates an [EventBus](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-events.EventBus.html) to send all Slack events to 2. Creates [AWS HTTP API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html) for exposing [Slack Events API Request URL](https://api.slack.com/apis/connections/events-api#the-events-api__subscribing-to-event-types__events-api-request-urls) -3. Creates and exposes an [AWS Lambda](https://aws.amazon.com/lambda/) via [AWS HTTP API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html) to be used as [Slack Events API Request URL](https://api.slack.com/apis/connections/events-api#the-events-api__subscribing-to-event-types__events-api-request-urls) - 1. **Lambda** responds to initial handshake which is received when Slack App is configured with the Request URL - 2. **Lambda** validates the signature for each received event - 3. **Lambda** sends all received events to **EventBus** +3. Exposes an [AWS Lambda](https://aws.amazon.com/lambda/) via [AWS HTTP API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html) to be used as [Slack Events API Request URL](https://api.slack.com/apis/connections/events-api#the-events-api__subscribing-to-event-types__events-api-request-urls) + 1. **Lambda** validates the Signature of each received event + 2. **Lambda** responds to `url_verification` which is received when Slack App is configured with the Request URL + 3. **Lambda** sends all received events to the created **EventBus** + + +## Example Usage + +```typescript +import { CfnOutput, Stack, StackProps, SecretValue } from "aws-cdk-lib"; +import { Secret } from "aws-cdk-lib/aws-secretsmanager"; +import { Construct } from "constructs"; +import { SlackEventBus } from "@wisegpt/awscdk-slack-event-bus"; + +export class MyExampleStack extends Stack { + constructor(scope: Construct, id: string, props: StackProps = {}) { + super(scope, id, props); + + const appId = "<>"; + // !IMPORTANT! you should reference `Secret` more securely, e.g. by using `Secret.fromSecretCompleteArn()` + const tokenSecret = new Secret(this, "WiseGPTSecrets", { + secretObjectValue: { + [`app/${appId}/signing-secret`]: SecretValue.unsafePlainText("<>"), + }, + }); + + const slackEventBus = new SlackEventBus(this, "SlackEventBus", { tokenSecret: tokenSecret }); + + // ... use slackEventBus.eventBus to create rules to listen for events or do something else + + // Copy the output from the CLI or CloudFormation to enable Slack Events API + new CfnOutput(this, "SlackEventRequestUrl", { + value: slackEventBus.slackEventsRequestUrl(appId), + description: "Slack Events Request Url to use in Slack API Dashboard", + }); + } +} +``` + +## Event Mapping Detail + +Received events are sent to the EventBus without any modification to their format. Some mapping from Slack Event to EventBridge Events is done to be able to put the event to the EventBus. Details are as follows; +- All events put to the EventBus have `source` field as `com.slack` +- Only `event_callback` and `app_rate_limited` type of events are sent to the EventBus. +- Extra Information on `event_callback` type of events: + - The `Time` of the EventBus Event is set to the `event_time` of the Slack Event + - The `DetailType` of the EventBus Event is set to `EventCallback.{event.type}` e.g. for `app_mention`, `DetailType` is `EventCallback.app_mention` + - The `Detail` of the EventBus Event is set to the whole Event envelope that Slack has sent. E.g. `{ type: 'event_callback', event: { type: 'app_mention', ... }, ... }` the `token` field you would normally get from the Slack Event is omitted for security measure. +- Extra Information on `app_rate_limited` type of events: + - The `Time` of the EventBus Event is set to the `minute_rate_limited` of the Slack Event + - The `DetailType` of the EventBus Event is set to fixed `AppRateLimited` + - The `Detail` of the EventBus Event is set to the whole Event envelope that Slack has sent. E.g. `{ type: 'app_rate_limited', api_app_id: ..., }` again, `token` is omitted for safety measure. diff --git a/docs/AWSCDK-Slack-Event-Bus-Architecture.drawio b/docs/AWSCDK-Slack-Event-Bus-Architecture.drawio new file mode 100644 index 0000000..9d0b9b6 --- /dev/null +++ b/docs/AWSCDK-Slack-Event-Bus-Architecture.drawio @@ -0,0 +1 @@ +7Vpbb+I4FP41PILiXIA+FijtSO0sEtqd3b5UhpjgaRJHjikwv36PEycksbl0oWqn21Yt8efj27l8PnZoOcNoc8txsnxgPglbtuVvWs6oZdvItT34kMg2R3qomwMBp74S2gFT+oso0FLoivokrQkKxkJBkzo4Z3FM5qKGYc7Zui62YGF91AQ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AILWp6RWNx674/6gUjeiHDrKE9ZYkq/sj4Zhpc1giByvC3gqOHsmpvTVx+mypPCj+bA5jdY4o8InVQ6wi7LyOGOyXCTx0SaQdy8dvE7dDnBNxtHf5nI+knryp7oUTuhToCLjANtoO8Be/rDdRjJcJMeVZLjX15PhArs4x3ePM8W0SL2aDPCAYziG8C8i+N2JwHN7sKe9igiGPeSg8f+GCNTx4ylSLn8RMnBtp3nist+ZDpDpBqcRyvLmIjkr8zqiFqQdRG3H0fRS3iBXFYNc762S4b1Emey9fMoutKDRPU0FiSVTWkcuo5K9BGoM8rcOMUPEOJ0QRzMfPy1WseKIJjeMvb4HBtS5JmYxOTV0DrjnXs9BXsfT/KR7ZYgf+63iB2lu8hecKheUyEuMKWgaixUncujYh/8TzNOs6sZ8tQ0aEg2T1PhWabRqAAWdfuxaL6kg0wRnB9Y12Fk7iJ987PrPBixuNZBuP2OcF2nT5Q3oveLolBltwKm8EdCyo7xyZcibvhKm3z1h+jo5HUuYsld1szw0LpIsdft6VmD33jlb6mph+3XH2cyYjt5x5pT7bi+drzTCly+dc3eVG7d8/MwvnnMnPvjm2XV79cBrnXX/WX7pxdTpOZejUNx9TyQX333bxrn5Fw== \ No newline at end of file diff --git a/docs/AWSCDK-Slack-Event-Bus-Architecture.png b/docs/AWSCDK-Slack-Event-Bus-Architecture.png new file mode 100644 index 0000000000000000000000000000000000000000..c99c37b6a1058eb5bb3c7a53a46a44065a06a516 GIT binary patch literal 25434 zcmd42by!r<_cuC-gi5y{AzcCzA|Z`}bayKyodXP|A~2++beFW0(lG;qbcfW?IUI6; z0p9WZyYKJ4&wHQuzx&+h&Ohg@efC~^ueCn=v-UZ&cciBJ8^VXQ4?!Rhp|X;KHVA}+ z0DvvHb4NyHjfBpGX;p65@pFK(cDK3Y>r`88jkX|~o4obsiLHAMC z_rK{adT30J`>$um8uWrKROV zB=Qb@E%-|1$B!Q;CnrNg!-|@w0s;d2`v+UwJ3KEG`}zkG5)vd7by`|lK7amv-Zs|W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vd^tJ$Z4vxfSp$JMWt5HJ9$2aS7hp)GKK|dC1Nlv79$9iH{VG#nt6z^bv(sor?Sy zWh68kzKhd0IE$ZOi(eA|SLY3uy*RLF_U28(c_V^zNk6yGQBn4Pm8PUkPagL;a-`s5 zTk#rP?;U?!fW=!qp|X+KCVOO_;QhBn>U9e*O&E-xloiTy6Yr_T&VExb2+I;a8i@6G zBBi7}cavp_d4MgJmu5%uMF`^BcGxQ>0Dr%nhGQ=3dh}~kx1ul}L>bDHat2A8z!63I zzsF4(R$ec`E*0PJf%jemBYylB_vUsr5vH78pX5c(u)3m8c(P<;T(AeRD%0Qm4!o^j z14k9t+d@ar-TS0wUwXO%cT`pTr;N}YK}vd$G!|JzH{HbV6>51tKZs<~W)w#%Nq{pj zJ@t>E$(_lszfPw9pvrFc9!QVAC<)Pm$3qsiu)EQlRCQI6+I?c89No4E+92Xr8m>JA zZyrN~bT-KJ6Z9$gAENK|yb?Z=rkdQ&u`(No&V@S=4#l3~RQ{~&B)!UHRg@_`o<+cQ z7>L4NZ;k->-kr~Ui}!iw1|Psf-o{3~PQnqv!4`ax#5Kll(o6W$y*Lp$W!79IZeq;7ud@0UDJGS(BVOaNRp!aDfmy0Bl=}*Wk4Df zphB!a%1dJc0~^2IO_7dq!!-3ytJZxvgA}<~I@w#CadQYXy}_glOc!?ZbmiIHvPkVq zr)}2C4(kg{&=~yYcMHOVQw!20qFO}4Va8>sE5j`@-OQRn#A=-uQf?7{m;RXL zNCw+aCwb}qG-Jf6kA|Hc?JfcgS|qlnh_SS(Rc|HE+$R#B^*W%S5MIE%UZl3c!!W_n zJVis^b(@J65v}leWZuuVHT*|Q#CqJDq5g5^LszD2tX-(JBeF8QkLIk$l&b%40X8N> Y783B;`}_RKzsE=|H9gguC-$%Y2iA7O9RL6T literal 0 HcmV?d00001 diff --git a/package-lock.json b/package-lock.json index e05e28d..764423f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "@wisegpt/awscdk-slack-event-bus", "version": "0.0.0", - "license": "Apache-2.0", + "license": "Unlicense", "devDependencies": { "@aws-cdk/aws-apigatewayv2-alpha": "2.12.0-alpha.0", "@aws-cdk/aws-apigatewayv2-integrations-alpha": "2.12.0-alpha.0", diff --git a/package.json b/package.json index 45fe919..21ac948 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slack" ], "main": "lib/index.js", - "license": "Apache-2.0", + "license": "Unlicense", "publishConfig": { "access": "public" }, diff --git a/src/index.ts b/src/index.ts index a37b4fa..4f5c97f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import * as apigwv2 from "@aws-cdk/aws-apigatewayv2-alpha"; import { HttpMethod } from "@aws-cdk/aws-apigatewayv2-alpha"; import { HttpLambdaIntegration } from "@aws-cdk/aws-apigatewayv2-integrations-alpha"; import { aws_events as Events } from "aws-cdk-lib"; -import { Architecture } from "aws-cdk-lib/aws-lambda"; +import { Alias, Architecture, IFunction } from "aws-cdk-lib/aws-lambda"; import { ISecret } from "aws-cdk-lib/aws-secretsmanager"; import { Construct } from "constructs"; import { SlackEventsFunction } from "./lambdas/slack-events-function"; @@ -19,18 +19,19 @@ export class SlackEventBus extends Construct { private static readonly SLACK_EVENT_BUS_NAME = "slack-event-bus"; private readonly pEventBus: Events.EventBus; + private readonly pEventListenerLambdaLiveAlias: Alias; private readonly httpApi: apigwv2.HttpApi; constructor(scope: Construct, id: string, props: SlackEventBusProps) { super(scope, id); - this.pEventBus = new Events.EventBus(this, "SlackEventBus", { + this.pEventBus = new Events.EventBus(this, "EventBus", { eventBusName: SlackEventBus.SLACK_EVENT_BUS_NAME, }); - const slackEventsLambda = new SlackEventsFunction( + const eventListenerLambda = new SlackEventsFunction( this, - "SlackEventsLambda", + "EventListenerLambda", { description: "Slack Events API Request URL Handler", architecture: Architecture.ARM_64, @@ -41,11 +42,20 @@ export class SlackEventBus extends Construct { } ); - props.tokenSecret.grantRead(slackEventsLambda); - this.pEventBus.grantPutEventsTo(slackEventsLambda); + this.pEventListenerLambdaLiveAlias = new Alias( + this, + "EventListenerLambdaLiveAlias", + { + aliasName: "live", + version: eventListenerLambda.currentVersion, + } + ); + + props.tokenSecret.grantRead(this.pEventListenerLambdaLiveAlias); + this.pEventBus.grantPutEventsTo(this.pEventListenerLambdaLiveAlias); this.httpApi = new apigwv2.HttpApi(this, "HttpApi", { - description: "Slack Event Bus Http Api", + description: "Slack Events Http Api", }); this.httpApi.addRoutes({ @@ -53,8 +63,8 @@ export class SlackEventBus extends Construct { // ALL methods expect OPTIONS / ANY should be handled by our Lambda methods: [HttpMethod.POST], integration: new HttpLambdaIntegration( - "SlackEventsPostIntegration", - slackEventsLambda + "EventsPostIntegration", + this.pEventListenerLambdaLiveAlias ), }); } @@ -71,4 +81,8 @@ export class SlackEventBus extends Construct { get eventBus(): Events.EventBus { return this.pEventBus; } + + get eventListenerLambdaLiveAlias(): IFunction { + return this.pEventListenerLambdaLiveAlias; + } } diff --git a/test/unit/internal/slack/slack-parse-event.test.ts b/test/unit/internal/slack/slack-parse-event.test.ts new file mode 100644 index 0000000..9810d17 --- /dev/null +++ b/test/unit/internal/slack/slack-parse-event.test.ts @@ -0,0 +1,58 @@ +import { slackParseEvent } from "../../../../src/internal/slack/slack-parse-event"; + +describe("slackParseEvent()", () => { + it("should parse url verification", () => { + const event = { + type: "url_verification", + challenge: "some-challenge", + token: "some-token", + }; + + const result = slackParseEvent(JSON.stringify(event)); + + expect(result).toMatchObject( + expect.objectContaining({ + payload: { + type: event.type, + challenge: event.challenge, + }, + }) + ); + }); + + it("should parse event callback", () => { + const event = { + type: "event_callback", + event_time: 10000, + token: "some-token", + }; + + const result = slackParseEvent(JSON.stringify(event)); + + expect(result).toEqual({ + payload: { ...event, token: undefined }, + time: new Date(event.event_time * 1000), + }); + }); + + it("should parse app rate limited", () => { + const event = { + type: "app_rate_limited", + token: "some-token", + minute_rate_limited: 10000, + }; + + const result = slackParseEvent(JSON.stringify(event)); + + expect(result).toEqual({ + payload: { ...event, token: undefined }, + time: new Date(event.minute_rate_limited * 1000), + }); + }); + + it("should throw on unknown type", () => { + const callback = () => slackParseEvent(JSON.stringify({})); + + expect(callback).toThrow(); + }); +});