Python backend for a Slack's kudos plugin.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: wip slash command

+81 -3
+52 -2
app/main.py
··· 1 - from fastapi import FastAPI 1 + from fastapi import FastAPI, Form 2 2 from slack_sdk import WebClient 3 3 4 4 app = FastAPI() 5 5 6 6 7 + @app.post("/command/") 8 + async def command( 9 + token: str = Form(...), 10 + team_id: str = Form(...), 11 + team_domain: str = Form(...), 12 + enterprise_id: str = Form(...), 13 + enterprise_name: str = Form(...), 14 + channel_id: str = Form(...), 15 + channel_name: str = Form(...), 16 + user_id: str = Form(...), 17 + user_name: str = Form(...), 18 + command: str = Form(...), 19 + text: str = Form(...), 20 + response_url: str = Form(...), 21 + trigger_id: str = Form(...), 22 + api_app_id: str = Form(...), 23 + ): 24 + return { 25 + "blocks": [ 26 + { 27 + "type": "header", 28 + "text": { 29 + "type": "plain_text", 30 + "text": "Muchas gracias, Rubén! :loveparrot:", 31 + "emoji": True, 32 + }, 33 + }, 34 + { 35 + "type": "section", 36 + "text": { 37 + "type": "mrkdwn", 38 + "text": "Gracias por ayudarme a configurar VSCode, pyenv y Poetry :sonrisa:", 39 + }, 40 + "accessory": { 41 + "type": "image", 42 + "image_url": "https://www.purina-latam.com/sites/g/files/auxxlc391/files/styles/social_share_large/public/Purina%C2%AE%20La%20llegada%20del%20gatito%20a%20casa.jpg", 43 + "alt_text": "computer thumbnail", 44 + }, 45 + }, 46 + { 47 + "type": "section", 48 + "text": { 49 + "type": "mrkdwn", 50 + "text": "Rubén se lleva 100 dekas :flyingmoneyparrot:", 51 + }, 52 + }, 53 + ] 54 + } 55 + 56 + 7 57 @app.get("/") 8 - def read_root(): 58 + async def read_root(): 9 59 client = WebClient() 10 60 api_response = client.api_test() 11 61 return {"data": api_response.data}
+27 -1
poetry.lock
··· 296 296 testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] 297 297 298 298 [[package]] 299 + name = "python-multipart" 300 + version = "0.0.5" 301 + description = "A streaming multipart parser for Python" 302 + category = "main" 303 + optional = false 304 + python-versions = "*" 305 + 306 + [package.dependencies] 307 + six = ">=1.4.0" 308 + 309 + [[package]] 299 310 name = "regex" 300 311 version = "2021.11.2" 301 312 description = "Alternative regular expression module, to replace re." ··· 304 315 python-versions = "*" 305 316 306 317 [[package]] 318 + name = "six" 319 + version = "1.16.0" 320 + description = "Python 2 and 3 compatibility utilities" 321 + category = "main" 322 + optional = false 323 + python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" 324 + 325 + [[package]] 307 326 name = "slack-sdk" 308 327 version = "3.11.2" 309 328 description = "The Slack API Platform SDK for Python" ··· 436 455 [metadata] 437 456 lock-version = "1.1" 438 457 python-versions = ">=3.9,<4.0.0" 439 - content-hash = "7b9668be440f1c7dd029ea1e0f2fc0c04c9167f470b58f6c029408dd9617c6f0" 458 + content-hash = "ef953af5a750279d71ae55e2ddafec97eb4620ba1067652cb59e203540bf6fda" 440 459 441 460 [metadata.files] 442 461 anyio = [ ··· 624 643 {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, 625 644 {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, 626 645 ] 646 + python-multipart = [ 647 + {file = "python-multipart-0.0.5.tar.gz", hash = "sha256:f7bb5f611fc600d15fa47b3974c8aa16e93724513b49b5f95c81e6624c83fa43"}, 648 + ] 627 649 regex = [ 628 650 {file = "regex-2021.11.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:897c539f0f3b2c3a715be651322bef2167de1cdc276b3f370ae81a3bda62df71"}, 629 651 {file = "regex-2021.11.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:886f459db10c0f9d17c87d6594e77be915f18d343ee138e68d259eb385f044a8"}, ··· 674 696 {file = "regex-2021.11.2-cp39-cp39-win32.whl", hash = "sha256:30fe317332de0e50195665bc61a27d46e903d682f94042c36b3f88cb84bd7958"}, 675 697 {file = "regex-2021.11.2-cp39-cp39-win_amd64.whl", hash = "sha256:85289c25f658e3260b00178757c87f033f3d4b3e40aa4abdd4dc875ff11a94fb"}, 676 698 {file = "regex-2021.11.2.tar.gz", hash = "sha256:5e85dcfc5d0f374955015ae12c08365b565c6f1eaf36dd182476a4d8e5a1cdb7"}, 699 + ] 700 + six = [ 701 + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, 702 + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, 677 703 ] 678 704 slack-sdk = [ 679 705 {file = "slack_sdk-3.11.2-py2.py3-none-any.whl", hash = "sha256:35245ec34c8549fbb5c43ccc17101afd725b3508bb784da46530b214f496bf93"},
+2
pyproject.toml
··· 11 11 uvicorn = "^0.15.0" 12 12 slack-sdk = "^3.11.2" 13 13 gunicorn = "^20.1.0" 14 + pydantic = "^1.8.2" 15 + python-multipart = "^0.0.5" 14 16 15 17 [tool.poetry.dev-dependencies] 16 18 black = "^21.10b0"