When bot is in group chat, the callback for `.message` is not being called
See original GitHub issueDescription
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
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
- I’ve read and agree to the Code of Conduct.
- I’ve searched for any related issues and avoided creating a duplicate issue.
Bug Report
Reproducible in:
package version: 3.2.0 node version: v12.13.0 OS version(s): Ubuntu 18.04
Steps to reproduce:
- Listen to anything using the
.message
call - Add the bot in a group chat with at least two people
- Mention the bot with the message that it should listen
Expected result:
The callback to be called
Actual result:
The callback is not called, and the DEBUG info prints Conversation not found
What I also tried
Checked that the bot CAN post to the group conversation
Checked with app.receiver.client.on('slack_event'...)
that the message is visible
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Python Telegram bot callback with a custom message not ...
So I guess the problem is that your callback function hello expects three positional arguments but the telegram API under the hood calls...
Read more >node-red-contrib-telegrambot
If the configuration node property ChatIds is not set, all chat messages are received. You can control if the bot receives every message...
Read more >pyTelegramBotAPI 3.6.0 - PyPI
Python Telegram bot api. ... `How can I distinguish a User and a GroupChat in ... After that declaration, we need to register...
Read more >ACTF2022 safer-tg-bot-{1,2} WP - JieJiSS' Blog
Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data.
Read more >Telegram inline keyboard does not send callback for ...
is important part here. If i remember correctly you need to initialize connection to bot first to be able to receive messages.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@manucaicedo Is
A01Q2UP4HQQ
your app’s ID (I found this ID in your issue decscription)? If so, please visit https://api.slack.com/apps/A01Q2UP4HQQ/event-subscriptions and make sure ifmessage.mpim
is in the bot events.Thanks for your prompt reply. Just in case, I’ve verified if there is no issue with Bolt’s handling with the following code.
The result was that my
app.message
printed the message object for both public and private channels.What I did are:
message.channels
message.groups
SLACK_APP_TOKEN
andSLACK_BOT_TOKEN
in env variablesnpx node app.js
)The only difference in Bolt I can imagine here is that the framework intentionally ignores most events generated by the apps’ bot user itself. This is helpful to avoid unintentional infinite loop situation.