Dynamic Call Configuration: Pre-call webhooks allow you to fetch
customer data, account information, and contextual details in real-time
before each call starts.
Overview

Real-time Data Injection
Fetch customer details, account status, and contextual information from
your systems before the call starts
Personalized Conversations
Use dynamic variables to personalize agent responses and call flows
based on caller information
When Pre-call Webhooks Trigger
Pre-call webhooks respect thewebhook_direction
configuration setting:
Both
Triggered for all inbound and outbound calls
Inbound
Only triggered for incoming calls to your agents
Outbound
Only triggered for calls initiated by your agents
If no webhook URL is configured or the webhook direction doesn’t match the
call direction, the call proceeds without dynamic variables.
Request Specification
HTTP Method and Timeout
Openmic sends aPOST
request to your configured webhook URL with:
- Content-Type:
application/json
- Timeout: 3 seconds per attempt
- User-Agent:
Openmic-Webhook/1.0
If all webhook attempts fail, the call will end. Please read failure handling for more info.
Request Payload
Payload Fields
Field | Type | Required | Description |
---|---|---|---|
event | string | Yes | Always "call" for pre-call webhooks |
call.direction | string | Yes | Call direction: "inbound" or "outbound" |
call.bot_id | string | Yes | Unique identifier for the bot/session |
call.from_number | string | Yes | Caller’s phone number in E.164 format |
call.to_number | string | Yes | Callee’s phone number in E.164 format |
call.attempt | string | Yes | Attempt number of the webhook |
Expected Response
Success Response
Your webhook must return a200
status code with a JSON response containing dynamic variables:
Response Structure
Field | Type | Required | Description |
---|---|---|---|
call | object | Yes | Container for call-related data |
call.dynamic_variables | object | Yes | Key-value pairs of variables to inject into the call |
Variable Usage: Dynamic variables can be referenced in your agent
prompts using template syntax like
{{ customer_name }}
.Retry Logic and Error Handling
Retry Configuration
Max Attempts
3 total attempts 1 initial request + 2 retries
Timeout
3 seconds Per individual request attempt
Backoff Strategy
Exponential delays 1s, 2s, 3s between retries
Retry Triggers
Openmic retries your webhook in these scenarios:- Timeout: No response within 3 seconds
- HTTP Errors: 4xx or 5xx status codes
- Network Errors: Connection failures or DNS resolution issues
- Invalid JSON: Malformed response body
Failure Handling
If all webhook attempts fail, the call will terminate.
- Track the
"attempt"
field included in each webhook request payload. - On the third attempt (final retry), return an empty JSON object for the dynamic variables.
Examples
Testing and Debugging
Webhook not being called
Webhook not being called
Possible causes:
- Webhook URL not configured
webhook_direction
doesn’t match call direction- Invalid webhook URL format
- Verify webhook URL in dashboard
- Check
webhook_direction
setting - Ensure URL uses HTTPS and is publicly accessible
Webhook timing out
Webhook timing out
Possible causes:
- Slow database queries
- External API dependencies
- Heavy processing logic
- Optimize database queries with indexes
- Cache frequently accessed data
- Use asynchronous processing for heavy operations
- Set shorter timeouts for external API calls
Variables not appearing in calls
Variables not appearing in calls
Possible causes:
- Incorrect response format
- HTTP status code other than 200
- Variables not referenced in agent prompts
- Validate JSON response structure
- Ensure 200 status code response
- Check agent prompt syntax for variable references