Skip to main content

Creating a building block

Before you start​

The workflow you turn into a building block must:

  1. Start with a Building block inputs trigger. Apart from a Manual trigger for testing, it can't contain any other trigger (webhook, schedule, etc.).
  2. End with a Building block output step that returns the result.
  3. Be published at least once.

Building the workflow​

1. Add the Building block inputs trigger​

In the step list, add Building block inputs as the first step. Open it and define the Input fields callers will fill in:

SettingDescription
Field keyName used in expressions, e.g. channelId
Display nameLabel shown to callers, e.g. Channel ID
TypeString, Number, Boolean or Connection
RequiredWhether the caller must provide a value
Connection type (slot)For Connection fields only: the app the caller's connection must be created from

These fields are the building block's inputs. They are saved with each version you publish.

2. Add your steps​

Build the workflow as usual. Read the caller's inputs with $inputs:

{{ $inputs.channelId }}

Only declared fields are passed in. The building block never sees the caller's other data.

3. Use connection slots for credentials​

Don't put your own credentials in a building block: it runs in the caller's project, so it can't use your connections or secrets anyway. Add a Connection input field instead, for example slack, and choose the connection type it expects. In the workflow, use {{ $inputs.slack }} as the Authorization of the HTTP Request step that calls the service.

Each caller then picks one of their own connections for that slot. If you chose a connection type, the caller's connection must be created from that app. Otherwise the run fails with The connection bound to 'Slack' is not of the type this building block expects.

4. Add the Building block output step​

Add a Building block output step at the end and set its Output to the value to return, usually an expression:

{{ $nodes['Post message'].body }}

5. Publish the workflow​

Publish the workflow. You pick one of its published versions when you publish a building block version.

Registering the building block​

Go to Building blocks → Yours and click New building block.

FieldRequiredDescription
WorkflowYesThe workflow to share. A workflow can back only one building block.
NameYesName shown in Browse and the step list, e.g. Send Slack message
DescriptionNoWhat the building block does
CategoryNoGroups the building block in Browse filters and the step list
VisibilityYesPrivate, Organization or Public. See visibility.

You can change the name, description, category and visibility later with Edit details. Creating and editing building blocks requires the Administrator or Contributor role.

Next, publish a version so others can add it.