MCPcopy Index your code
hub / github.com/slackapi/python-slack-sdk / main

Function main

integration_tests/samples/socket_mode/aiohttp_example.py:13–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13async def main():
14 client = SocketModeClient(
15 app_token=os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_APP_TOKEN"),
16 web_client=AsyncWebClient(token=os.environ.get("SLACK_SDK_TEST_SOCKET_MODE_BOT_TOKEN")),
17 trace_enabled=True,
18 )
19
20 async def process(client: SocketModeClient, req: SocketModeRequest):
21 if req.type == "events_api":
22 response = SocketModeResponse(envelope_id=req.envelope_id)
23 await client.send_socket_mode_response(response)
24 if req.payload["event"]["type"] == "message":
25 await client.web_client.reactions_add(
26 name="eyes",
27 channel=req.payload["event"]["channel"],
28 timestamp=req.payload["event"]["ts"],
29 )
30
31 client.socket_mode_request_listeners.append(process)
32 await client.connect()
33 await asyncio.sleep(float("inf"))
34
35
36asyncio.run(main())

Callers 1

aiohttp_example.pyFile · 0.70

Calls 5

connectMethod · 0.95
SocketModeClientClass · 0.90
AsyncWebClientClass · 0.90
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected