Recipes← all recipesView on GitHub

Let a voice AI agent call an API without your server

AI Agentsserverless API integration for voice AI

SignalWire makes the API call, so no service of yours is in the tool path.

datamapserverless

The claim

A tool that reaches a third-party API with no service of yours in the tool path. The HTTP request, the response template and the failure path are fields in the document SignalWire runs, so there is no handler and no callback URL.

Why it holds

A normal tool gives the platform a URL to call back to. A DataMap tool gives it the request to make instead. The document itself still has to be served from somewhere. The Python surface below hosts it, and the SWML surface can be pasted into a hosted SWML Script so nothing of yours runs at all.

How it works

DataMap builds a function definition whose body is a data_map rather than a url. ${args.x} is substituted into the request before it is sent; ${response.x} reads the parsed JSON body on the way back.

DataMap("look_up_book")
    .parameter("isbn", "string", "The 10 or 13 digit ISBN.", required=True)
    .webhook("GET", "https://openlibrary.org/isbn/${args.isbn}.json")
    .output(FunctionResult("ISBN ${args.isbn} is ${response.title}."))
    .error_keys(["error"])
    .fallback_output(FunctionResult("I could not reach the book catalogue."))

Where each result lands is the part worth reading twice. .output() attaches to the webhook directly above it, so a chain of webhooks each carry their own. Only .fallback_output() sits at the top of the data_map, and it is spoken when every webhook has failed. .error_keys() names the JSON keys whose presence means failure even though the request returned 200.

Limitations

Templating is the only transform available. There is no place to put a conditional or a unit conversion, so an API whose response needs reshaping wants a normal tool with a handler (give-an-agent-a-tool).

Anything in headers ships inside the document SignalWire serves. For an API that needs a secret, weigh that before choosing a DataMap.

What to change first

Point the webhook at a URL that returns 404 and call the agent. The fallback is what the caller hears, which is the difference between a degraded answer and silence.