Framework para criar bots para Slack usando python. Pode-se usar inclusive o Slack Socket ModeMode]] do Slack para não precisar expor um endpoint publicamente.
URL Sobre: https://slack.dev/bolt-python/tutorial/getting-started
Notas
Recebimento de qualquer mensagem
Para receber qualquer mensagem (sem dar match em um termo específico) pode-se passar uma string vazia ""
@app.message("")
def message_hello(message, say):
pprint.pprint(message)
# say() sends a message to the channel where the event was triggered
say(f"Hey there <@{message['user']}>!")
Payload do event no mention
exemplo:
{'blocks': [{'block_id': 'qFkWH',
'elements': [{'elements': [{'text': 'Olá ', 'type': 'text'},
{'type': 'user',
'user_id': 'U06LUUNUB1B'},
{'text': '!', 'type': 'text'}],
'type': 'rich_text_section'}],
'type': 'rich_text'}],
'channel': 'C06LXQ3L1DG',
'client_msg_id': '14a38b73-ac0e-4f67-b5cc-ef436bea6b66',
'event_ts': '1710189558.254059',
'team': 'T06LXQ3J6CA',
'text': 'Olá <@U06LUUNUB1B>!',
'ts': '1710189558.254059',
'type': 'app_mention',
'user': 'U06M080SC84'}