Skip to navigation

output

View as MarkdownOpen in Claude

Set the output for the most recently added webhook. The FunctionResult template is filled with response data after the API call succeeds.

Always set a fallbackOutput so the AI has something meaningful to say even when external APIs are unavailable.

Parameters

result
FunctionResultRequired

A FunctionResult defining the response template. Read the response’s fields from the root, such as ${current.temp_f}, and the function’s arguments as ${input.args.name}.

Returns

DataMap — Self for method chaining. Throws an Error if no webhook has been added yet.

Example

import { DataMap, FunctionResult } from '@signalwire/sdk';
const dm = new DataMap('get_weather');
dm.webhook('GET', 'https://api.weather.com/v1/current');
dm.output(new FunctionResult('The weather is ${current.condition.text}.'));