***

title: output
slug: /reference/typescript/agents/data-map/output
description: Set the output template for a webhook.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[functionresult]: /docs/server-sdks/reference/typescript/agents/function-result

[ref-datamap]: /docs/server-sdks/reference/typescript/agents/data-map

[fallback-output]: /docs/server-sdks/reference/typescript/agents/data-map/fallback-output

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

<Tip>
  Always set a [`fallbackOutput`][fallback-output] so the AI has something meaningful
  to say even when external APIs are unavailable.
</Tip>

## **Parameters**

<ParamField path="result" type="FunctionResult" required={true} toc={true}>
  A FunctionResult defining the response template. Use `${response.field}` to
  reference API response fields.
</ParamField>

## **Returns**

[`DataMap`][ref-datamap] -- Self for method chaining. Throws an `Error` if no webhook has been
added yet.

## **Example**

```typescript {5}
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 ${response.current.condition.text}.'));
```