Introduction
To call your own API during a conversation, build a webhook tool. Use one when:- You have your own backend API you want to call during calls
- You’re integrating with a third-party service that isn’t in the built-in list
- You need custom request formatting, headers, or authentication
- Store an API key as a secret and reference it
- Write a request with variables the agent fills in
- Capture data from the response
- Tag the tool into an agent’s prompt and use what it returns
Prerequisites
- An agent to tag the tool into, from Agent builder
- Your Bland API key
Step 1: Store your API key as a secret
Do not paste an API key into a tool. Set the sidebar selector to All agents, open Tools, and on the Secrets tab click Add Secret. Name it something likebland_api_key and paste your key as a Static secret.
See Secrets for details.
Step 2: Create the tool
From inside your agent, open Tools, click Create tool, and choose Webhook. If you already have a workingcurl command, choose Import from cURL instead. It opens the builder with the request filled in.
Step 3: Name and describe it
Name. The name is what you type after@ in a prompt. Make it the thing the tool does: “Save call summary” reads better than “POST request”.
Description. The agent reads this to decide when to call the tool. Write the trigger:
Step 4: Configure the request
Method and URL. Choose POST and enterhttps://api.bland.ai/v1/prompts.
Authorization. On the Authorization tab, choose API Key. Set Header name to authorization, which is the header the Bland API expects, and pick your bland_api_key secret.
Body. Write the request body. Anywhere a value should change per call, write a variable:
Step 5: Say which variables the agent fills in
The variables you wrote are listed under Detected variables. For each one, click Add input variable so the agent fills it from the conversation. Then give it instructions, a type, and whether it is required:
Write instructions for a person. Be specific about the format when it matters.
A variable you leave alone resolves from variables already on the call instead, and the agent never fills it.
Step 6: Declare what comes back
Output fields name the parts of the response the agent can use. They start withok, message, and data, with ok and message checked. Keep ok checked: a failed call returns only ok and message.
For a POST tool, the response fields under data are named rest_api_post_*:
The builder lists these as
rest_api_get_* until the tool is saved. Save it, reopen it, and check the rest_api_post_* rows then.
To pull one value out of the response body, add a row with a name and a JSONPath. For the prompt ID, add a row named prompt_id with the path $.data.rest_api_post_data.prompt.id.
Run the tool with sample values and check the response before you attach it to anything.
Step 7: Tag the tool into a prompt
Building the tool does not give it to the agent. In the agent’s Prompt, type@ and pick Save call summary. The tool then appears under Tool references.
Use the tool’s outputs in the same prompt by their bare names:
Additional settings
These sit below the output fields:- Timeout: how long to wait before giving up, from 1,000 to 60,000 milliseconds.
- Cooldown: the minimum gap between calls, from 1 to 30 seconds.
Docs for agents: llms.txt