***

title: webhook_expressions
slug: /reference/python/agents/data-map/webhook-expressions
description: Add post-processing expressions for a webhook response.
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/python/agents/data-map

Add expressions that run after the most recently added webhook completes.
Allows conditional output based on the API response.

## **Parameters**

<ParamField path="expressions" type="list[dict[str, Any]]" required={true} toc={true}>
  List of expression definitions to evaluate against the webhook response.
</ParamField>

## **Returns**

[`DataMap`][ref-datamap] -- Self for method chaining. Raises `ValueError` if no webhook has been
added yet.

## **Example**

```python {8}
from signalwire import AgentBase, DataMap

status_check = (
    DataMap("check_status")
    .purpose("Check service status")
    .parameter("service", "string", "Service name", required=True)
    .webhook("GET", "https://api.example.com/status/${enc:args.service}")
    .webhook_expressions([
        {
            "string": "${response.status}",
            "pattern": "healthy",
            "output": {"response": "Service ${args.service} is running normally."}
        },
        {
            "string": "${response.status}",
            "pattern": "degraded|down",
            "output": {"response": "Service ${args.service} is experiencing issues."}
        }
    ])
)

agent = AgentBase(name="status-agent")
agent.set_prompt_text("You are a helpful assistant.")
agent.register_swaig_function(status_check.to_swaig_function())

if __name__ == "__main__":
    agent.run()
```