# Notifications

Thryve sends, if enabled, proactive notifications for new or updated user data through webhooks. These notifications will be sent as POST requests to a designated HTTPS URL (Port 443). The webhooks are triggered when:

* A user connects or disconnects a data source.
* New epoch or daily data is stored, or existing data is updated.

Ensure to respond to the request with a `200` or `204` within 2 seconds. Failed deliveries will be retried up to 3 times. Recurring failed deliveries within a certain timeframe will lead to the automatic disabling of webhooks.&#x20;

{% hint style="warning" %}
We recommend queuing received payloads by your endpoint before applying any further processing/data storage to ensure adequate response times.
{% endhint %}

## Configuration

Webhooks can be enabled or disabled for each data dimension (epoch/daily/measurement). To enable webhooks, you need a functioning public Webhook URL, which can be set up in the Thryve dashboard. You can also add custom authentication to secure your webhook endpoint using web authentication, configurable through the Thryve Dashboard.

{% hint style="info" %}
If you still use webhooks in old webhook format and would like to switch to the new webhook format, please reach out to our support team.
{% endhint %}

## Data source connection/disconnection webhook

When enabled, this webhook will trigger whenever a user connects or disconnects a data source.

{% tabs %}
{% tab title="ISO timestamp example" %}

```json
{
    "endUserId": "123accessToken",
    "endUserAlias": "YourEndUserAlias",
    "timestampType": "iso",
    "type": "notification.source.connect",
    "data": {
        "timestamp": "2022-09-07T17:40:00Z",
        "dataSourceId": 1
    }
}
```

{% endtab %}

{% tab title="Unix timestamp example" %}

