> ## Documentation Index
> Fetch the complete documentation index at: https://help.treble.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# fact_deployment_status

> One row per outbound delivery (delivery attempt).

# fact\_deployment\_status

Each row represents an outbound delivery attempt to a user. Includes the delivery status, the campaign, and the timestamps of each stage.

## What questions does it answer?

* How many deliveries were made per campaign?
* Which were delivered, failed, responded?
* What was the delivery rate?
* Which numbers were messaged?

## Columns

| Column                | Type       | Description                                                         |
| --------------------- | ---------- | ------------------------------------------------------------------- |
| `deployment_id`       | String     | Unique delivery identifier                                          |
| `company_id`          | Int32      | Company identifier (filtered automatically)                         |
| `timestamps_eta`      | DateTime64 | Scheduled date and time of the delivery                             |
| `cellphone`           | String     | Destination cellphone number                                        |
| `country_code`        | String     | Country code                                                        |
| `status`              | String     | Delivery status: `DELIVERED`, `FAILURE`, `SUCCESS`, `REVOKED`, etc. |
| `poll_id`             | Int32      | Campaign identifier                                                 |
| `poll_name`           | String     | Campaign name                                                       |
| `origin`              | String     | Delivery origin: `API`, `PLATFORM`, etc.                            |
| `origin_id`           | Int32      | Origin identifier                                                   |
| `timestamp_delivered` | DateTime64 | Date delivered to the user                                          |
| `timestamp_responded` | DateTime64 | Date the user responded                                             |
| `timestamp_failure`   | DateTime64 | Date of failure (if failed)                                         |
| `batch_id`            | String     | Delivery batch identifier                                           |
| `treble_id`           | String     | Unique contact identifier in Treble                                 |

## Example queries

### Delivery rate per campaign

```sql theme={null}
SELECT
    poll_name,
    count() AS sent,
    countIf(timestamp_delivered > '2000-01-01') AS delivered,
    countIf(timestamp_responded > '2000-01-01') AS responded,
    round(countIf(timestamp_delivered > '2000-01-01') * 100.0 / count(), 1) AS delivery_rate_pct,
    round(countIf(timestamp_responded > '2000-01-01') * 100.0
        / nullIf(countIf(timestamp_delivered > '2000-01-01'), 0), 1) AS response_rate_pct
FROM client_analytics.fact_deployment_status
WHERE timestamps_eta >= now() - INTERVAL 30 DAY
GROUP BY poll_name
ORDER BY sent DESC
```
