> ## Documentation Index
> Fetch the complete documentation index at: https://www.voiceflow.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Elastic Observability integration

> Connect Voiceflow to Elastic Observability, export conversation events, monitor custom Chat requests and verify operational signals.

## Overview

Voiceflow integrates with Elastic Observability so your team can store searchable conversation events in an Elastic data stream and correlate them with your application.
Use a receiver your team hosts to forward signed conversation events, or instrument the backend behind your own Chat interface.

- **[Connect Elastic Observability](#connecting-elastic-observability)** with server-held ingest credentials.
- **[Track conversations and calls](#tracking-conversations)** and find their matching Voiceflow records.
- **[Monitor Chat requests](#monitoring-chat-requests)** when your team owns the interface backend.
- **[Build an operational view](#operational-view)** from the signals you collect.

| Signal | What this recipe supplies |
| --- | --- |
| Conversation lifecycle | Start/end events, optional session/transcript IDs and elapsed time. |
| Voice call lifecycle | Call start/end timing and available channel information. |
| Custom Chat requests | Request duration, HTTP status and an opaque application conversation ID. |

**Note:** 
Lifecycle events do not contain internal model/tool spans, token usage or quality scores. Use [Transcripts](/docs/documentation/measure/transcripts) and [Evaluations](/docs/documentation/measure/evaluations) for conversation evidence, and the [shared CX guides](/docs/guides/integrations/monitoring#guides) for the additional measurements your team supplies.

<a id="connecting-elastic-observability"></a>

## Connecting Elastic Observability

Authorize intake and configure signed event delivery.

You need a Voiceflow project, an Elasticsearch deployment and Kibana, plus an administrator who can create the template, data stream and publisher key. A developer must host the HTTPS receiver and own its delivery health.

| Resource | Owner and use |
| --- | --- |
| Provider authorization | An **encoded API key** with `create_doc` restricted to `logs-voiceflow-default`, issued after the administrator creates that data stream. |
| Voiceflow project ID | Project owner supplies `VF_PROJECT_ID` for receiver validation. |
| HTTPS endpoint | Developer hosts the receiver; Voiceflow sends events to it. |
| Endpoint signing secret | Copied from Voiceflow into the receiver’s server secrets. |

#### Studio

### 1. Prepare the destination

Ask your Elastic administrator to create the dedicated `logs-voiceflow-default` data stream and its create-only publisher key. Obtain the encoded key and Elasticsearch URL after they confirm the stream exists. Copy the deployment’s **Elasticsearch** URL into `ELASTICSEARCH_URL`; the Kibana URL is not the ingest endpoint. Store the API response’s `encoded` key value as `ELASTIC_API_KEY`.

Ask your developer to deploy the [operations starter](/docs/examples/monitoring/operations-starter.zip) with this project’s ID and the provider credentials. Obtain its HTTPS `/voiceflow/events` URL. If a receiver already handles this project, add forwarding there instead of replacing it.

### 2. Save the project webhook

Open your project at [creator.voiceflow.com](https://creator.voiceflow.com), then **Settings → Webhooks → Session lifecycle webhook**. Enter the receiver URL in **Webhook url**, move focus away and wait for **Saved**. Choose **Listen for specific events**, select **Session started**, **Session ended** and the two call events as needed, then wait for **Saved** again.

Voiceflow project lifecycle webhook URL and event subscriptions — Save the receiver URL and selected events before copying the endpoint secret.

### 3. Complete the secret exchange

Copy **Webhook secret** from that endpoint and have the developer set `VF_WEBHOOK_SECRET` on the receiver. Keep it separate from the provider’s ingest credential. Ask them to start the service, then complete the [real-conversation check](#tracking-conversations).

#### Code

### 1. Provision intake access

Ask your Elastic administrator to create the dedicated `logs-voiceflow-default` data stream and its create-only publisher key. Obtain the encoded key and Elasticsearch URL after they confirm the stream exists. Copy the deployment’s **Elasticsearch** URL into `ELASTICSEARCH_URL`; the Kibana URL is not the ingest endpoint. Store the API response’s `encoded` key value as `ELASTIC_API_KEY`.

```json title="Administrator: Kibana Dev Tools"
PUT _index_template/voiceflow-monitoring
{
  "index_patterns": ["logs-voiceflow-*"],
  "priority": 501,
  "data_stream": {},
  "template": { "mappings": { "properties": {
    "@timestamp": { "type": "date" },
    "service": { "properties": { "name": { "type": "keyword" } } },
    "environment": { "type": "keyword" },
    "event_type": { "type": "keyword" },
    "event_id": { "type": "keyword" },
    "session_id": { "type": "keyword" },
    "conversation_id": { "type": "keyword" },
    "duration_ms": { "type": "double" },
    "request_failed": { "type": "boolean" }
  } } }
}
PUT _data_stream/logs-voiceflow-default
POST _security/api_key
{
  "name": "voiceflow-monitoring-publisher",
  "role_descriptors": { "publisher": {
    "cluster": [],
    "indices": [{ "names": ["logs-voiceflow-default"], "privileges": ["create_doc"] }]
  } }
}
```

Check each administrator request succeeds, confirm the stream exists, and store only the returned `encoded` API key in the receiver. The administrator needs the separate privileges to create these resources; the publisher does not. See [data stream setup](https://www.elastic.co/docs/manage-data/data-store/data-streams/set-up-data-stream).

### 2. Configure and run the receiver

Download and extract the [operations starter](/docs/examples/monitoring/operations-starter.zip). In `operations`, run `npm ci` with Node 22+, then `npm test`. Copy `elastic-observability.env.example` to an untracked `provider.env` file and replace every `YOUR_` value:

```bash title="Server configuration"
MONITORING_PROVIDER='elastic-observability'
VF_ENV='staging'
VF_PROJECT_ID='YOUR_VOICEFLOW_PROJECT_ID'
VF_WEBHOOK_SECRET='YOUR_ENDPOINT_SIGNING_SECRET'
ELASTICSEARCH_URL='https://YOUR_ELASTICSEARCH_HOST'
ELASTIC_API_KEY='YOUR_ENCODED_WRITE_KEY'
```

Load the file into your local process (`set -a; . ./provider.env; set +a`) or use your host’s secret store. Expose `/voiceflow/events` through an HTTPS proxy that preserves the raw body and Svix headers. Apply ingress rate limits; the starter’s body limit is 64 KiB. The starter uses Elasticsearch’s [create-only document API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create). It writes to `logs-voiceflow-default/_create/{id}`, with `Authorization: ApiKey …`. The ID is a SHA-256 hash of the original `event_id`: `201` creates it; `409` means that event is already stored.

### 3. Register and verify the endpoint

In the project’s **Settings → Webhooks → Session lifecycle webhook**, save the HTTPS **Webhook url** and select the session/call events you need. Wait for **Saved** for both changes. Copy that endpoint’s **Webhook secret** to `VF_WEBHOOK_SECRET`, then start the receiver with `npm start`.

Voiceflow project lifecycle webhook URL and event subscriptions — Save the receiver URL and selected events before copying the endpoint secret.

Keep existing webhook consumers in the shared receiver. A saved URL establishes configuration; the [conversation check](#tracking-conversations) establishes delivery.

### Events are not arriving

Check authorization, delivery and destination visibility.

A `403` can mean the key lacks `create_doc` for this stream. A missing stream/template is an administrator setup task; do not fix it by giving the publisher broad cluster privileges. A `409` from this starter acknowledges an existing event ID rather than overwriting it. The receiver returns `401` for a signature failure and `503` for forwarding failure. Verify the raw body and Svix headers before changing secrets; never bypass verification to make a test pass.

<a id="tracking-conversations"></a>

## Tracking conversations and calls

Find lifecycle events and their matching Voiceflow conversations.

The receiver preserves `event_id` from the signed delivery and includes `session_id`/`transcript_id` when provided. It excludes conversation text, customer IDs, phone numbers and provider metadata.

| Event | Interpret it as |
| --- | --- |
| `runtime.session.start` | A conversation session started. |
| `runtime.session.end` | It ended or expired; `duration_ms` includes idle time. |
| `runtime.call.start` | A voice connection started. |
| `runtime.call.end` | That connection ended; `duration_ms` measures the call. |

Closing the widget does not immediately end its session. A call can reuse a session, and optional join IDs can be absent. Use [the lifecycle reference](/docs/api-reference/webhooks/session-lifecycle#call-events) for these distinctions; session/call duration is not response latency.

#### Studio

### 1. Run a deployed conversation

Use your published widget or another deployed channel. Ask a sandbox support question, then follow a path that ends the session or wait for its idle timeout. For voice, make a short test call and hang up.

### 2. Find the matching event

Create or select a Kibana data view matching `logs-voiceflow-default`, using `@timestamp` as its time field. In **Discover**, run this KQL filter for the last hour and open a document.

```text
service.name : "voiceflow-agent" and environment : "staging"
```

Match `session_id` with Voiceflow’s [Transcripts](/docs/documentation/measure/transcripts), where present. Check a start/end pair and the separate call timing before sharing the dashboard.

#### Code

### 1. Exercise signed delivery

Use a deployed channel or the current [Chat session API](/docs/api-reference/v4interact/start-session-specific-environment). Start a session, send a sandbox action and end it or allow its timeout. Legacy Interact requests are not a substitute for this session-lifecycle test.

### 2. Inspect the projected fields

Create or select a Kibana data view matching `logs-voiceflow-default`, using `@timestamp` as its time field. In **Discover**, run this KQL filter for the last hour and open a document.

```text
service.name : "voiceflow-agent" and environment : "staging"
```

Check `event_id`, `event_time_ms`, available IDs and `duration_ms`. The record is timestamped on receipt; original source time remains in `event_time_ms`. Event `environmentID` becomes `version_id`; `projectEnvironmentID` becomes `environment_id` when present.

### 3. Test rejection and recovery

In staging, send a modified signed body; expect `401` and no exported record. Force an intake failure; expect `503`. Restore access and replay the original event using your delivery tooling. Verify the same event ID arrives, and monitor duplicate handling before using totals.

### Counts differ from conversations

Allow for retries, session reuse and delayed delivery.

Use original event IDs when deduplicating lifecycle events. The starter has no durable queue; a lost acknowledgment can cause a replay. Elastic’s create-only ID suppresses an exact replay in the same write backing index; a rollover can admit the ID into a new backing index. Keep call events separate from session events and do not invent a join key when none was supplied.

<a id="monitoring-chat-requests"></a>

## Monitoring Chat requests

Measure the request boundary in your own application.

This path instruments non-streaming `/v4/interact` in a backend your team controls. It measures outbound request plus JSON response read, not widget rendering, streaming Voice or internal model/tool timing. An HTTP `200` does not establish that the customer’s task was resolved.

#### Studio

### 1. Assign the backend work

For an owned Chat interface, ask its developer to add `observeChatTurn` from the operations starter and forward the resulting record to this destination. Supply the environment/service labels and an approved sandbox question. Widget and phone users can continue with lifecycle events.

### 2. Verify the customer experience

Run the question through your interface. Ask the developer to locate `voiceflow.chat.turn`, confirm duration and HTTP status, and test a failed request. Verify the app keeps its normal response/error behavior when telemetry delivery is unavailable.

#### Code

### 1. Reuse authenticated session state

Your backend [creates a Chat session](/docs/api-reference/v4interact/start-session-specific-environment), stores its `sessionKey`, launches once and authorizes later actions for the same customer. Use a random application conversation ID for telemetry; never use the session key as the ID.

### 2. Wrap and export the existing request

```js title="Existing server-side Chat handler"
import { createDestination } from './destinations.mjs';
import { observeChatTurn } from './chat.mjs';
const sendRecord = createDestination('elastic-observability');

// Values come from authenticated server-side conversation state.
const result = await observeChatTurn({ sessionKey, action, conversationID });
try {
  await sendRecord(result.record);
} catch {
  console.error('Monitoring export failed');
}
// Return result.status and result.body through your existing handler.
```

On a network/JSON-read error, the wrapper throws with `error.record`. Forward that record from the existing error handler and preserve its recovery behavior. Do not repeat the customer action to retry telemetry.

### 3. Check both boundaries

Verify successful and non-2xx requests, then make the monitoring destination unavailable. Preserve the actual runtime status/body. In production, move delivery into a durable queue or your host’s awaited background facility; the short example awaits an intake call with a five-second timeout.

### Request latency looks too high

Check the boundary being measured.

`duration_ms` on `voiceflow.chat.turn` covers the server’s request and response read. It does not measure only model time. Keep it separate from lifecycle durations, and measure browser rendering or streaming first-response timing in their actual clients.

<a id="operational-view"></a>

## Building an operational view

Investigate collected signals and maintain the connection.

### 1. Build the first operational view

In Discover, verify a session-end document’s `event_id`, `session_id` and `duration_ms`. Build a Lens chart filtered to `event_type : "runtime.session.end"`, using unique count of `event_id`. Add a separate call-duration percentile chart using numeric `duration_ms`. Create-only IDs suppress an exact replay within the current write backing index. After rollover, deduplicate by `event_id` when aggregating across the stream.

### 2. Verify notification behavior

Create an [Elasticsearch query rule](https://www.elastic.co/docs/solutions/observability/incident-management/create-an-elasticsearch-query-rule) scoped to this data stream and environment. Define the query, time window, threshold and action connector, then save it. Test a sandbox failure and recovery, including the action delivery; saving a rule alone does not verify its notification.

Use the shared guides for [latency and errors](/docs/guides/integrations/monitoring/monitor-latency-and-errors), [cross-system failures](/docs/guides/integrations/monitoring/investigate-cross-system-failures) and [CX regression alerts](/docs/guides/integrations/monitoring/alert-on-cx-regressions). Their measurement rules apply here; map the example fields and queries to this destination’s format. See the [provider’s documentation](https://www.elastic.co/docs/solutions/observability/logs/explore-logs) for its query and dashboard controls.

### Maintain the connection

Assign owners for receiver health, ingest credentials and alert routing. Rotate the provider credential in the host secret store and repeat a real conversation check before retiring the old value. Voiceflow’s [signing-secret rotation](/docs/api-reference/webhooks/session-lifecycle#rotating-the-signing-secret) keeps the previous secret valid for 24 hours.

### Stop export cleanly

Preserve other webhook consumers and runtime behavior.

Disable Elastic Observability forwarding in your receiver. Clear the project’s webhook URL only if no other consumer needs it. Remove the Chat instrumentation without changing session handling, revoke the unused provider credential and remove server secrets. Previously ingested records follow the provider’s retention policy; stopping export does not delete them.
