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

Simple say() method call goes to "History" tab in Slack UI instead of "Chat" for Direct messages #1292

Open
vinupriyesh opened this issue Apr 3, 2025 · 2 comments

Comments

@vinupriyesh
Copy link

Reproducible in:

pip freeze | grep slack
python --version
sw_vers && uname -v # or `ver`
slack_bolt==1.23.0
slack_sdk==3.35.0
Python 3.12.7
ProductName:            macOS
ProductVersion:         15.3.1
BuildVersion:           24D70

The slack_bolt version

slack_bolt==1.23.0
slack_sdk==3.35.0

Python runtime version

Python 3.12.7

OS info

ProductName:            macOS
ProductVersion:         15.3.1
BuildVersion:           24D70
Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:24 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6030

Steps to reproduce:

@app.message("hello")
def message_hello(message, say):
    say(f"Hey there <@{message['user']}>!")
  1. Just create a simple hello world slack app with @app.message("hello") and call say() with some text
  2. It is sending the message back to the slack UI successfully, but it goes to "History" of the bot always.

Expected result:

I want the message to be sent to "Chat" tab. This is where the user is, it doens't make sense to put this new message to history.

Actual result:

The message is going to "History" tab of the Slack bot. This is happening only in the Direct message. Deleting the entire history, reinstalling the app in workspace, using that "+New Chat" button, nothing fixes it.

However, this is not happening in channels. Probably because there is no "History" tab in channel.

This is not just seen in Slack App UI, but in Chrome, Firefox as well.

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.

@zimeg zimeg added the need info label Apr 3, 2025
@zimeg
Copy link
Member

zimeg commented Apr 3, 2025

Hey @vinupriyesh 👋 Thanks for sharing this!

At the moment I'm finding a response in the Chat tab when using say, but this chat and message is also included in the app History tab for AI apps AFAICT and new chats can be created too.

Here's a reference app manifest I was using
{
    "display_information": {
        "name": "example-app-123"
    },
    "features": {
        "app_home": {
            "home_tab_enabled": true,
            "messages_tab_enabled": true,
            "messages_tab_read_only_enabled": false
        },
        "bot_user": {
            "display_name": "example-app-123",
            "always_online": false
        },
        "shortcuts": [
            {
                "name": "Run sample shortcut",
                "type": "global",
                "callback_id": "sample_shortcut_id",
                "description": "Runs a sample shortcut"
            }
        ],
        "slash_commands": [
            {
                "command": "/sample-command",
                "description": "Runs a sample command",
                "should_escape": false
            }
        ]
    },
    "oauth_config": {
        "scopes": {
            "bot": [
                "channels:history",
                "chat:write",
                "commands",
                "im:history",
                "assistant:write"
            ]
        }
    },
    "settings": {
        "event_subscriptions": {
            "bot_events": [
                "app_home_opened",
                "message.channels",
                "message.im",
                "assistant_thread_started",
                "assistant_thread_context_changed"
            ]
        },
        "interactivity": {
            "is_enabled": true
        },
        "org_deploy_enabled": true,
        "socket_mode_enabled": true,
        "token_rotation_enabled": false
    }
}

I'm curious if this is similar to what you're finding? I'm also wanting to confirm that the initial message is sent from the app Chat tab? This seems unexpected to me, but other details or logs or manifests you can share might be helpful!

@vinupriyesh
Copy link
Author

vinupriyesh commented Apr 4, 2025

thanks @zimeg,

In my case, it doesn't even show in "Chat" tab, and ONLY seen in "History" tab.

I suspect it is not able to link with the current thread. So, made some tests and found thread_ts working. See the following samples.

@app.message("hello")
def message_hello(message, client):
    client.chat_postMessage(channel=message['channel'],
                            text=f"Hey there <@{message['user']}>!",
                            thread_ts=message['thread_ts'] )

@app.message("alpha")
def message_hello(message, say):
    say(f"Hey there <@{message['user']}>, alpha!")

@app.message("beta")
def message_hello(message, say):
    say(text=f"Hey there <@{message['user']}>, beta!", thread_ts = message['thread_ts'])
  • hello -> Works fine. But if i remove the thread_ts, it doesn't.
  • alpha -> It only shows the message in history tab, not Chat tab.
  • beta -> Works fine.

Is there a possibility of issues with timezones? I can check the bolt source-code when I get some time to dive-deep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants