Skip to content

Commit 07def73

Browse files
committed
Add solution folder with initial change to main.py
1 parent b5db498 commit 07def73

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

solution/main.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from pprint import pprint
2+
3+
from fastapi import Body, FastAPI, Request, Response
4+
5+
app = FastAPI()
6+
7+
8+
@app.post("/echo")
9+
async def echo(request: Request, response: Response, data=Body(...)):
10+
raw_body = await request.body()
11+
body = raw_body.decode("utf-8")
12+
13+
# We need to add the `channels:read` scope
14+
# From the `OAuth & Permissions` section in the bot settings
15+
# This will give us `data.event.channel`, which is the channe id,
16+
# So we can post back a message
17+
pprint(data)
18+
19+
return {
20+
"data": data,
21+
"raw_body": body,
22+
"headers": request.headers
23+
}

solution/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fastapi==0.67.0
2+
uvicorn==0.14.0
3+
requests==2.26.0

0 commit comments

Comments
 (0)