bolt-python icon indicating copy to clipboard operation
bolt-python copied to clipboard

chat_stream ignores username and icon_url override parameters (works in chat_postMessage)

Open scosenza opened this issue 1 month ago • 2 comments

Reproducible in:

slack-bolt==1.27.0 slack-sdk==3.38.0 Python 3.12.x

Steps to reproduce:

I'm currently using the new Slack chat_stream API to create an internal Slack bot for Airbnb employees. To repro this issue:

  1. Create a Slack bot app with the necessary scopes (chat:write, chat:write.customize)
  2. Send a message using chat.postMessage with username and icon_url parameters - observe that the message displays with the custom username and icon
  3. Send a streaming message using chat_stream with the same username and icon_url parameters - observe that the message displays with the bot's default name/icon instead

Working call (chat.postMessage):

from slack_sdk.web.async_client import AsyncWebClient
client = AsyncWebClient(token="xoxb-...")
# This works - message displays as "Claude Code" with custom icon
response = await client.chat_postMessage(
channel="C1234567890",
thread_ts="1234567890.123456",
text="Hello from Claude Code!",
username="Claude Code",
icon_url="https://claude.ai/images/claude_app_icon.png",
)

Non-working call (chat_stream):

from slack_sdk.web.async_client import AsyncWebClient
client = AsyncWebClient(token="xoxb-...")
# This does NOT work - message displays with bot's default name, ignoring overrides
streamer = await client.chat_stream(
channel="C1234567890",
thread_ts="1234567890.123456",
username="Claude Code",
icon_url="https://claude.ai/images/claude_app_icon.png",
)
await streamer.append(markdown_text="Hello from Claude Code!")
await streamer.stop()

Expected result:

When passing username and icon_url (or icon_emoji) to chat_stream, the streaming message should display with the custom username and icon, just like chat.postMessage does.

The underlying chat.postMessage.stream API should support these parameters since regular chat.postMessage does.

Actual result:

The username and icon_url parameters are silently ignored when passed to chat_stream. The message displays with the bot's default identity (the name/icon configured in the Slack app settings) instead of the custom values.

This makes it impossible to use persona overrides (showing different display names/icons for different agents in a multi-agent bot) with the streaming API.

scosenza avatar Dec 04 '25 03:12 scosenza

Hi there,

The chat_stream utility method doesn't accept those params as the underlying API methods don't support them

We'll take this to the team as a feature request; thanks for bringing this up!

vegeris avatar Dec 04 '25 22:12 vegeris

Hi @scosenza,

I just checked with the team behind the chat streaming API methods. They're aware of this issue and preparing to rollout an update that supports both username and icon_url. This is a fix that must be rolled out to all of Slack's surfaces (API, Web, iOS, and Android) and it should land on the API/Web first.

We'll keep this issue open and drop a comment when we see it's been released.

mwbrooks avatar Dec 05 '25 00:12 mwbrooks