Skip to content
Changelog

Report a bug

Slack

Slack can trigger both kinds of managed agent automation:

  • Instruction automation: map a Slack channel to a Space. The managed agent responds to Slack messages and follows your instructions.
  • Code automation: run TypeScript when someone posts, mentions Type, or adds a reaction in Slack. The code can reply in the Slack thread.

Use Slack as a trigger if your team already does most of its work in Slack.

  • Connect Slack in Type.
  • Invite the Type app to the Slack channel.

An instruction automation maps a Slack channel to a channel in a Space. Messages from Slack go into the correct Type context. The managed agent can post updates or respond in Slack.

  1. Open Space settings → Automations.
  2. Select the Slack channel.
  3. Select the Type channel for the work from that Slack channel.
  4. Select which Slack messages trigger a response from the managed agent. Use the table in the next section.
ModeUse when
@mentionsThe managed agent must stay quiet until someone asks for it.
Channel messagesNew posts and @mentions must trigger the managed agent.
Every messageThe managed agent must respond to channel posts and to thread replies.

To let people mention a Space-specific handle, for example @sales-operations, see Enable Slack User Groups for AI Mentions.

Tell the managed agent:

  • What the Slack channel is for.
  • Which messages are important.
  • When to reply in Slack.
  • When to create or update a Type thread in place of a Slack reply.

People can mention Type in a connected Slack channel. They can ask a question and continue their work in Slack.

The response can use the Space’s thread context, memory, skills, and approved connections. For example, a person in a Marketing Slack channel can ask about Shopify products. That person does not have to open a different tool or start from an empty prompt.

To stop a response that is in progress, add the 🛑 (:octagonal_sign:) or :stop: reaction. Add the reaction to your Slack message or to the reply from Type.

Type then keeps any partial response, clears the working status, and stops the active run.

Slack is frequently the easiest place to start. Map the Slack channels that your team uses now. Post useful updates there, and let people ask Type for help.

When the work needs more depth, open the linked thread in Type. There, the team has a dedicated place to prompt together and run work in parallel. The team can also examine tool calls and make documents or apps.

A code automation runs your TypeScript when a Slack event occurs. This example makes a code automation that replies in a Slack thread when a message contains a keyword.

  • Add the Slack connection to the Space.
  • Get the connection ID (orgint_...) and the Slack channel ID (C...). To get the channel ID, open the channel details in Slack.
src/main.ts
import {
type AutomationContext,
type AutomationDeployment,
replyInSlackThread,
type SlackMessageEvent,
} from "@type-dot-com/sdk/automations";
import { err } from "neverthrow";
const slack = "orgint_abc123"; // the Slack connection
export const deployment = {
subscriptions: {
onDeployFailed: {
title: "Answer deploy failures",
description: "Reply with the runbook link when a message reports a failed deploy",
source: {
kind: "integration",
connectionId: slack,
events: ["message"],
resources: { channel: ["C0123456789"] },
},
match: { "slack.message": { contains: "deploy failed" } },
},
},
} satisfies AutomationDeployment;
export default class {
async onDeployFailed(ctx: AutomationContext, event: SlackMessageEvent) {
const sent = await replyInSlackThread(ctx, event, {
connectionId: slack,
text: "Runbook: https://example.com/runbooks/deploys",
});
if (sent.isErr()) return err(sent.error);
return ctx.setOutput(sent.value);
}
}

How the example works:

  1. resources.channel limits the subscription to one channel.
  2. The slack.message matcher passes only messages that contain deploy failed. The match is case-sensitive.
  3. replyInSlackThread replies under the message. If the message is already in a thread, the reply goes in that thread.
  4. ctx.setOutput records where the reply went.
Goaleventsmatch key
New messages["message"]slack.message
Mentions of the Type app["app_mention"]slack.app_mention
A reaction was added["reaction_added"]slack.reaction_added
A reaction was removed["reaction_removed"]slack.reaction_removed
The app Home tab was opened["app_home_opened"]Omit match

For all options, see the Matchers reference.

By default, the slack.message matcher:

  • Includes messages from other bots.
  • Skips edits, deletions, and empty messages.

Type always drops messages that Type itself posted.

To change the default behavior:

  • To include edits, set includeEdits: true.
  • To skip bots, set includeBotMessages: false.
  • To select exact subtypes, set subtypes, for example [null, "bot_message"].
subscriptions: {
onApproved: {
title: "Start on approval",
description: "Run when someone adds a check mark",
source: { kind: "integration", connectionId: slack, events: ["reaction_added"] },
match: { "slack.reaction_added": { reactions: ["white_check_mark"] } },
},
},

The method gets an IntegrationEvent. Slack’s fields are in event.data: user, reaction, and item ({ type, channel, ts }). The event does not include the message text.

replyInSlackThread covers replies. For other Slack actions, find the tool. Then call it with ctx.read.call or ctx.write.call:

const tools = await ctx.tools.find({ service: "slack", organizationIntegrationId: slack });

See Call Connected Apps and APIs.

Type uses a large language model to generate responses. Its responses may be inaccurate, incomplete, or misleading. Review and verify important information before you rely on it or take action.

  • The Type app must be in the channel, and the Slack app must subscribe to the event.
  • eq and contains are case-sensitive. To match text with no case sensitivity, use match: { handler: "custom" } and check the text in code.
  • The local npm SDK can be older than the SDK in Type. If SlackMessageEvent or replyInSlackThread is missing on your computer, see SDK versions.