Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bots with Agents & Assistants may trigger the same event multiple times. #1206

Open
tatsuyainui-opt opened this issue Nov 26, 2024 · 4 comments
Labels
question Further information is requested server-side Server-sider issue with the Slack Platform or Slack API

Comments

@tatsuyainui-opt
Copy link

I created a ChatBot using the Agents & Assistants functionality, but multiple events are triggered for one message under the following conditions. (We have confirmed this with other bots already published on the marketplace)
The headers of these events did not include X-Slack-Retry-Num.

Is there a way to resolve this issue?

Reproducible in:

It seems to occur for messages that meet the following conditions:

1. First message from user
2. Long Japanese message

Example:

こんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちは

The slack_bolt version

slack_bolt==1.21.2

Python runtime version

Python 3.12.6

OS info

ProductName:		macOS
ProductVersion:		14.6.1
BuildVersion:		23G93
Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112

Steps to reproduce:

code

app = App(
    signing_secret=signing_secret,
    token=token,
)

assistant = Assistant()

@assistant.user_message
def respond_in_assistant_thread(
    set_status,
    say,
):
    set_status("is typing...")

    say("This is a test message")


app.assistant(assistant)
  1. Start App
  2. Send the following message in a new chat
こんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちはこんにちは

Expected result:

"This is a test message" will only be sent once.

Actual result:

"This is a test message" will be sent multiple times.

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

@seratch seratch added the question Further information is requested label Dec 2, 2024
@seratch
Copy link
Member

seratch commented Dec 2, 2024

Hi @tatsuyainui-opt, thank you for writing in. Unfortunately, there isn't a way for custom apps to prevent this behavior. When a user posts an exceptionally long message to Slack, it can be split into multiple messages. This may result in multiple different message events being delivered to your app.

As a workaround, your app might want to use the conversations.replies API w/ channel_id and thread_ts. This way, your app can identify messages that serve a single purpose. I understand this isn't ideal, but I hope it helps.

@seratch seratch added the server-side Server-sider issue with the Slack Platform or Slack API label Dec 2, 2024
@tatsuyainui-opt
Copy link
Author

Hi @seratch, thank you for your reply. I understand that the issue is related to the server side of the custom app.
I have an additional question:

Q: The events text is not split and contains the complete user message. Therefore, I don't see a need to send different events. Will this behavior ever change in the future?

As a workaround, your app might want to use the conversations.replies API w/ channel_id and thread_ts.

Yes, thank you! I am currently using that, but I still like the custom app and hope to use it again someday.

@seratch
Copy link
Member

seratch commented Dec 2, 2024

The events text is not split and contains the complete user message. Therefore, I don't see a need to send different events. Will this behavior ever change in the future?

If this happens, that's a differen scenario than what I mentioned above, and I don't have any information about it. Could you contact our customer support team instead? They can check Slack's server side logs to identify what's happening with your app.

@tatsuyainui-opt
Copy link
Author

Understood. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested server-side Server-sider issue with the Slack Platform or Slack API
Projects
None yet
Development

No branches or pull requests

2 participants