bolt-python
bolt-python copied to clipboard
Socket mode say() sends some of the data to another user
When someone else then me writing to the slack bot, some of the response is sent to me the bot creator instead of them.
Why is that happening? I have no ability to control the user to send the data in say(). Could it be some memory leak across threads?
Hi @nitz-iron , the situation usually never happens. Some of your code using bolt-python may have global objects and/or shared objects across listener executions. If you have a piece of code that easily reproduces the situation, we may be able to help you out.
Thanks for the quick response.
this is my msg_handle code:
def message_handler(app):
@app.message("")
def message_handler(message, say):
text = message["text"]
sentiment = tb(text).sentiment
pol = sentiment.polarity
# channel = message["channel"]
# user = message["user_id"]
if text == "555":
say(text="\n" * 100)
elif lists_intersection(tb(text.lower()).words, ["hi", "hello", "hola", "shalom"]):
say(text=blocks.hi)
elif is_holiday(tb(text.lower()).words):
say(text=handle_holiday(is_holiday(tb(text.lower()).words), tb(text.lower()).words))
elif lists_intersection(tb(text.lower()).words, ["bye", "goodbye"]):
say(text=blocks.bye)
elif "meme" in text.lower():
say(text=blocks.meme)
say(text=blocks.dub)
elif text == "who will win the hackathon?":
say(text="Efrat's team of course")
elif text == "who made you?":
say(text="Only 4 people! Much lesser than other teams!")
elif lists_intersection(tb(text.lower()).words, [a.lower() for a in FIRST_NAMES]):
name = lists_intersection(tb(text.lower()).words, [
a.lower() for a in FIRST_NAMES])[0]
say(text=blocks.stalker)
say(text=who_is(name))
say(text=blocks.canHelp)
elif lists_intersection((tb(text.lower()).words), [x.lower() for x in GLOSSARY.keys()]):
definition = lists_intersection((tb(text.lower()).words), [x.lower() for x in GLOSSARY.keys()])[0]
say(text=what_is(definition, GLOSSARY))
elif 'meaning of life' in text.lower():
say(text=blocks.meaning_of_life)
elif lists_intersection((tb(text).noun_phrases).lower(), [x.lower() for x in GLOSSARY.keys()]):
definition = lists_intersection((tb(text).noun_phrases).lower(), [
x.lower() for x in GLOSSARY.keys()])[0]
say(text=what_is(definition, GLOSSARY))
elif "presentation" in text.lower():
say(text=blocks.presentation)
elif in_charge(tb(text.lower()).words):
say(text=blocks.stalker)
say(text=in_charge(tb(text.lower()).words))
elif text.lower() == "no":
say(text=blocks.bye)
elif asked_for_form(tb(text.lower()).words):
say(text=what_form(asked_for_form(tb(text.lower()).words)))
elif pol >= 0.8:
say(text={
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"*So glad you're happy!.*"
}
}
]
})
elif pol < 0:
say(text=blocks.feel_better)
else:
say(text=blocks.not_found)
return message_handler
I don't have global objects here. Do you notice other quircks?
If the text argument of say method is a dict object that has channel property, the message can be unexpectedly sent to a different channel or DM. https://github.com/slackapi/bolt-python/blob/v1.14.0/slack_bolt/context/say/say.py#L48-L52
From the documentation I understood you can omit the channel and it'll fallback to current channel, no? I also see that in the documentation you gave.
Yes, it is the default and intuitive behavior. My speculation is that the weird behavior you observed may be caused by overridden "channel" parameter as part of dict object.
thanks! I gave a look in code but I don't use channel at all. Do you have any other idea?
In socket mode I do
handler.connect()
and not handler.start()
Because I have a flask http server for health check. Could it causing this problem? This sounds to me like a thread leak or something like this.
I don't think that the ways to use the Socket Mode adapter can be the cause this type of issues. Constructing say function object is thread-safe and we've never received this bug reports in the past. If you are fine to turn debug-level logging on, you may be able to see what is happening in your app - https://slack.dev/bolt-python/concepts#logging
I noticed this happens almost exclusively when bot talks simultaneously with more than one participant at a time. Maybe I did not configured it right?
I turned on debug mode, there are 3 msges in this conversation:
One of the weird thing I see is that say message["user"] (U03AHTQLN48) is different then the user the slack bot sends messages (U03AF3VEJ5N).
2022-06-17 13:39:25 INFO
say() to: user: U03AHTQLN48, channel: D039U5HPCEN
message: who is tali
Let's assume userA is the user the response here should go to, he's the initiator of this conversation.
userA asks: "who is tali"
the bot answers (say()) three messages:
- say() to userB.
- fetch data from db -> then say() it to userA.
- say() to userB.
expected: all the say() to be forwarded to userA()
Can I use multiple say() in the same message handler? Maybe that's the problem.
2022-06-17 13:39:25 DEBUG on_message invoked: (message: {"envelope_id":"1be1806e-b2f1-4598-bf2d-daf4d9061346","payload":{"token":"some_slack_token","team_id":"T039R2MU1DH","api_app_id":"A039NE8PMCM","event":{"client_msg_id":"e1ab6471-cbc6-45d5-94d6-0495b5fbd4cc","type":"message","text":"who is tali","user":"U03AHTQLN48","ts":"1655462364.931659","team":"T039R2MU1DH","blocks":[{"type":"rich_text","block_id":"VrGRA","elements":[{"type":"rich_text_section","elements":[{"type":"text","text":"who is tali"}]}]}],"channel":"D039U5HPCEN","event_ts":"1655462364.931659","channel_type":"im"},"type":"event_callback","event_id":"Ev03KP6H30EB","event_time":1655462364,"authorizations":[{"enterprise_id":null,"team_id":"T039R2MU1DH","user_id":"U03AF3VEJ5N","is_bot":true,"is_enterprise_install":false}],"is_ext_shared_channel":false,"event_context":"4-eyJldCI6Im1lc3NhZ2UiLCJ0aWQiOiJUMDM5UjJNVTFESCIsImFpZCI6IkEwMzlORThQTUNNIiwiY2lkIjoiRDAzOVU1SFBDRU4ifQ"},"type":"events_api","accepts_response_payload":false,"retry_attempt":0,"retry_reason":""})
2022-06-17 13:39:25 DEBUG A new message enqueued (current queue size: 1)
2022-06-17 13:39:25 DEBUG A message dequeued (current queue size: 0)
2022-06-17 13:39:25 DEBUG Message processing started (type: events_api, envelope_id: 1be1806e-b2f1-4598-bf2d-daf4d9061346)
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.ssl_check.ssl_check.SslCheck
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.request_verification.request_verification.RequestVerification
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.authorization.single_team_authorization.SingleTeamAuthorization
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.ignoring_self_events.ignoring_self_events.IgnoringSelfEvents
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.url_verification.url_verification.UrlVerification
2022-06-17 13:39:25 DEBUG Checking listener: message_handler ...
2022-06-17 13:39:25 DEBUG Running listener: message_handler ...
2022-06-17 13:39:25 DEBUG Responding with status: 200 body: "" (0 millis)
2022-06-17 13:39:25 DEBUG Sending a message (session id: 1f94d4ec-1616-49e4-a85a-d4d825a678ab, message: {"envelope_id": "1be1806e-b2f1-4598-bf2d-daf4d9061346"})
2022-06-17 13:39:25 INFO
say() to: user: U03AHTQLN48, channel: D039U5HPCEN
message: who is tali
2022-06-17 13:39:25 DEBUG Sending a request - url: https://www.slack.com/api/chat.postMessage, query_params: {}, body_params: {}, files: {}, json_body: {'channel': 'D03A3V5305P', 'blocks': [{'type': 'image', 'block_id': 'image4', 'image_url': 'https://res.cloudinary.com/lulusss/image/upload/c_scale,w_250/v1649280847/stalker_yqkf9b.png', 'alt_text': 'An incredibly cute kitten.'}, {'type': 'context', 'elements': [{'type': 'mrkdwn', 'text': 'Stalker Mode *ON*'}]}]}, headers: {'Content-Type': 'application/json;charset=utf-8', 'Authorization': '(redacted)', 'User-Agent': 'Bolt/1.14.0 Python/3.10.4 slackclient/3.15.2 Darwin/21.3.0'}
2022-06-17 13:39:25 DEBUG Response time: 23 milliseconds
2022-06-17 13:39:25 DEBUG Message processing completed (type: events_api, envelope_id: 1be1806e-b2f1-4598-bf2d-daf4d9061346)
2022-06-17 13:39:25 DEBUG Received the following response - status: 200, headers: {'date': 'Fri, 17 Jun 2022 10:39:25 GMT', 'server': 'Apache', 'x-powered-by': 'HHVM/4.153.1', 'access-control-allow-origin': '*', 'referrer-policy': 'no-referrer', 'x-slack-backend': 'r', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'access-control-allow-headers': 'slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags', 'access-control-expose-headers': 'x-slack-req-id, retry-after', 'x-oauth-scopes': 'im:history,im:read,im:write,chat:write,app_mentions:read,commands,channels:read,chat:write.public', 'x-accepted-oauth-scopes': 'chat:write', 'expires': 'Mon, 26 Jul 1997 05:00:00 GMT', 'cache-control': 'private, no-cache, no-store, must-revalidate', 'pragma': 'no-cache', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'x-slack-req-id': 'f6bed2927dc93d3b87c76a1d4f7a1924', 'vary': 'Accept-Encoding', 'content-type': 'application/json; charset=utf-8', 'x-envoy-upstream-service-time': '181', 'x-backend': 'main_normal main_bedrock_normal_with_overflow main_canary_with_overflow main_bedrock_canary_with_overflow main_control_with_overflow main_bedrock_control_with_overflow', 'x-server': 'slack-www-hhvm-main-iad-f2t9', 'x-slack-shared-secret-outcome': 'no-match', 'via': 'envoy-www-iad-jz71, envoy-edge-fra-8gol', 'x-edge-backend': 'envoy-www', 'x-slack-edge-shared-secret-outcome': 'no-match', 'connection': 'close', 'transfer-encoding': 'chunked'}, body: {"ok":true,"channel":"D03A3V5305P","ts":"1655462365.522759","message":{"bot_id":"B039JMBK9EJ","type":"message","text":"This content can't be displayed.","user":"U03AF3VEJ5N","ts":"1655462365.522759","app_id":"A039NE8PMCM","team":"T039R2MU1DH","bot_profile":{"id":"B039JMBK9EJ","app_id":"A039NE8PMCM","name":"CatBot","icons":{"image_36":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_36.png","image_48":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_72.png"},"deleted":false,"updated":1649275695,"team_id":"T039R2MU1DH"},"blocks":[{"type":"image","block_id":"image4","image_url":"https:\/\/res.cloudinary.com\/lulusss\/image\/upload\/c_scale,w_250\/v1649280847\/stalker_yqkf9b.png","alt_text":"An incredibly cute kitten.","image_width":250,"image_height":250,"image_bytes":4955,"is_animated":true,"fallback":"250x250px image"},{"type":"context","block_id":"ZNK","elements":[{"type":"mrkdwn","text":"Stalker Mode *ON*","verbatim":false}]}]}}
2022-06-17 13:39:25 DEBUG on_message invoked: (message: {"envelope_id":"d3be6e9f-e918-469b-a73e-8a07c9245d55","payload":{"token":"some_slack_token","team_id":"T039R2MU1DH","api_app_id":"A039NE8PMCM","event":{"bot_id":"B039JMBK9EJ","type":"message","text":"This content can't be displayed.","user":"U03AF3VEJ5N","ts":"1655462365.522759","app_id":"A039NE8PMCM","team":"T039R2MU1DH","bot_profile":{"id":"B039JMBK9EJ","deleted":false,"name":"CatBot","updated":1649275695,"app_id":"A039NE8PMCM","icons":{"image_36":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_36.png","image_48":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_72.png"},"team_id":"T039R2MU1DH"},"blocks":[{"type":"image","block_id":"image4","image_url":"https:\/\/res.cloudinary.com\/lulusss\/image\/upload\/c_scale,w_250\/v1649280847\/stalker_yqkf9b.png","alt_text":"An incredibly cute kitten.","image_width":250,"image_height":250,"image_bytes":4955,"is_animated":true,"fallback":"250x250px image"},{"type":"context","block_id":"ZNK","elements":[{"type":"mrkdwn","text":"Stalker Mode *ON*","verbatim":false}]}],"channel":"D03A3V5305P","event_ts":"1655462365.522759","channel_type":"im"},"type":"event_callback","event_id":"Ev03LTH0CTTJ","event_time":1655462365,"authorizations":[{"enterprise_id":null,"team_id":"T039R2MU1DH","user_id":"U03AF3VEJ5N","is_bot":true,"is_enterprise_install":false}],"is_ext_shared_channel":false,"event_context":"4-eyJldCI6Im1lc3NhZ2UiLCJ0aWQiOiJUMDM5UjJNVTFESCIsImFpZCI6IkEwMzlORThQTUNNIiwiY2lkIjoiRDAzQTNWNTMwNVAifQ"},"type":"events_api","accepts_response_payload":false,"retry_attempt":0,"retry_reason":""})
2022-06-17 13:39:25 DEBUG A new message enqueued (current queue size: 1)
2022-06-17 13:39:25 DEBUG A message dequeued (current queue size: 0)
2022-06-17 13:39:25 DEBUG Message processing started (type: events_api, envelope_id: d3be6e9f-e918-469b-a73e-8a07c9245d55)
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.ssl_check.ssl_check.SslCheck
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.request_verification.request_verification.RequestVerification
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.authorization.single_team_authorization.SingleTeamAuthorization
2022-06-17 13:39:25 DEBUG Applying slack_bolt.middleware.ignoring_self_events.ignoring_self_events.IgnoringSelfEvents
2022-06-17 13:39:25 DEBUG Skipped self event: {'bot_id': 'B039JMBK9EJ', 'type': 'message', 'text': "This content can't be displayed.", 'user': 'U03AF3VEJ5N', 'ts': '1655462365.522759', 'app_id': 'A039NE8PMCM', 'team': 'T039R2MU1DH', 'bot_profile': {'id': 'B039JMBK9EJ', 'deleted': False, 'name': 'CatBot', 'updated': 1649275695, 'app_id': 'A039NE8PMCM', 'icons': {'image_36': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_36.png', 'image_48': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_48.png', 'image_72': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_72.png'}, 'team_id': 'T039R2MU1DH'}, 'blocks': [{'type': 'image', 'block_id': 'image4', 'image_url': 'https://res.cloudinary.com/lulusss/image/upload/c_scale,w_250/v1649280847/stalker_yqkf9b.png', 'alt_text': 'An incredibly cute kitten.', 'image_width': 250, 'image_height': 250, 'image_bytes': 4955, 'is_animated': True, 'fallback': '250x250px image'}, {'type': 'context', 'block_id': 'ZNK', 'elements': [{'type': 'mrkdwn', 'text': 'Stalker Mode *ON*', 'verbatim': False}]}], 'channel': 'D03A3V5305P', 'event_ts': '1655462365.522759', 'channel_type': 'im'}
2022-06-17 13:39:25 DEBUG Sending a message (session id: 35743531-1d8a-4135-a6b5-bf5016f29e1d, message: {"envelope_id": "d3be6e9f-e918-469b-a73e-8a07c9245d55"})
2022-06-17 13:39:25 DEBUG Response time: 2 milliseconds
2022-06-17 13:39:25 DEBUG Message processing completed (type: events_api, envelope_id: d3be6e9f-e918-469b-a73e-8a07c9245d55)
2022-06-17 13:39:26 DEBUG Starting new HTTPS connection (1): someServer:443
2022-06-17 13:39:27 DEBUG https://someServer:443 "GET /v1/people/[email protected]?humanReadable=false&includeHumanReadable=false HTTP/1.1" 200 None
2022-06-17 13:39:27 DEBUG Starting new HTTPS connection (1): someServer:443
2022-06-17 13:39:27 DEBUG https://someServer:443 "GET /v1/people/[email protected]?humanReadable=false&includeHumanReadable=false HTTP/1.1" 200 None
2022-06-17 13:39:27 DEBUG Sending a request - url: https://www.slack.com/api/chat.postMessage, query_params: {}, body_params: {}, files: {}, json_body: {'channel': 'D039U5HPCEN', 'blocks': [{'type': 'section', 'text': {'type': 'mrkdwn', 'text': "*Is it Meeeeww you're looking for?*\n"}}, {'type': 'section', 'text': {'type': 'mrkdwn', 'text': '*Full name*: some name\n*Email*: [email protected]\n*Title*: Product Designer\n*Department*: some department\n*Manager*: name3 Miller\n'}, 'accessory': {'type': 'image', 'image_url': 'someimg2', 'alt_text': 'computer thumbnail'}}, {'type': 'section', 'text': {'type': 'mrkdwn', 'text': '*Full name*: name2\n*Email*: [email protected]\n*Title*: Account Manager\n*Department*: some department\n*Manager*: name4 Sherlag\n'}, 'accessory': {'type': 'image', 'image_url': 'imageurl', 'alt_text': 'computer thumbnail'}}]}, headers: {'Content-Type': 'application/json;charset=utf-8', 'Authorization': '(redacted)', 'User-Agent': 'Bolt/1.14.0 Python/3.10.4 slackclient/3.15.2 Darwin/21.3.0'}
2022-06-17 13:39:28 DEBUG Received the following response - status: 200, headers: {'date': 'Fri, 17 Jun 2022 10:39:28 GMT', 'server': 'Apache', 'x-powered-by': 'HHVM/4.153.1', 'access-control-allow-origin': '*', 'referrer-policy': 'no-referrer', 'x-slack-backend': 'r', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'access-control-allow-headers': 'slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags', 'access-control-expose-headers': 'x-slack-req-id, retry-after', 'x-oauth-scopes': 'im:history,im:read,im:write,chat:write,app_mentions:read,commands,channels:read,chat:write.public', 'x-accepted-oauth-scopes': 'chat:write', 'expires': 'Mon, 26 Jul 1997 05:00:00 GMT', 'cache-control': 'private, no-cache, no-store, must-revalidate', 'pragma': 'no-cache', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'x-slack-req-id': '447c1ef884e92b347699de658343d51b', 'vary': 'Accept-Encoding', 'content-type': 'application/json; charset=utf-8', 'x-envoy-upstream-service-time': '206', 'x-backend': 'main_normal main_bedrock_normal_with_overflow main_canary_with_overflow main_bedrock_canary_with_overflow main_control_with_overflow main_bedrock_control_with_overflow', 'x-server': 'slack-www-hhvm-main-iad-mkke', 'x-slack-shared-secret-outcome': 'no-match', 'via': 'envoy-www-iad-plfi, envoy-edge-fra-5qlb', 'x-edge-backend': 'envoy-www', 'x-slack-edge-shared-secret-outcome': 'no-match', 'connection': 'close', 'transfer-encoding': 'chunked'}, body: {"ok":true,"channel":"D039U5HPCEN","ts":"1655462368.095259","message":{"bot_id":"B039JMBK9EJ","type":"message","text":"This content can't be displayed.","user":"U03AF3VEJ5N","ts":"1655462368.095259","app_id":"A039NE8PMCM","team":"T039R2MU1DH","bot_profile":{"id":"B039JMBK9EJ","app_id":"A039NE8PMCM","name":"CatBot","icons":{"image_36":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_36.png","image_48":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_72.png"},"deleted":false,"updated":1649275695,"team_id":"T039R2MU1DH"},"blocks":[{"type":"section","block_id":"yQA","text":{"type":"mrkdwn","text":"*Is it Meeeeww you're looking for?*\n","verbatim":false}},{"type":"section","block_id":"8qc","text":{"type":"mrkdwn","text":"*Full name*: some name\n*Email*: <mailto:[email protected]|[email protected]>\n*Title*: Product Designer\n*Department*: BORA - R&D - Product - Product Management\n*Manager*: name3 Miller\n","verbatim":false},"accessory":{"type":"image","image_url":"https:\/\/someurl","alt_text":"computer thumbnail"}},{"type":"section","block_id":"Ptkdd","text":{"type":"mrkdwn","text":"*Full name*: name2\n*Email*: <mailto:[email protected]|[email protected]>\n*Title*: Account Manager\n*Department*: BORA - S&M - Performance - Demand\n*Manager*: name4 Sherlag\n","verbatim":false},"accessory":{"type":"image","image_url":"someimg","alt_text":"computer thumbnail"}}]}}
2022-06-17 13:39:28 DEBUG Sending a request - url: https://www.slack.com/api/chat.postMessage, query_params: {}, body_params: {}, files: {}, json_body: {'channel': 'D03A3V5305P', 'blocks': [{'type': 'section', 'text': {'type': 'mrkdwn', 'text': '*Can I help you with anything else?*'}}, {'type': 'actions', 'elements': [{'type': 'button', 'text': {'type': 'plain_text', 'text': 'Yes'}, 'style': 'primary', 'value': 'true', 'action_id': 'help_yes'}, {'type': 'button', 'text': {'type': 'plain_text', 'text': 'No'}, 'style': 'danger', 'value': 'false', 'action_id': 'help_no'}]}]}, headers: {'Content-Type': 'application/json;charset=utf-8', 'Authorization': '(redacted)', 'User-Agent': 'Bolt/1.14.0 Python/3.10.4 slackclient/3.15.2 Darwin/21.3.0'}
2022-06-17 13:39:28 DEBUG on_message invoked: (message: {"envelope_id":"c16bf249-fbdf-4a5b-a36d-ec67e34dfe7a","payload":{"token":"some_slack_token","team_id":"T039R2MU1DH","api_app_id":"A039NE8PMCM","event":{"bot_id":"B039JMBK9EJ","type":"message","text":"This content can't be displayed.","user":"U03AF3VEJ5N","ts":"1655462368.095259","app_id":"A039NE8PMCM","team":"T039R2MU1DH","bot_profile":{"id":"B039JMBK9EJ","deleted":false,"name":"CatBot","updated":1649275695,"app_id":"A039NE8PMCM","icons":{"image_36":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_36.png","image_48":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_72.png"},"team_id":"T039R2MU1DH"},"blocks":[{"type":"section","block_id":"yQA","text":{"type":"mrkdwn","text":"*Is it Meeeeww you're looking for?*\n","verbatim":false}},{"type":"section","block_id":"8qc","text":{"type":"mrkdwn","text":"*Full name*: some name\n*Email*: <mailto:[email protected]|[email protected]>\n*Title*: Product Designer\n*Department*: BORA - R&D - Product - Product Management\n*Manager*: name3 Miller\n","verbatim":false},"accessory":{"type":"image","image_url":"SOMEIMAGE","alt_text":"computer thumbnail"}},{"type":"section","block_id":"Ptkdd","text":{"type":"mrkdwn","text":"*Full name*: name2\n*Email*: <mailto:[email protected]|[email protected]>\n*Title*: Account Manager\n*Department*: BORA - S&M - Performance - Demand\n*Manager*: name4 Sherlag\n","verbatim":false},"accessory":{"type":"image","image_url":"SOMEIMG","alt_text":"computer thumbnail"}}],"channel":"D039U5HPCEN","event_ts":"1655462368.095259","channel_type":"im"},"type":"event_callback","event_id":"Ev03L66K9EPN","event_time":1655462368,"authorizations":[{"enterprise_id":null,"team_id":"T039R2MU1DH","user_id":"U03AF3VEJ5N","is_bot":true,"is_enterprise_install":false}],"is_ext_shared_channel":false,"event_context":"4-eyJldCI6Im1lc3NhZ2UiLCJ0aWQiOiJUMDM5UjJNVTFESCIsImFpZCI6IkEwMzlORThQTUNNIiwiY2lkIjoiRDAzOVU1SFBDRU4ifQ"},"type":"events_api","accepts_response_payload":false,"retry_attempt":0,"retry_reason":""})
2022-06-17 13:39:28 DEBUG A new message enqueued (current queue size: 1)
2022-06-17 13:39:28 DEBUG A message dequeued (current queue size: 0)
2022-06-17 13:39:28 DEBUG Message processing started (type: events_api, envelope_id: c16bf249-fbdf-4a5b-a36d-ec67e34dfe7a)
2022-06-17 13:39:28 DEBUG Applying slack_bolt.middleware.ssl_check.ssl_check.SslCheck
2022-06-17 13:39:28 DEBUG Applying slack_bolt.middleware.request_verification.request_verification.RequestVerification
2022-06-17 13:39:28 DEBUG Applying slack_bolt.middleware.authorization.single_team_authorization.SingleTeamAuthorization
2022-06-17 13:39:28 DEBUG Applying slack_bolt.middleware.ignoring_self_events.ignoring_self_events.IgnoringSelfEvents
2022-06-17 13:39:28 DEBUG Skipped self event: {'bot_id': 'B039JMBK9EJ', 'type': 'message', 'text': "This content can't be displayed.", 'user': 'U03AF3VEJ5N', 'ts': '1655462368.095259', 'app_id': 'A039NE8PMCM', 'team': 'T039R2MU1DH', 'bot_profile': {'id': 'B039JMBK9EJ', 'deleted': False, 'name': 'CatBot', 'updated': 1649275695, 'app_id': 'A039NE8PMCM', 'icons': {'image_36': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_36.png', 'image_48': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_48.png', 'image_72': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_72.png'}, 'team_id': 'T039R2MU1DH'}, 'blocks': [{'type': 'section', 'block_id': 'yQA', 'text': {'type': 'mrkdwn', 'text': "*Is it Meeeeww you're looking for?*\n", 'verbatim': False}}, {'type': 'section', 'block_id': '8qc', 'text': {'type': 'mrkdwn', 'text': '*Full name*: some name\n*Email*: <mailto:[email protected]|[email protected]>\n*Title*: Product Designer\n*Department*: BORA - R&D - Product - Product Management\n*Manager*: name3 Miller\n', 'verbatim': False}, 'accessory': {'type': 'image', 'image_url': 'SOMEIMG', 'alt_text': 'computer thumbnail'}}], 'channel': 'D039U5HPCEN', 'event_ts': '1655462368.095259', 'channel_type': 'im'}
2022-06-17 13:39:28 DEBUG Sending a message (session id: 35743531-1d8a-4135-a6b5-bf5016f29e1d, message: {"envelope_id": "c16bf249-fbdf-4a5b-a36d-ec67e34dfe7a"})
2022-06-17 13:39:28 DEBUG Response time: 1 milliseconds
2022-06-17 13:39:28 DEBUG Message processing completed (type: events_api, envelope_id: c16bf249-fbdf-4a5b-a36d-ec67e34dfe7a)
2022-06-17 13:39:28 DEBUG Received the following response - status: 200, headers: {'date': 'Fri, 17 Jun 2022 10:39:28 GMT', 'server': 'Apache', 'x-powered-by': 'HHVM/4.153.1', 'access-control-allow-origin': '*', 'referrer-policy': 'no-referrer', 'x-slack-backend': 'r', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'access-control-allow-headers': 'slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags', 'access-control-expose-headers': 'x-slack-req-id, retry-after', 'x-oauth-scopes': 'im:history,im:read,im:write,chat:write,app_mentions:read,commands,channels:read,chat:write.public', 'x-accepted-oauth-scopes': 'chat:write', 'expires': 'Mon, 26 Jul 1997 05:00:00 GMT', 'cache-control': 'private, no-cache, no-store, must-revalidate', 'pragma': 'no-cache', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'x-slack-req-id': '821f1df6045f948352e0cb4705d0a644', 'vary': 'Accept-Encoding', 'content-type': 'application/json; charset=utf-8', 'x-envoy-upstream-service-time': '148', 'x-backend': 'main_normal main_bedrock_normal_with_overflow main_canary_with_overflow main_bedrock_canary_with_overflow main_control_with_overflow main_bedrock_control_with_overflow', 'x-server': 'slack-www-hhvm-main-iad-5a1e', 'x-slack-shared-secret-outcome': 'no-match', 'via': 'envoy-www-iad-c13w, envoy-edge-fra-c7fz', 'x-edge-backend': 'envoy-www', 'x-slack-edge-shared-secret-outcome': 'no-match', 'connection': 'close', 'transfer-encoding': 'chunked'}, body: {"ok":true,"channel":"D03A3V5305P","ts":"1655462368.497929","message":{"bot_id":"B039JMBK9EJ","type":"message","text":"This content can't be displayed.","user":"U03AF3VEJ5N","ts":"1655462368.497929","app_id":"A039NE8PMCM","team":"T039R2MU1DH","bot_profile":{"id":"B039JMBK9EJ","app_id":"A039NE8PMCM","name":"CatBot","icons":{"image_36":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_36.png","image_48":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_72.png"},"deleted":false,"updated":1649275695,"team_id":"T039R2MU1DH"},"blocks":[{"type":"section","block_id":"DenW","text":{"type":"mrkdwn","text":"*Can I help you with anything else?*","verbatim":false}},{"type":"actions","block_id":"OQ0vt","elements":[{"type":"button","action_id":"help_yes","text":{"type":"plain_text","text":"Yes","emoji":true},"style":"primary","value":"true"},{"type":"button","action_id":"help_no","text":{"type":"plain_text","text":"No","emoji":true},"style":"danger","value":"false"}]}]}}
2022-06-17 13:39:29 DEBUG on_message invoked: (message: {"envelope_id":"6573b64d-ee9c-4d28-a1c9-0d685dcabd7c","payload":{"token":"some_slack_token","team_id":"T039R2MU1DH","api_app_id":"A039NE8PMCM","event":{"bot_id":"B039JMBK9EJ","type":"message","text":"This content can't be displayed.","user":"U03AF3VEJ5N","ts":"1655462368.497929","app_id":"A039NE8PMCM","team":"T039R2MU1DH","bot_profile":{"id":"B039JMBK9EJ","deleted":false,"name":"CatBot","updated":1649275695,"app_id":"A039NE8PMCM","icons":{"image_36":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_36.png","image_48":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_48.png","image_72":"https:\/\/avatars.slack-edge.com\/2022-04-06\/3351696054325_6abf084799920c5d182e_72.png"},"team_id":"T039R2MU1DH"},"blocks":[{"type":"section","block_id":"DenW","text":{"type":"mrkdwn","text":"*Can I help you with anything else?*","verbatim":false}},{"type":"actions","block_id":"OQ0vt","elements":[{"type":"button","action_id":"help_yes","text":{"type":"plain_text","text":"Yes","emoji":true},"style":"primary","value":"true"},{"type":"button","action_id":"help_no","text":{"type":"plain_text","text":"No","emoji":true},"style":"danger","value":"false"}]}],"channel":"D03A3V5305P","event_ts":"1655462368.497929","channel_type":"im"},"type":"event_callback","event_id":"Ev03L0SKTJH3","event_time":1655462368,"authorizations":[{"enterprise_id":null,"team_id":"T039R2MU1DH","user_id":"U03AF3VEJ5N","is_bot":true,"is_enterprise_install":false}],"is_ext_shared_channel":false,"event_context":"4-eyJldCI6Im1lc3NhZ2UiLCJ0aWQiOiJUMDM5UjJNVTFESCIsImFpZCI6IkEwMzlORThQTUNNIiwiY2lkIjoiRDAzQTNWNTMwNVAifQ"},"type":"events_api","accepts_response_payload":false,"retry_attempt":0,"retry_reason":""})
2022-06-17 13:39:29 DEBUG A new message enqueued (current queue size: 1)
2022-06-17 13:39:29 DEBUG A message dequeued (current queue size: 0)
2022-06-17 13:39:29 DEBUG Message processing started (type: events_api, envelope_id: 6573b64d-ee9c-4d28-a1c9-0d685dcabd7c)
2022-06-17 13:39:29 DEBUG Applying slack_bolt.middleware.ssl_check.ssl_check.SslCheck
2022-06-17 13:39:29 DEBUG Applying slack_bolt.middleware.request_verification.request_verification.RequestVerification
2022-06-17 13:39:29 DEBUG Applying slack_bolt.middleware.authorization.single_team_authorization.SingleTeamAuthorization
2022-06-17 13:39:29 DEBUG Applying slack_bolt.middleware.ignoring_self_events.ignoring_self_events.IgnoringSelfEvents
2022-06-17 13:39:29 DEBUG Skipped self event: {'bot_id': 'B039JMBK9EJ', 'type': 'message', 'text': "This content can't be displayed.", 'user': 'U03AF3VEJ5N', 'ts': '1655462368.497929', 'app_id': 'A039NE8PMCM', 'team': 'T039R2MU1DH', 'bot_profile': {'id': 'B039JMBK9EJ', 'deleted': False, 'name': 'CatBot', 'updated': 1649275695, 'app_id': 'A039NE8PMCM', 'icons': {'image_36': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_36.png', 'image_48': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_48.png', 'image_72': 'https://avatars.slack-edge.com/2022-04-06/3351696054325_6abf084799920c5d182e_72.png'}, 'team_id': 'T039R2MU1DH'}, 'blocks': [{'type': 'section', 'block_id': 'DenW', 'text': {'type': 'mrkdwn', 'text': '*Can I help you with anything else?*', 'verbatim': False}}, {'type': 'actions', 'block_id': 'OQ0vt', 'elements': [{'type': 'button', 'action_id': 'help_yes', 'text': {'type': 'plain_text', 'text': 'Yes', 'emoji': True}, 'style': 'primary', 'value': 'true'}, {'type': 'button', 'action_id': 'help_no', 'text': {'type': 'plain_text', 'text': 'No', 'emoji': True}, 'style': 'danger', 'value': 'false'}]}], 'channel': 'D03A3V5305P', 'event_ts': '1655462368.497929', 'channel_type': 'im'}
2022-06-17 13:39:29 DEBUG Sending a message (session id: 35743531-1d8a-4135-a6b5-bf5016f29e1d, message: {"envelope_id": "6573b64d-ee9c-4d28-a1c9-0d685dcabd7c"})
2022-06-17 13:39:29 DEBUG Response time: 3 milliseconds
2022-06-17 13:39:29 DEBUG Message processing completed (type: events_api, envelope_id: 6573b64d-ee9c-4d28-a1c9-0d685dcabd7c)
For now I noticed I can mitigate this by:
- with regular text responses and not blocks.
- using
client.chat_postMessageinstead ofsay().
I still want to solve it via bolt's say().
this is my hacky solution, to override say for the meantime:
def say(text):
client.chat_postMessage(channel=channel, blocks=text["blocks"])
any news on this?
Hi @nitz-iron, we are still unsure about the steps to reproduce your situation.
While bolt-python is now used by a large number of running apps, we've never received this feedback in the last two years since its v1 release. Also, I myself never experienced this although I wrote most of the code and have been using the framework for my personal Slack apps a lot. For these reasons, I am assuming that there may be a specific condition or step required for seeing the situation. Is it possible to ask you to provide a simpler version of your app that can reproduce the issue on our end? It'd be greatly appreciated if you can help us identify what the cause of your issue is here.
If you don't have time for it and you are fine with your workaround for now, please go ahead with your workaround.
Yes, I'll make a whitelabel version of my bot :) Thanks very much!
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.