Skip to content

Commit

Permalink
Update deploy with aws serverless guide (#1066)
Browse files Browse the repository at this point in the history
  • Loading branch information
srajiang committed Aug 18, 2021
1 parent dc3e4a9 commit 1b1231a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions docs/_deployments/aws-lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,28 @@ Now that you have an app, let's prepare it for AWS Lambda and the Serverless Fra

**1. Prepare the app for AWS Lambda**

By default, Bolt listens for HTTP requests. In this section, we'll customize your Bolt app's [`receiver`](https://slack.dev/bolt-js/concepts#receiver) to respond to Lambda function events instead.
By default, our Bolt Getting Started app sample is configured to use SocketMode. Let's update the setup in `app.js` to have our app listen for HTTP requests instead.

First, update the [source code that imports your modules](https://github.com/slackapi/bolt-js-getting-started-app/blob/main/app.js#L1) in `app.js` to require Bolt's AwsLambdaReceiver:
```javascript
// Initializes your app with your bot token
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
socketMode: true, // delete this line
appToken: process.env.SLACK_APP_TOKEN, // delete this line
});
```

Next, we'll customize your Bolt app's [`receiver`](https://slack.dev/bolt-js/concepts#receiver) to respond to Lambda function events.

Update the [source code that imports your modules](https://github.com/slackapi/bolt-js-getting-started-app/blob/4c29a21438b40f0cbca71ece0d39b356dfcf88d5/app.js#L1) in `app.js` to require Bolt's AwsLambdaReceiver:

```javascript
const { App, AwsLambdaReceiver } = require('@slack/bolt');
```

Then update the [source code that initializes your Bolt app](https://github.com/slackapi/bolt-js-getting-started-app/blob/main/app.js#L3-L7) to create a custom receiver using AwsLambdaReceiver:
> 💡 If you are planning on implementing authentication with OAuth, as of today you need to use the [`ExpressReceiver`](https://github.com/slackapi/bolt-js/blob/main/src/receivers/ExpressReceiver.ts).
Then update the [source code that initializes your Bolt app](https://github.com/slackapi/bolt-js-getting-started-app/blob/4c29a21438b40f0cbca71ece0d39b356dfcf88d5/app.js#L10-L14) to create a custom receiver using AwsLambdaReceiver:

```javascript
// Initialize your custom receiver
Expand Down

0 comments on commit 1b1231a

Please sign in to comment.