@@ -21,6 +21,7 @@ import {
2121} from "aws-cdk-lib/aws-bedrock"
2222import { RestApiGateway } from "../constructs/RestApiGateway"
2323import { LambdaFunction } from "../constructs/LambdaFunction"
24+ import { LambdaEndpoint } from "../constructs/RestApiGateway/LambdaEndpoint"
2425import { PolicyStatement } from "aws-cdk-lib/aws-iam"
2526import * as cdk from "aws-cdk-lib"
2627import * as iam from "aws-cdk-lib/aws-iam"
@@ -465,7 +466,7 @@ export class EpsAssistMeStack extends Stack {
465466 slackBotLambda . function . addToRolePolicy ( lambdaGRinvokePolicy )
466467 slackBotLambda . function . addToRolePolicy ( lambdaSSMPolicy )
467468
468- // Define the API Gateway resource and associate the trigger for Industrial Query Lambda function=
469+ // Define the API Gateway and connect the '/slack/ask-eps' POST endpoint to the SlackBot Lambda function
469470 const apiGateway = new RestApiGateway ( this , "EpsAssistApiGateway" , {
470471 stackName : props . stackName ,
471472 logRetentionInDays,
@@ -474,9 +475,16 @@ export class EpsAssistMeStack extends Stack {
474475 truststoreVersion : "unused"
475476 } )
476477
477- // Define the '/industrial/query' API resource with a POST method
478- const slackRoute = apiGateway . api . root . addResource ( "slack" ) . addResource ( "ask-eps" )
479- slackRoute . addMethod ( "POST" )
478+ const slackResource = apiGateway . api . root . addResource ( "slack" )
479+
480+ // Create the '/slack/ask-eps' POST endpoint and integrate it with the SlackBot Lambda
481+ new LambdaEndpoint ( this , "SlackAskEpsEndpoint" , {
482+ parentResource : slackResource ,
483+ resourceName : "ask-eps" ,
484+ method : "POST" ,
485+ restApiGatewayRole : apiGateway . role ,
486+ lambdaFunction : slackBotLambda
487+ } )
480488
481489 // ==== Output: SlackBot Endpoint ====
482490 new CfnOutput ( this , "SlackBotEndpoint" , {
0 commit comments