Skip to main content

Custom blocks

:::info Importing custom blocks is currently disabled You can't upload your own block definitions to Blokkio right now. The import endpoint (POST /api/projects/{projectId}/blocks/import) returns 501 Not Implemented with the problem type block-import-not-implemented, and the app hides the import option.

Imported block manifests could be stored, but the workflow engine had no way to run them, so such blocks would always fail. Import stays switched off until there is a proper runtime for third-party blocks. :::

What to use instead​

  • Custom apps are the recommended way to add a REST service. You describe the HTTP API as data in the custom app builder (base URL, sign-in, default headers, and declarative actions and polling triggers, validated when you save), and one generic runtime runs it: actions as App Action nodes, triggers through the App Trigger. Your actions show up in the toolbox like those of the official apps. No code is uploaded. The format is described in the App manifest reference.
  • Building blocks package reusable workflow logic. Build a workflow with typed inputs and outputs, publish it as a versioned building block, and drop it into other workflows like any other step. Integrations can declare connection slots, so each consumer uses their own credentials. See Creating a building block.
  • HTTP Request with a connection covers one-off calls. The connection handles auth (OAuth2, API key, bearer, basic), and with an app's base URL the node takes a relative path.
  • Code runs your own JavaScript inside a workflow for custom transformations.

What's not available yet​

Custom apps cover declarative REST actions and polling triggers. Uploading your own block code is still disabled (see above), and there is no runtime for third-party block code.

Support for the Model Context Protocol (MCP), both as a server exposing your workflows as tools and as a client for calling MCP tools, is planned but not available. The MCP connection kind is reserved: creating a custom app of that kind is rejected with "MCP connections are not supported yet."

For contributors: how core blocks are built​

All built-in blocks live in the Blokkio backend repository. A block has three parts:

  1. A GUID that identifies the block.
  2. A handler that runs on the worker.
  3. A definition (manifest) that tells the editor how to show and configure it.

The example below is the real Limit block, slightly shortened.

1. Add the GUID​

In Blokkio.Core/Common/Enums/SystemBlockMap.cs:

public static readonly Guid Limit = Guid.Parse("e6084993-050f-4f49-95fc-7f9d4cd9d4c9");

Always use a new UUID. Never reuse one, because saved workflows reference blocks by this id.

2. Write the handler​

Handlers live in Worker/Blokkio.Worker.Application/NodeHandlers/Nodes/. The [NodeDefinition] attribute is found by an assembly scan at startup (NodeHandlerScanner), so you don't register handlers by hand. The worker looks up the handler by the GUID in Identifier.

[NodeDefinition(Identifier = "e6084993-050f-4f49-95fc-7f9d4cd9d4c9", Name = "Limit")]
public class LimitHandler : INodeExecutor
{
public async ValueTask<NodeExecutionResult> ExecuteAsync(INodeContext context, CancellationToken ct)
{
// Resolves the "input" parameter (the array to work on) and fails cleanly if it isn't an array.
var (items, error) = await Items.ReadAsync(context, "Limit");
if (error is not null) return error;

// Parameter helpers resolve expressions and never throw on missing values.
var max = await context.GetIntAsync("maxItems", 10, min: 0);
var offset = await context.GetIntAsync("offset", 0, min: 0);

string keep;
try { keep = await context.GetOptionAsync("keep", "first", "first", "last"); }
catch (ArgumentException ex) { return NodeExecutionResult.Failure($"Limit: {ex.Message}"); }

var result = keep == "last"
? items!.Take(Math.Max(0, items!.Count - offset)).TakeLast(max).ToList()
: items!.Skip(offset).Take(max).ToList();

return Items.Output(result, ("total", (long)items.Count));
}
}

A handler implements INodeExecutor (untyped, read parameters from the context as above) or INodeExecutor<TModel>, which binds parameters to a model class first. It returns a NodeExecutionResult:

FactoryEffect
NodeExecutionResult.Success(output)Continue on all outgoing edges.
NodeExecutionResult.Success(port, output)Continue only on the named output port (branching blocks).
NodeExecutionResult.Failure(message)Fail the node. The engine then follows error ports and retries.

Return Failure for expected problems (bad input, missing parameter) instead of throwing, so users get a clear message in the logs.

Shared helpers in Worker/Blokkio.Worker.Application/NodeHandlers/Common/:

  • context.GetStringAsync, GetBoolAsync, GetIntAsync, GetOptionAsync: typed parameter reads.
  • Items.ReadAsync / Items.Output: array input and output for item-oriented blocks.
  • ConditionEvaluator: the typed conditions shared by If/Else, Filter and Switch.
  • DataConvert: path access and type coercion.

3. Write the definition​

Definitions implement ISystemBlockDefinition and live in Blokkio.Infrastructure/Engine/Blocks/Definitions/. The manifest drives the editor: toolbox entry, parameter form and ports.

internal class LimitBlockDefinition : ISystemBlockDefinition
{
public Guid Id => SystemBlockMap.Limit;
public BlockType Type => BlockType.Standard;

public BlockManifest Manifest => new()
{
DisplayName = "Limit",
Description = "Keep only the first or last N items.",
Version = "1.0.0",
Category = "Data",
Icon = CoreBlockIcons.Limit,
Inputs = ItemPorts.MainInput,
Outputs = ItemPorts.ItemsOutput(new PortSchemaEntry { Name = "total", Type = PortSchemaType.Number }),
Properties =
[
ItemPorts.InputArray(),
new() { Name = "maxItems", DisplayName = "Max items", Type = PropertyType.Number, Required = true, DefaultValue = 10 },
new()
{
Name = "keep", DisplayName = "Keep", Type = PropertyType.Options, DefaultValue = "first",
Options = [new() { Name = "First items", Value = "first" }, new() { Name = "Last items", Value = "last" }]
},
new() { Name = "offset", DisplayName = "Skip", Type = PropertyType.Number, DefaultValue = 0 }
]
};
}

Then register it in Blokkio.Infrastructure/DependencyConfiguration.cs, inside AddCommonInfrastructure:

builder.Services.AddSingleton<ISystemBlockDefinition, LimitBlockDefinition>();

Manifest reference​

Manifest fieldDescription
DisplayNameName shown in the toolbox and on the canvas.
DescriptionOne-line description in the toolbox.
CategoryToolbox group, for example Data.
IconSVG markup or URL.
VersionSemver string. Saved nodes pin a version. An unknown version only falls back within the same major version.
PropertiesThe parameters shown in the node panel.
Inputs / OutputsPorts. main is the default path. Branching blocks use named ports such as true/false.

Property (BlockProperty) fields:

FieldDescription
NameKey the handler reads, for example maxItems.
DisplayNameLabel in the node panel.
TypeA PropertyType (see below).
RequiredWhether the editor requires a value.
DefaultValueValue used when the user sets nothing.
PlaceholderHint text in the input.
OptionsChoices (name and value) for Options properties.
DisplayOptionsShow or hide the property based on another property's current value.
DataSourceLoad an Options list from a URL at design time.
LanguageEditor language for Code properties.
MultilineString properties: long text (a message, a prompt, a body) in a multi-line field.

PropertyType values: String, Number, Boolean, Options, Collection, DateTime, Connection, Secret, Cron, File, TransformTree, Timezone, Code. String parameters support expressions such as {{ $nodes['HTTP Request'].body.id }}. Code properties are shown in a code editor and are never expression-evaluated.

Tests​

Block tests live in tests/Blokkio.Blocks.Tests in the backend repository. Add tests for the handler's behaviour, including the failure messages, alongside the existing blocks.