Skip to content

Commit cfc9daa

Browse files
authored
Change AWS API Gateway to Lambda Function URL (#661)
1 parent 15033fe commit cfc9daa

File tree

1 file changed

+32
-38
lines changed

1 file changed

+32
-38
lines changed

examples/aws_lambda/README.md

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This directory contains two example apps. Both respond to the Slash Command
44
`/hello-bolt-python-lambda` and both respond to app at-mentions.
55

66
The "Lazy Lambda Listener" example is the simpler application and it leverages
7-
AWS Lambda and AWS API Gateway to execute the Bolt app logic in Lambda and
8-
expose the application HTTP routes to the internet via API Gateway. The "OAuth
7+
AWS Lambda and AWS Lambda Function URL to execute the Bolt app logic in Lambda and
8+
expose the application HTTP routes to the internet via Lambda URL. The "OAuth
99
Lambda Listener" example additionally includes OAuth flow handling routes and uses
1010
AWS S3 to store workspace installation credentials and OAuth flow state
1111
variables, enabling your app to be installed by anyone.
@@ -49,33 +49,28 @@ Instructions on how to set up and deploy each example are provided below.
4949
Lambda there.
5050
8. While your Lambda exists, it is not accessible to the internet, so Slack
5151
cannot send events happening in your Slack workspace to your Lambda. Let's
52-
fix that by adding an AWS API Gateway in front of your Lambda so that your
52+
fix that by adding an AWS Lambda Function URL to your Lambda so that your
5353
Lambda can accept HTTP requests:
5454
- Click on your `bolt_py_function` Lambda
55-
- In the Function Overview, on the left side, click "+ Add Trigger"
56-
- Select API Gateway from the trigger list
57-
- Make sure "Create an API" is selected in the dropdown, and choose "HTTP API"
58-
as the API Type
59-
- Under Security, select "Open"
60-
- Click "Add"
61-
9. Congrats! Your Slack app is now accessible to the public. On the left side of
62-
your `bolt_py_function` Function Overview you should see a purple API Gateway
63-
icon. Click it.
64-
10. Click Details to expand the details section.
65-
11. Copy the API Endpoint - this is the URL your Lambda function is accessible
66-
at publicly.
67-
12. We will now inform Slack that this example app can accept Slash Commands.
55+
- In the Function Overview click "Configuration"
56+
- On the left side, click "Function URL"
57+
- Click "Create function URL"
58+
- Choose auth type "NONE"
59+
- Click "Save"
60+
9. Congrats! Your Slack app is now accessible to the public. On the right side of
61+
your `bolt_py_function` Function Overview you should see your Lambda Function URL.
62+
10. Copy this URL to your clipboard.
63+
11. We will now inform Slack that this example app can accept Slash Commands.
6864
- Back on api.slack.com/apps, select your app and choose Slash Commands from the left menu.
6965
- Click Create New Command
7066
- By default, the `lazy_aws_lambda.py` function has logic for a
7167
`/hello-bolt-python-lambda` command. Enter `/hello-bolt-python-lambda` as
7268
the Command.
73-
- Under Request URL, paste in the previously-copied API Endpoint from API
74-
Gateway.
69+
- Under Request URL, paste in the previously-copied Lambda Function URL.
7570
- Click Save
76-
13. Test it out! Back in your Slack workspace, try typing
71+
12. Test it out! Back in your Slack workspace, try typing
7772
`/hello-bolt-python-lambda hello`.
78-
14. If you have issues, here are some debugging options:
73+
13. If you have issues, here are some debugging options:
7974
- Check the Monitor tab under your Lambda. Did the Lambda get invoked? Did it
8075
respond with an error? Investigate the graphs to see how your Lambda is
8176
behaving.
@@ -172,30 +167,29 @@ export
172167
6. Let's deploy the Lambda! Run `./deploy_oauth.sh`. By default it deploys to the us-east-1 region in AWS - you can customize this in `aws_lambda_oauth_config.yaml`.
173168
7. Load up AWS Lambda inside the AWS Console - make sure you are in the correct region that you deployed your app to. You should see a `bolt_py_oauth_function` Lambda there.
174169

175-
### Set up AWS API Gateway
176-
Your Lambda exists, but it is not accessible to the internet, so Slack cannot yet send events happening in your Slack workspace to your Lambda. Let's fix that by adding an AWS API Gateway in front of your Lambda so that your Lambda can accept HTTP requests
170+
### Set up AWS Lambda Function URL
171+
Your Lambda exists, but it is not accessible to the internet, so Slack cannot yet send events happening in your Slack workspace to your Lambda. Let's fix that by adding an AWS Lambda Function URL to your Lambda so that your Lambda can accept HTTP requests
177172

178173
1. Click on your `bolt_py_oauth_function` Lambda
179-
2. In the **Function Overview**, on the left side, click "+ Add Trigger"
180-
3. Select "API Gateway" from the trigger list
181-
4. Make sure "Create an API" is selected in the dropdown, and choose "HTTP API" as the API Type
182-
5. Under Security, select "Open"
183-
6. Click "Add"
184-
185-
Phew, congrats! Your Slack app is now accessible to the public. On the left side of your bolt_py_oauth_function Function Overview you should see a purple API Gateway icon. Click it.
186-
187-
1. Click "Details"
188-
2. Copy the API Endpoint - this is the URL your Lambda function is accessible at publicly.
189-
3. We will now inform Slack that this example app can accept Slash Commands.
190-
4. Back on [api.slack.com/apps](https://api.slack.com/apps), select your app and choose "Slash Commands" from the left menu.
191-
5. Click "Create New Command"
174+
2. In the **Function Overview**, on the left side, click "Configuration
175+
3. On the left side, click "Function URL"
176+
4. Click "Create function URL"
177+
5. Choose auth type "NONE"
178+
6. Click "Save"
179+
180+
Phew, congrats! Your Slack app is now accessible to the public. On the right side of your bolt_py_oauth_function Function Overview you should see a your Lambda Function URL.
181+
182+
1. Copy it - this is the URL your Lambda function is accessible at publicly.
183+
2. We will now inform Slack that this example app can accept Slash Commands.
184+
3. Back on [api.slack.com/apps](https://api.slack.com/apps), select your app and choose "Slash Commands" from the left menu.
185+
4. Click "Create New Command"
192186
1. By default, the `aws_lambda_oauth.py` function has logic for a /hello-bolt-python-lambda command. Enter `/hello-bolt-python-lambda` as the Command.
193-
* Under **Request URL**, paste in the previously-copied API Endpoint from API Gateway.
187+
* Under **Request URL**, paste in the previously-copied Lambda Function URL.
194188
* Click "Save"
195-
6. We also need to register the API Endpoint as the OAuth redirect URL:
189+
5. We also need to register the API Endpoint as the OAuth redirect URL:
196190
1. Load up the **OAuth & Permissions** page on[api.slack.com/apps](https://api.slack.com/apps)
197191
2. Scroll down to "Redirect URLs"
198-
3. Copy the API endpoint in - but remove the path portion. The Redirect URL needs to only partially match where we will send users.
192+
3. Copy the URL endpoint in - but remove the path portion. The Redirect URL needs to only partially match where we will send users.
199193

200194
You can now install the app to any workspace!
201195

0 commit comments

Comments
 (0)