Defining actions
An action exposes a task in the Bird editor. Design the task around the user’s result; one action can combine several provider requests when that makes the Bird easier to configure.
A complete action example
Section titled “A complete action example”This example accepts text and an optional prefix, then returns the combined text. It makes no external requests. It compiles with .NET 8 and Blackbird.Applications.Sdk.Common 2.17.0 using the project file from Setup.
using Blackbird.Applications.Sdk.Common;using Blackbird.Applications.Sdk.Common.Actions;using Blackbird.Applications.Sdk.Common.Invocation;
namespace Apps.YourApp;
[ActionList]public class TextActions : BaseInvocable{ public TextActions(InvocationContext invocationContext) : base(invocationContext) { }
[Action("Prefix text", Description = "Add an optional prefix to text")] public TextResult PrefixText([ActionParameter] PrefixTextRequest request) { return new TextResult { Text = (request.Prefix ?? string.Empty) + request.Text }; }}
public class PrefixTextRequest{ [Display("Text", Description = "The text to return")] public string Text { get; set; } = string.Empty;
[Display("Prefix", Description = "Text to place before the input")] public string? Prefix { get; set; }}
public class TextResult{ [Display("Text", Description = "The combined text")] public string Text { get; set; } = string.Empty;}Discovery, inputs, and outputs
Section titled “Discovery, inputs, and outputs”| SDK element | What appears in Blackbird |
|---|---|
[ActionList] |
A class containing discoverable actions |
[Action] |
An action’s display name and description |
[ActionParameter] |
Method inputs; a request model exposes its properties |
[Display] |
A user-facing field name and description |
| Return model | Outputs available to later Bird steps |
Action methods can be synchronous, as above, or asynchronous when they perform I/O. Return the actual result of the operation; use Task<T> and await when calling an asynchronous client.
Keep published method names stable. Renaming a method can be interpreted as removing one action and adding another, which affects existing Birds.
Optional inputs
Section titled “Optional inputs”Prefix is optional because it is nullable. Text is required. Handle missing optional values in the action rather than passing null into a provider request that rejects it.
Use [DefinitionIgnore] on internal model properties that should not appear as Bird inputs or outputs. Keep credentials and internal diagnostic details out of output models.
Invocation context and connections
Section titled “Invocation context and connections”Blackbird supplies InvocationContext when it creates a BaseInvocable subclass. Use its AuthenticationCredentialsProviders to construct the provider client for that invocation. Do not retain one customer’s credentials in a static client shared across invocations.
An AppInvocable class in an App repository is an App-owned helper, not a type supplied by the common SDK. If you use one, include its implementation and constructor. See Connections for credential fields and validation.
Check the action
Section titled “Check the action”Build the project, then test the method with text and with the prefix omitted. After adding the remaining App implementations and deploying, add Prefix text to a Bird and inspect its output in a Flight. For input website and prefix Welcome to our followed by a space, the output should be Welcome to our website.
For provider calls, also test invalid input, rejected credentials, and provider failures. Use the error categories to give the user a useful next step.