Skip to content

feat(chat): add chat.thread() for creating thread handles#380

Merged
bensabic merged 2 commits intomainfrom
feat/thread-handle
Apr 14, 2026
Merged

feat(chat): add chat.thread() for creating thread handles#380
bensabic merged 2 commits intomainfrom
feat/thread-handle

Conversation

@bensabic
Copy link
Copy Markdown
Contributor

  • Add chat.thread(threadId) method to create a Thread handle from a thread ID outside of webhook contexts
  • Adapter is inferred from the thread ID prefix (e.g. slack:, teams:, gchat:)
  • Enables proactive messaging to existing threads (cron jobs, external triggers, etc.)
  • This was the missing piece for the "Using the adapter outside webhooks" docs example — getInstallation() and withBotToken() already exist
const install = await slackAdapter.getInstallation(teamId);
if (!install) throw new Error("Workspace not installed");

await slackAdapter.withBotToken(install.botToken, async () => {
  const thread = chat.thread("slack:C12345:1234567890.123456");
  await thread.post("Hello from a cron job!");
});
  • 4 new unit tests
  • Changeset: minor bump on chat

Closes #148

Allows constructing a Thread handle from a thread ID outside of webhook
contexts, enabling proactive messaging to existing threads.

Closes #148
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, Comment, Open in v0 Apr 14, 2026 5:08am
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Apr 14, 2026 5:08am

@bensabic bensabic merged commit 608d5f0 into main Apr 14, 2026
12 checks passed
@bensabic bensabic deleted the feat/thread-handle branch April 14, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to create thread handles

2 participants