Код: Выделить всё
socket_mode_client = SocketModeClient(
# This app-level token will be used only for establishing a connection
app_token=os.environ['APP_TOKEN'], # xapp-A111-222-xyz
# You will be using this WebClient for performing Web API calls in listeners
web_client=WebClient(token=os.environ['TOKEN']), # xoxb-111-222-xyz
)
def _process_websocket_message(client: SocketModeClient, request: SocketModeRequest):
# Acknowledge the request
response = SocketModeResponse(envelope_id=request.envelope_id)
client.send_socket_mode_response(response)
if request.type != 'events_api':
return
# ignore duplicated requests
if request.retry_attempt is not None and request.retry_attempt > 0:
return
payload_event = request.payload['event']
if payload_event['type'] == 'app_mention' and '' in payload_event['']:
# respond
Я тоже готов попробовать другой подход.
Подробнее здесь: https://stackoverflow.com/questions/789 ... n-channels