Skip to main content
Use platform narrowing when you need Slack-specific space and message fields.

Starting a conversation

Resolve a user by their Slack user ID and open a space. Pass teamId as a space parameter to target a specific workspace:
const sl = slack(app);
const user = await sl.user("U0123456789");
const space = await sl.space.create(user, { teamId: "TEAM_ID" });

await space.send("Hello from Spectrum.");

Space properties

Slack spaces carry a teamId field indicating which workspace the conversation belongs to. Access it through narrowing:
for await (const [space, message] of app.messages) {
  if (message.platform !== "Slack") continue;
  const slackSpace = slack(space);
  console.log(slackSpace.teamId);
}

Message extras

Narrowed Slack messages expose additional fields:
FieldTypeDescription
isFromMebooleanWhether the message was sent by the bot.
subtypestring (optional)Slack message subtype, such as "bot_message".
threadTsstring (optional)Thread timestamp if the message is in a thread.
tsstring (optional)Message timestamp.

Supported features

FeatureSupport
Text messagesSend and receive
MarkdownSend, rendered as Slack mrkdwn
Media, files, and imagesSend and receive
ReactionsSend and receive
Threaded repliesSend and receive
Typing indicatorsSend
Message editsSend and receive