Skip to main content
Call Workflows.defineWorkflowBlock in block.ts to declare a block’s stable identity, human-readable copy, and the configuration schema exposed to workspace members in the workflow editor. The export from block.ts is shared between client and server; it must not import client- or server-only code.

Parameters

type
"trigger" | "step"
required
Whether this block starts a workflow run ("trigger") or runs inline as part of one ("step").
id
string
required
Stable identifier for this block within your app. Used as the folder name under src/blocks/, to wire up handlers, and to reference the block from workflow definitions. Must be unique across all blocks in the app.
title
string
required
Human-readable label shown in the workflow editor’s block picker.
description
string
required
Short description shown alongside the title in the block picker.
configSchema
WorkflowBlockConfigFriendlyStruct
required
The configurable fields that configurator.tsx must render inputs for. Build this with Workflows.ConfigSchema, for example Workflows.ConfigSchema.struct({...}). The configSchema is also the source of truth for the typed config argument your handlers receive. See Config schema for all available node types.
requireUserConnection
boolean
default:"false"
Whether this block expects a workspace user to have a connection configured. Set to true for blocks that call third-party APIs on behalf of the user.
deprecated
true | {replacedBy: string}
Mark the block as deprecated. Pass {replacedBy: "other-block-id"} to point users at a successor block.

Example

block.ts
import {Workflows} from "attio"

export default Workflows.defineWorkflowBlock({
  type: "step",
  id: "send-welcome-email",
  title: "Send welcome email",
  description: "Send a welcome email to a newly-created contact.",
  configSchema: Workflows.ConfigSchema.struct({
    recipient_email: Workflows.ConfigSchema.string(),
    subject: Workflows.ConfigSchema.string(),
  }),
})

See also