```json
{
    "endUserId": "123accessToken",
    "endUserAlias": "YourEndUserAlias",
    "timestampType": "unix",
    "type": "notification.source.connect",
    "data": {
        "timestamp": 1662572400000,
        "dataSourceId": 1
    }
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="159.96783447265625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>endUserId</code></td><td>String containing the unique identifier of a user in Thryve's system. Auto-generated upon user creation. Formerly known as <code>accessToken</code>.</td></tr><tr><td><code>endUserAlias</code></td><td>String containing the optional alias set by you when creating a user. Formerly known as <code>partnerUserId</code>. Only returned if not <code>null</code>.</td></tr><tr><td><code>timestampType</code></td><td>String specifying the timestamps to expect in the data object. <code>iso</code> or <code>unix</code>. Can be configured in Thryve Dashboard (coming soon)</td></tr><tr><td><code>type</code></td><td>String specifying the payload structure and event to expect in the <code>data</code> object. <code>webhook.source.connect</code> or <code>webhook.source.disconnect</code>.</td></tr><tr><td><code>timestamp</code></td><td>Specifies when the connection/disconnection happened. Either string with the date and time in utc (<code>iso</code>) or integer with timestamp in milliseconds (<code>unix</code>).</td></tr><tr><td><code>dataSourceId</code></td><td>Integer specifying the <code>dataSourceId</code> new the connection/disconnection has happend for.</td></tr></tbody></table>

## Epoch data creation/update webhook

When enabled, this webhook will trigger whenever new data is stored for a data source or existing data is updated. Updates occur if the `endTimestamp` or `value` of an epoch data point change.

{% tabs %}
{% tab title="ISO timestamp example" %}

```json
{
    "endUserId": "123accessToken",
    "endUserAlias": "YourEndUserAlias",
    "timestampType": "iso",
    "type": "notification.data.epoch.createupdate",
    "data": {
        "startTimestamp": "2022-09-07T17:40:00Z",
        "endTimestamp": "2022-09-07T20:05:00Z",
        "dataSourceId": 1,
        "dataTypeIds":
        [
            1000, 1001
        ]
    }
}
```

{% endtab %}

{% tab title="Unix timestamp example" %}

```json
{
    "endUserId": "123accessToken",
    "endUserAlias": "YourEndUserAlias",
    "timestampType": "unix",
    "type": "notification.data.epoch.createupdate",
    "data": {
        "startTimestamp": 1662572400000,
        "endTimestamp": 1662581100000,
        "dataSourceId": 1,
        "dataTypeIds":
        [
            1000, 1001
        ]
    }
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="159.546875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>endUserId</code></td><td>String containing the unique identifier of a user in Thryve's system. Auto-generated upon user creation. Formerly known as <code>accessToken</code>.</td></tr><tr><td><code>endUserAlias</code></td><td>String containing the optional alias set by you when creating a user. Formerly known as <code>partnerUserId</code>. Only returned if not <code>null</code>.</td></tr><tr><td><code>timestampType</code></td><td>String specifying the timestamps to expect in the data object. <code>iso</code> or <code>unix</code>. Can be configured in Thryve Dashboard (coming soon)</td></tr><tr><td><code>type</code></td><td>String specifying the payload structure to expect in the <code>data</code> object. Always <code>notification.data.epoch.createupdate</code>.</td></tr><tr><td><code>startTimestamp</code></td><td>Specifies the start of the period containing new data. Either string with the date and time in utc (<code>iso</code>) or integer with timestamp in milliseconds (<code>unix</code>).</td></tr><tr><td><code>endTimestamp</code></td><td>Specifies the end of the period containing new data. Either string with the date and time in utc (<code>iso</code>) or integer with timestamp in milliseconds (<code>unix</code>).</td></tr><tr><td><code>dataSourceId</code></td><td>Integer specifying the <code>dataSourceId</code> new data has been stored for.</td></tr><tr><td><code>dataTypeIds</code></td><td>Array containing the <code>dataSourceIds</code> new data has been stored for.</td></tr></tbody></table>

## Daily data creation/update webhook

When enabled, this webhook will trigger whenever new data is stored for a data source or existing data is updated. Updates occur if the `value` or `generationType` of a daily data point change.

{% tabs %}
{% tab title="ISO timestamp example" %}

```json
{
    "endUserId": "123accessToken",
    "endUserAlias": "YourEndUserAlias",
    "timestampType": "iso",
    "type": "notification.data.daily.createupdate",
    "data": {
        "startDay": "2022-09-07",
        "endDay": "2022-09-07",
        "dataSourceId": 1,
        "dataTypeIds":
        [
            1000, 1001
        ]
    }
}
```

{% endtab %}

{% tab title="Unix timestamp example" %}

```json
{
    "endUserId": "123accessToken",
    "endUserAlias": "YourEndUserAlias",
    "timestampType": "unix",
    "type": "notification.data.daily.createupdate",
    "data": {
        "startDay": 1662572400000,
        "endDay": 1662581100000,
        "dataSourceId": 1,
        "dataTypeIds":
        [
            1000, 1001
        ]
    }
}
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th width="160.32379150390625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>endUserId</code></td><td>String containing the unique identifier of a user in Thryve's system. Auto-generated upon user creation. Formerly known as <code>accessToken</code>.</td></tr><tr><td><code>endUserAlias</code></td><td>String containing the optional alias set by you when creating a user. Formerly known as <code>partnerUserId</code>. Only returned if not <code>null</code>.</td></tr><tr><td><code>timestampType</code></td><td>String specifying the timestamps to expect in the data object. <code>iso</code> or <code>unix</code>. Can be configured in Thryve Dashboard (coming soon)</td></tr><tr><td><code>type</code></td><td>String specifying the payload structure to expect in the <code>data</code> object. Always <code>notification.data.daily.createupdate</code>. </td></tr><tr><td><code>startDay</code></td><td>Specifies the start of the period containing new data. Either string with the date (<code>iso</code>) or integer with timestamp in milliseconds (<code>unix</code>).</td></tr><tr><td><code>endDay</code></td><td>Specifies the end of the period containing new data. Either string with the date (<code>iso</code>) or integer with timestamp in milliseconds (<code>unix</code>).</td></tr><tr><td><code>dataSourceId</code></td><td>Integer specifying the <code>dataSourceId</code> new data has been stored for.</td></tr><tr><td><code>dataTypeIds</code></td><td>Array containing the <code>dataSourceIds</code> new data has been stored for.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thryve.health/receive-updates-via-webhooks/notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
