Skip to main content

Redirect

Overview

The redirect action loads another answer payload from a URL. Use redirect when your first answer_url needs to branch into a different call flow after looking up customer state or after a gather result. Place it in the actions array returned by your answer_url. MiniVoice executes actions in order, so put redirect before the action that depends on its result and after any prompt or setup the caller should experience first.

Business Use Case

Use redirect when your application needs another answer_url request after collecting input. For example, route Sales callers to a sales menu and Support callers to a support menu without putting every branch in the first response.

JSON Example

{
"actions": [
{
"redirect": {
"url": "https://example.com/minivoice/ivr/sales"
}
}
]
}

Parameters

FieldTypeRequiredDescription
typestringYesMust be redirect when using typed action format.
urlstringYesHTTP or HTTPS URL that returns another actions payload.
methodstringNoGET or POST. Defaults to GET when omitted.
max_redirectsnumberNoMaximum redirect depth, from zero to twenty.

Execution Flow

  1. MiniVoice reaches redirect in the actions array.
  2. It requests the URL using the configured method.
  3. Your endpoint returns a new JSON object containing actions.
  4. MiniVoice validates the returned actions and continues executing the new flow.

Webhook Behaviour

Redirect does not send a standalone webhook. Webhooks from later actions, such as call.gathered or recording.completed, are still sent normally.

Success Example

A successful answer_url response includes the action in a valid actions array:

{
"actions": [
{
"redirect": {
"url": "https://example.com/minivoice/ivr/sales"
}
}
]
}

Your application should store the MiniVoice call ID from webhooks or API responses so you can correlate the action with the call.

Failure Behaviour

If the URL returns non-2xx, invalid JSON, or invalid actions, the redirect fails. Keep redirect endpoints fast and return only the next action payload.

Expected Result

MiniVoice fetches the new URL and continues executing actions from that response. Keep the redirect URL fast and return valid JSON.

Testing

Create a first answer_url that returns redirect. Make the redirect URL return a say action. Call your DID and confirm the caller hears the prompt from the second endpoint. During testing, log every webhook payload and compare the call ID, action timing, and final call status with the behavior you expected.

Copy/Paste Examples

Real Request

Return this from your answer_url:

{
"actions": [
{
"redirect": {
"url": "https://example.com/minivoice/ivr/sales"
}
}
]
}

Real Response

A valid answer_url response is the JSON action payload itself. MiniVoice accepts the response when it contains an actions array:

{
"actions": [
{
"redirect": {
"url": "https://example.com/minivoice/ivr/sales"
}
}
]
}

Real Webhook Example

{
"event": "call.completed",
"created_at": "2026-05-29T12:10:00Z",
"call": {
"id": "call_123",
"customer_id": "cust_123",
"application_id": "app_123",
"status": "completed",
"direction": "inbound",
"from": "+15551230001",
"to": "+15551230002"
},
"variables": {},
"data": {}
}

Common Use Case

Use redirect when your application needs another answer_url request after collecting input. For example, route Sales callers to a sales menu and Support callers to a support menu without putting every branch in the first response.

Common Failure Case

{
"error": {
"code": "answer_url_error",
"message": "invalid action payload"
}
}

Invalid fields or malformed JSON cause MiniVoice to reject the answer_url payload. Log the exact response your server returned while testing.