***

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

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

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

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

Set the request body for the most recently added webhook. Used for POST/PUT
requests. Writes to the `body` key of the webhook definition.

<Warning>
  `body()` and [`params()`][params] write to different keys in the webhook
  specification: `body` sets the request body, while `params` sets
  query/form parameters.
</Warning>

## **Parameters**

<ParamField path="data" type={"Record<string, unknown>"} required={true} toc={true}>
  Request body data. Supports `${variable}` substitutions.
</ParamField>

## **Returns**

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

## **Example**

```typescript {10}
import { DataMap, FunctionResult } from '@signalwire/sdk';

const search = new DataMap('search_docs');
search
  .purpose('Search documentation')
  .parameter('query', 'string', 'Search query', { required: true })
  .webhook('POST', 'https://api.docs.example.com/search', {
    headers: { Authorization: 'Bearer TOKEN' },
  })
  .body({ query: '${args.query}', limit: 3 })
  .output(new FunctionResult('Found: ${response.results[0].title}'));
```