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

> One row per user response to an HSM template.

# fact\_hsm\_responses

Each row represents a user's response to an HSM template node (WhatsApp template) within a conversation flow.

## What questions does it answer?

* What did users reply to each HSM template?
* How many responses did each template have?
* What was the response rate per campaign?

## Columns

| Column                  | Type       | Description                                    |
| ----------------------- | ---------- | ---------------------------------------------- |
| `interaction_answer_id` | Int64      | Unique response identifier                     |
| `company_id`            | Int32      | Company identifier (filtered automatically)    |
| `survey_user_id`        | Int64      | Identifier of the associated conversation flow |
| `question_id`           | Int32      | Question identifier                            |
| `hsm_id`                | Int32      | HSM template identifier                        |
| `hsm_name`              | String     | HSM template name                              |
| `answer_text`           | String     | Text of the user's response                    |
| `response_date`         | DateTime64 | Date and time of the response                  |
| `poll_id`               | Int32      | Campaign identifier                            |
| `cellphone`             | String     | User's cellphone number                        |

## Example queries

### Responses per HSM template

```sql theme={null}
SELECT
    hsm_name,
    count() AS total_responses,
    count(DISTINCT survey_user_id) AS unique_users
FROM client_analytics.fact_hsm_responses
WHERE response_date >= now() - INTERVAL 30 DAY
GROUP BY hsm_name
ORDER BY total_responses DESC
```

### Responses for a specific template

```sql theme={null}
SELECT
    response_date,
    cellphone,
    answer_text
FROM client_analytics.fact_hsm_responses
WHERE hsm_name = 'my_template'
  AND response_date >= now() - INTERVAL 7 DAY
ORDER BY response_date DESC
LIMIT 100
```
