Kevin Lenell
10/26/2021, 1:18 AMthdxr
10/26/2021, 1:19 AMthdxr
10/26/2021, 1:19 AMthdxr
10/26/2021, 1:19 AMthdxr
10/26/2021, 1:20 AMKevin Lenell
10/26/2021, 1:59 AMthdxr
10/26/2021, 2:00 AMKevin Lenell
10/26/2021, 2:15 AMthdxr
10/26/2021, 2:15 AMthdxr
10/26/2021, 2:16 AMKevin Lenell
10/26/2021, 2:23 AMthdxr
10/26/2021, 2:41 AMthdxr
10/26/2021, 2:42 AMFrank
thdxr
10/26/2021, 1:16 PMthdxr
10/26/2021, 1:17 PMthdxr
10/26/2021, 1:18 PMconst rest = new sst.Api(this, "rest", {
routes: {
"POST /slack": "services/rest/slack.handler",
},
})
this.addOutputs({
AppSync: appsync.url,
Rest: rest.url,
})
Then the handler it points to just needs to have this
import { APIGatewayProxyHandlerV2 } from "aws-lambda"
import { App, AwsLambdaReceiver } from "@slack/bolt"
const awsLambdaReceiver = new AwsLambdaReceiver({
signingSecret: "<>",
})
// Initializes your app with your bot token and the AWS Lambda ready receiver
const app = new App({...})
app.event("message", async (event) => {...})
export const handler: APIGatewayProxyHandlerV2 = async (
event,
context,
callback
) => {
const handler = (await app.start()) as any
return handler(event, context, callback)
}
thdxr
10/26/2021, 1:18 PMthdxr
10/26/2021, 1:19 PMthdxr
10/26/2021, 1:20 PMFrank
/slack/events
) into as the Request URL