Interact with the real world by connecting your agent to external APIs.
Expand to see an example in action
Endpoint: POST https://api.bland.ai/v1/inbound/<<INBOUND NUMBER>>
{{variable}}
. System variables are predefined variables that are available in every AI phone call. You can use them to access information about the current call, like the user’s phone number or the current time.
Note: Variables are NOT case sensitive, and outer spaces are trimmed automatically.
Base variables:
{{phone_number}}
- Always the other party’s number{{country}}
- The country code (ex. US){{state}}
- The state or province’s abbreviation (ex. CA for California){{city}}
- The full city name, capitalized{{zip}}
- The zip code{{call_id}}
- The unique ID of the current call{{now}}
{{now_utc}}
{{from}}
- The outbound number in E.164 format{{to}}
- The inbound number in E.164 format{{short_from}}
- outbound number with country code removed{{short_to}}
- inbound number with country code removeddynamic_data
parameter of your call request or inbound agent configuration. The dynamic_data
parameter is an array of objects, where each object represents an API request.
Here’s a simple request that can be used to load public data about the current price of Bitcoin, then store it in a variable called {{bitcoin_price}}
:
Additional Parameters
timeout
- The maximum number of milliseconds to wait for a response.
2000
method
- The HTTP method to use.
GET
, otherwise POST
is allowed.headers
- An object of headers to send with the request.body
- The body of the request. Only used if method
is POST
.response_data
- An array of objects that define how to extract data from the response.
cache
- Whether to store the response, or refresh that data before each AI response.
true
.data
parameter. The data
parameter follows JSON structuring, using dot notation and array indices. For example, if the response is:
$.bpi.USD.rate
would return 9,000.00
.
More complex filters can be used if they follow the JSONPath format.
response_data
, variables can be used nearly anywhere.
task
or prompt
parameterscontext
parameter of response_data
body
, headers
and/or query
parameter of each requestvariables
field will contain all variables that were defined during the call.
By far, the easiest way to test out your dynamic_data
configuration is via the /dynamic_data/test endpoint. It returns the original configuration, every raw response, and the final variables after parsing is applied.
{{member_id}}
variable - now we can use it in the next request.
This delivery service also can be called to check on an order status.
Note a difference: The cache
parameter is set to false
, so if the order status changes during the call, the agent will immediately know about it and be able to inform the customer.