io.intents API
The Intents API for late-binding, action-based workflow orchestration.
register()
Dynamically register an intent handler. Intents can also be registered statically in the app definition JSON.
io.intents.register(intentName: string, handler: (context) => void): void
Example
io.intents.register("ViewChart", (context) => {
console.log("Instrument:", context.data.ticker);
});raise()
Raise an intent to be handled by a registered app. If multiple handlers exist, the Intent Resolver UI is shown.
io.intents.raise(request: IntentRequest): Promise<IntentResult>
| Parameter | Type | Description |
|---|---|---|
request.intentrequired | string | Intent name (e.g., "ViewChart"). |
request.contextrequired | object | Context data with type and id. |
request.target | string | "startNew" or "reuse". Omit to let the platform decide. |
Example
await io.intents.raise({
intent: "ViewChart",
context: {
type: "fdc3.instrument",
id: { ticker: "MSFT" },
},
target: "startNew",
});find()
Find all registered intent handlers for a given intent name.
io.intents.find(intentName: string): Promise<IntentHandler[]>