Skip to main content
Query a third-party system before a call connects, so its response can route the call or add Marketing Data — using a Real-Time Routing webhook.
Technical experience required. This article covers sending data to another system in a way that’s more open-ended and less standardized than our integration guides — it’s most useful to developers or Invoca users with API development experience. Alongside tools like call treatments and Lookup Tables, you can also route calls using a third-party system, via Real-Time Routing webhooks. These are a type of Invoca webhook that request data from a third-party system before a call connects to its destination, so the call can be routed more intelligently. You can send data like Enhanced Caller Profiles to a tool such as a decision engine or TCPA shield, and get instructions back on how to treat that call in real time. If your account doesn’t have access to Real-Time Routing Webhooks, reach out to your account team or support@invoca.com to purchase and enable this feature.

Step 1: Create your Real-Time Routing webhook

Follow “How to Create, Edit, or Clone an Invoca Webhook” to create a new webhook with these options:
  • Type: Real-Time Routing
  • Name: something that makes clear what data you’re sending and to which system.
  • URL and Action: find your other system’s endpoint URL in its API documentation, then choose POST or GET as needed.
  • Format: JSON or XML. JSON supports an extra feature XML doesn’t (see below) — check your other system’s documentation for which format it accepts.
  • Headers and Body: add any Invoca data you want to pass along. In most cases, you’ll send a caller ID phone number and configure your other system to respond with routing information.
  • Data Mapping: unique to Real-Time Routing webhooks — lets you take data from your other system’s response and capture it in Invoca as Marketing Data, for routing and reporting.
Enter the webhook field name your third-party system returns in the Webhook Response Field box, then select a Marketing Data field to map it to (you may want to create a new custom field just for this). Click + New to map additional values. Add firing conditions and OAuth authentication as needed, then click Save. Using Real-Time Routing with bundled campaigns: if you use Real-Time Routing with Bundling, your response routes the call to a new bundled campaign rather than directly to a destination. Two additional substitution tokens are available for this:
  • Bundle Destination Ids: Invoca-generated campaign IDs.
  • Bundle Destination Ids from Network: IDs you’ve assigned to the campaign, often to match an external system.
The list of eligible IDs reflects your call treatment’s routing logic (hours, target regions, budget, campaign status). Test extensively before using Real-Time Routing with bundled campaigns, especially more complex bundles.

Step 2: Set up your third-party system to receive data from Invoca

Configure your other system to receive the webhook (usually a caller ID) and respond with the correct destination number or bundled campaign ID, in the same format as your webhook (JSON or XML). You have three options: Option 1: Return only routing information, using a special key that routes the call to a destination number, a bundled campaign, or a ring group: If a response includes more than one of these keys, Invoca prefers them in the order above. destination_campaign_id and destination_campaign_id_from_network only apply to bundled campaigns. Option 2: Map Marketing Data only, without routing information — respond with a name/value pair where the name exactly matches the Partner (API) Name of a Marketing Data field from Step 1. Don’t use =, ,, or . in the values — these characters cause errors. Option 3: Return both routing information and mapped data — this requires a JSON webhook and response, combining Options 1 and 2. To forward calls to a group of numbers (ring group), use ring_group as your primary key, with these child keys:
  • destination_numbers (required): a list of destination numbers in E.164 format, separated by commas (for example, ["+15551234567", "+15557654321"]).
  • number_labels (optional): names for each number, as strings (for example, ["Santa Barbara regional call center", "Denver regional call center"]).
  • call_acceptance (optional): whether agents can accept or reject the call before answering, as a boolean.
  • timeout (optional): seconds to wait before dialing the next destination, as an integer.
  • distribution_method (optional): InOrder, Random, or Weighted.
  • destination_weights (optional): relative weight per destination if using “Weighted,” as integers matching the order of destination_numbers (for example, [3, 1]). See “How to Improve Answer Rates by Forwarding Phone Calls to a Group of Numbers” for more.
  • simultaneous_calls (optional): how many destinations to dial concurrently, as an integer.
  • destination_total_limit (optional): for “Random” or “Weighted” distribution, the total destinations to try before moving on, as an integer.

Additional formatting guidelines

  • To reference nested values, use dot notation: path.to.response_key.
  • You can add an extension or internal IVR keypress to destination_phone_number using “x” followed by keypresses, and a comma for a 1-second pause (for example, +18055551234x5,,145).
  • Invoca monitors whether Real-Time Webhooks fire correctly. If a webhook doesn’t respond, responds outside the time limit, or returns invalid data, Invoca treats it as a failed response (see Step 4).

Sample webhook responses

Example JSON response with each possible special key besides ring_group:
Example JSON response using the ring_group primary key and its child keys:
Example XML request with bundled destinations:
Example JSON request with bundled destinations:
An empty JSON response ({}) automatically triggers the “else” node in the real-time campaign — useful when your system has no destination to return and doesn’t want to wait for a timeout. Example XML response:
Example JSON response with a custom key (phone_number):
Example nested JSON response (mapping key would be calling.phone_number):
Example combining a special routing key and a data-mapping key:
The same options apply to XML responses.

Step 3: Testing your Real-Time Routing webhook

Test your webhook and endpoint response extensively before implementing it in your call treatment.

Step 4: Add Real-Time Routing to your call treatment tree

Choose which campaign(s) will use this webhook, then follow “Call Treatments & IVR” to add a node with the type “Forward to real-time routing,” and select the Real-Time Routing Webhook to use. You can also add a voice prompt for this node. If a special key (destination_campaign_id, destination_campaign_id_from_network, or destination_phone_number) arrives within two seconds of the request (or the length of your voice prompt), the call routes using that data. If Invoca doesn’t receive a special key in time — even if data mapping without special keys occurred — the call continues to the “else” node instead. We recommend a voice prompt of roughly 10–15 seconds to give your webhook reliable time to respond. If you designed your webhook to only map Marketing Data (Option 2 above), you can use that mapped data for conditional routing in the else node with a “Check a Condition” node — for example, checking custom_data["Response_Key"] = "Blacklisted_Response" to hang up on blacklisted numbers, with normal routing otherwise. You can only add one real-time routing node per call treatment tree — though with syndication or bundling, a caller might pass through separate real-time routing nodes for each leg of the call.

Step 5: View and audit Real-Time Routing activity in your reports

Once enabled, a “Real Time Routing” column appears on your Calls and Transaction Details reports. Values you might see:
  • {Phone Number}: the number your system returned and the call was routed to (may include an extension).
  • (blank): no webhook fired for this call.
  • “Empty Response”: the webhook fired but returned an empty response.
  • “Incorrect Response” (with troubleshooting details): the webhook fired but returned invalid data.
  • “Response not received in time”: the webhook fired but timed out before Invoca received a response.
  • {Campaign ID}: for bundled campaigns, the campaign ID your system returned.
  • “No Eligible Destination Campaign”: the call didn’t qualify for any bundle destination (due to hours, location, etc.), so no webhook request was sent.

Where to go next

Last modified on September 25, 2026