> ## 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.

# Review replies before sending

> Use the email relay’s durable queue to inspect, correct, approve or discard a Voiceflow response and resolve uncertain delivery.

Have a person check an email before the relay sends it to a customer. This workflow uses the downloadable relay's local queue. It does not create a Voiceflow inbox or a managed human-agent hand-off connection.

## Before you begin

Complete a connection manual and leave `AUTO_SEND=false`. The reviewer needs private operator access to the host, the original provider mail and an approved reply policy. Run commands inside the extracted `email-relay` folder. Locally prefix each command with `node --env-file=.env`; on a running Docker host use `docker compose exec relay node`.

## Review one customer reply

### 1. Find the held work

```sh
node --env-file=.env cli.mjs list
node --env-file=.env cli.mjs show JOB_ID
```

Replace `JOB_ID` with the complete ID printed by `list`. `show` includes the sender, original text, candidate, thread and state. Its output can contain customer data; use a private terminal. Later messages in a held thread wait so a review cannot be bypassed by a follow-up.

| State | Reviewer action |
| --- | --- |
| `review` | Read the cached candidate against the original message and approved source. |
| `review-input` | Read the original at the provider, then write a human reply or discard. |
| `uncertain-turn` | Check runtime/tool effects before considering another turn. |
| `uncertain-send` | Check provider acceptance/delivery before considering another send. |

### 2. Correct or discard the reply

To replace the candidate, write a UTF-8 plain-text file containing the exact customer reply, then run:

```sh
node --env-file=.env cli.mjs reply JOB_ID ./reviewed-reply.txt
```

For Docker, copy that file into the container before using its path:

```sh
docker compose cp ./reviewed-reply.txt relay:/app/reviewed-reply.txt
docker compose exec relay node cli.mjs reply JOB_ID /app/reviewed-reply.txt
```

A manual reply changes held input to `review`; it does not run an agent turn or extract an attachment. Remove `[HUMAN_REVIEW]` from the final customer text when replacing that candidate. To suppress a message entirely, use `cli.mjs discard JOB_ID`. Discard does not send an explanation or delete the provider's original mail.

### 3. Approve once

```sh
node --env-file=.env cli.mjs approve JOB_ID
```

The next worker pass sends the cached reply and records provider acceptance. Approval does not run the agent again. Inspect the customer inbox and the provider activity record before calling the request resolved. A later bounce needs operational follow-up even if the job says `sent`.

## Verify the review boundary

### 1. Test a normal candidate

Send a pilot policy question. Confirm the customer receives nothing before approval. Replace its candidate, approve once and verify exactly the reviewed text arrives. Try approving the same sent job again; the CLI must reject that state.

### 2. Test a held conversation

Send an attachment or an out-of-scope question that returns the example's `[HUMAN_REVIEW]` marker. Confirm held work and no automatic send. Send a follow-up in that thread; it should wait. Resolve the earlier item by sending a reviewed reply or discarding, then verify the follow-up can proceed.

### An email may already have been sent

Resolve remote effects before using a recovery command.

Stop the worker. Inspect provider sent/activity logs and the customer inbox. For `uncertain-send`, `cli.mjs mark-sent JOB_ID` records known acceptance. Only after proving the provider did not accept it, use `cli.mjs retry-send JOB_ID --confirmed-not-sent` to reuse the cached reply. If the outcome remains unknown, leave it held and resolve manually. A timeout is not proof of failure.

For `uncertain-turn`, inspect the runtime transcript and any business-system effects first. `cli.mjs restart JOB_ID --reviewed-side-effects` begins a new session and can repeat actions; use it only after that review. While Docker is stopped use `docker compose run --rm relay node cli.mjs ...`, then restart the service.

### Mail sends while the reviewer expects it to wait

Inspect automatic sending and already approved work.

Check `AUTO_SEND` and job states. Setting it to `false` affects future candidates; it does not revoke a prior approval or recall accepted mail. Stop the worker and reconcile queued `ready` jobs before resuming. Keep operator access restricted: this CLI is the approval authority.

For help desk connections, reassign the native ticket/conversation to a person before replying manually. Approval rechecks native ownership and latest content; a changed job becomes `ignored`. Resolve or discard old held work before returning assignment to automation. These supervised examples require review before sending.

Help desk messages arriving during review can overlap questions already run through the agent. Those newest jobs are held as `review-input`, with `helpdesk.priorJobs` in `show`. Reconcile the cached answers and newest questions, discard stale jobs and write one complete reply for the newest held job. This avoids repeating agent/tool execution. A manually edited or written reply does not rewrite the runtime's conversation history; keep the thread with a person if a material correction or human exchange makes that saved context unsafe to reuse.
