Skip to content

Commit 3b69a0c

Browse files
Rahul Subramaniamclaude
authored andcommitted
fix(slack): pass recipient_team_id and recipient_user_id to chat.startStream
Slack's streaming API (chat.startStream) requires recipient_team_id and recipient_user_id when streaming outside of DMs. Without these parameters, the API returns a missing_recipient_team_id error, causing the stream to fail entirely and no replies to be delivered. This adds optional teamId and userId parameters to StartSlackStreamParams and passes them through to client.chatStream() as recipient_team_id and recipient_user_id. The call site in dispatch.ts now supplies ctx.teamId (from auth.test) and message.user. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 2cd8200 commit 3b69a0c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/slack/streaming.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export type StartSlackStreamParams = {
3636
threadTs: string;
3737
/** Optional initial markdown text to include in the stream start. */
3838
text?: string;
39+
/** Team ID of the recipient (required for streaming outside DMs). */
40+
teamId?: string;
41+
/** User ID of the recipient (required for streaming outside DMs). */
42+
userId?: string;
3943
};
4044

4145
export type AppendSlackStreamParams = {
@@ -64,13 +68,15 @@ export type StopSlackStreamParams = {
6468
export async function startSlackStream(
6569
params: StartSlackStreamParams,
6670
): Promise<SlackStreamSession> {
67-
const { client, channel, threadTs, text } = params;
71+
const { client, channel, threadTs, text, teamId, userId } = params;
6872

6973
logVerbose(`slack-stream: starting stream in ${channel} thread=${threadTs}`);
7074

7175
const streamer = client.chatStream({
7276
channel,
7377
thread_ts: threadTs,
78+
...(teamId ? { recipient_team_id: teamId } : {}),
79+
...(userId ? { recipient_user_id: userId } : {}),
7480
});
7581

7682
const session: SlackStreamSession = {

0 commit comments

Comments
 (0)