Use action variables in inbound SIP calls
General Flow:
Action Variables allow dynamic data to be fetched and injected into prompts during a call. This is done by enriching the call context before it reaches the agent, using an external API.
Step 1: Create Custom Action
Create an API-based action that fetches variables needed in your prompt.
- The API must use POST.
- Set
run_action_before_call_start
totrue
- It must accept an
<external_id>
in the request body. - It must return a JSON object where the keys match the variable names in your prompt.
Example: If your prompt uses a variable name
, your API should return:
Passing Variables
Note: No changes are needed for the prompts—they will work with the current variables. The only important point is to ensure that the same variable names used in the prompts are also used when returning values from the API.
Step 2: Attach Action
Once the action is created:
- Attach it to your agent.
- The agent will automatically invoke this action before the call starts, enriching the prompt with the fetched variables.