Build for SlackBuilder's Special

Building Workflows

Building Slack Workflows

Workflows turn routine work into a few clicks. Anyone in a workspace can build a workflow in Workflow Builder — your job, as an API developer, is to give them powerful custom steps and triggers they can drop into those workflows.

A workflow is a sequence of automated actions in Slack. It starts with a trigger (a message shortcut, a scheduled time, a webhook from an external system) and runs a series of steps (post a message, open a form, call an external service, fork on a condition).

Custom workflow steps and triggers are what let your API show up natively inside other people's automations.


When to Build a Workflow

Good fit

Repetitive multi-step processes: onboarding a new hire, triaging a bug report, requesting time off, approving an expense, escalating an incident.

Bad fit

Real-time conversations, long-running stateful chats, anything that needs more than a handful of branching steps. For those, build a bot instead.


The Three Building Blocks

A trigger is how a workflow starts. Built-in triggers cover message shortcuts and schedules; custom link triggers and webhook triggers let external systems kick off workflows over HTTP.


Quickstart: Trigger a Workflow from Code

The simplest custom workflow integration is a webhook trigger — your code posts JSON to a Slack URL and a workflow runs.

1. Create the trigger in Workflow Builder

In your workspace, open Workflow Builder → New Workflow → start from a webhook trigger. Slack gives you a URL like:

https://hooks.slack.com/triggers/T0123/4567/abc...

2. Define the inputs

Add the variables your trigger will accept (e.g., incident_id, severity, summary). These become available to every downstream step.

3. Fire it from your code

curl -X POST "$SLACK_TRIGGER_URL" \
  -H "Content-Type: application/json" \
  --data '{
    "incident_id": "INC-4821",
    "severity":    "high",
    "summary":     "Checkout latency spiked to 12s"
  }'

The workflow runs every time you POST — opening an incident channel, paging the on-call, posting a status — without any code on the Slack side beyond what you dragged into Workflow Builder.


Publishing Custom Steps for Workflow Builder

Once you have an SDK installed, you can publish custom functions that appear as draggable steps inside Workflow Builder. The pattern is:

Declare the function name, a human-readable title, and a typed schema for its inputs and outputs.

A minimal custom step declares its inputs, outputs, and handler. The shape is the same across languages — what changes is how you express the schema.

import { DefineFunction, Schema } from 'slack-apimatic-sdk/workflows';

export const CreateTicketFunction = DefineFunction({
  callback_id: 'create_ticket',
  title: 'Create Support Ticket',
  source_file: 'functions/create_ticket.ts',
  input_parameters: {
    properties: {
      subject:  { type: Schema.types.string },
      reporter: { type: Schema.slack.types.user_id },
      priority: {
        type: Schema.types.string,
        enum: ['low', 'medium', 'high', 'urgent'],
      },
    },
    required: ['subject', 'reporter', 'priority'],
  },
  output_parameters: {
    properties: {
      ticket_id:  { type: Schema.types.string },
      ticket_url: { type: Schema.types.string },
    },
    required: ['ticket_id', 'ticket_url'],
  },
});

The handler implements the business logic — call your backend, return the ticket ID and URL — and Slack handles input collection, output passing, and error display.


Patterns That Work Well

Incident response

A webhook trigger opens a dedicated channel, invites the on-call, posts a Block Kit summary, and starts a recording.

Approval flows

A shortcut trigger opens a form, sends the request to a manager via DM with Approve/Reject buttons, and routes the outcome back.

Scheduled digests

A daily trigger runs a step that queries your API for yesterday's metrics and posts a Block Kit summary to a channel.

Cross-tool handoffs

A workflow that takes a Slack message, creates a ticket in your system, and posts the link back in a thread reply.


Workflows vs. Bots vs. Webhooks


Next Steps

On this page