slackapi / slack-api-specs

Open API specifications for platform products by Slack
MIT License
221 stars 64 forks source link

When bot is in group chat, I don't receive messages using the bolt-js library #51

Closed mauricioszabo closed 3 years ago

mauricioszabo commented 3 years ago

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

I'm registering a callback with the following code:

app.message(/ping/, (e) => { console.log(e) })

It is not printing anything if I'm on group chat. I see the message on the debug console, but it fails with error: Conversation not found.

[DEBUG]  bolt-app {"token":"k7PRs87qbRwzm4A4LAtOCSGb","team_id":"T0JV0MYCE","api_app_id":"A01Q2UP4HQQ","event":{"client_msg_id":"0b3149e4-1243-4a27-be4c-2aecb715cab9","type":"app_mention","text":"<@U01PDC4EB8B> ping","user":"UR62DEJCX","ts":"1614363797.012900","team":"T0JV0MYCE","blocks":[{"type":"rich_text","block_id":"fxp","elements":[{"type":"rich_text_section","elements":[{"type":"user","user_id":"U01PDC4EB8B"},{"type":"text","text":" ping"}]}]}],"channel":"G01PJFVB4GK","event_ts":"1614363797.012900"},"type":"event_callback","event_id":"Ev01PQKP3RNY","event_time":1614363797,"authorizations":[{"enterprise_id":null,"team_id":"T0JV0MYCE","user_id":"U01PDC4EB8B","is_bot":true,"is_enterprise_install":false}],"is_ext_shared_channel":false,"event_context":"1-app_mention-T0JV0MYCE-G01PJFVB4GK"}
[DEBUG]  socket-mode:SocketModeClient:0 calling ack events_api
[DEBUG]  socket-mode:SocketModeClient:0 send() in state: connected,ready
[DEBUG]  socket-mode:SocketModeClient:0 sending message on websocket: {"envelope_id":"889495a0-c7ce-4ad4-a7cd-5329ba5c7295","payload":{}}
[DEBUG]  bolt-app Conversation context failed loading for ID: G01PJFVB4GK, error: Conversation not found

Reproducible in:

Bolt-js version 3.2.0, node.js v12.13.0, Ubuntu 18.04

Steps to reproduce:

  1. Listen to anything using the .message call
  2. Add the bot in a group chat with at least two people
  3. Mention the bot with the message that it should listen

Expected result:

The callback to be called

Actual result:

Nothing happened.

Attachments:

There are lots of information on how I'm trying to debug this on https://github.com/slackapi/bolt-js/issues/817. I tried to pinpoint the error by listening directly to slack_event, exactly the same as the bolt-js listens to callbacks to check what's wrong. What I did found is that body.event.type of that callback is something_mention, and that what the API is expecting is message. I don't know if the API is supposed to send message as the event type - what I do know is that when I mention the bot with @bot ping (bot being the bot's name) on public channels, private channels, and direct messages, I receive a message event. When I mention on group chat (a chat with my user, another user, and the bot) I don't receive a message and instead receive a mention.

seratch commented 3 years ago

This question will be answered at https://github.com/slackapi/bolt-js/issues/817 or by our support agents if it requires deeper investigation on the server-side. Let me close this issue in this repository.