Actions11
- User Actions
- Measure Actions
- Sleep Actions
- Activity Actions
Overview
This node integrates with the Withings API to retrieve sleep data for a user. Specifically, the "Sleep" resource with the "Get" operation fetches detailed sleep information such as heart rate, respiration rate, and snoring data during sleep periods.
Common scenarios where this node is beneficial include:
- Monitoring sleep quality and patterns over time.
- Integrating sleep metrics into health dashboards or wellness applications.
- Automating alerts or reports based on sleep disturbances or irregularities.
For example, a user could configure this node to pull their nightly heart rate and snoring data to analyze correlations between sleep disruptions and cardiovascular health.
Properties
| Name | Meaning |
|---|---|
| Additional Fields | Optional parameters to refine data retrieval: |
| - Start Date: Timestamp to start retrieving data from. | |
| - End Date: Timestamp to end data retrieval. | |
| - Last Update: Retrieve only data updated after this timestamp. | |
| - Offset: Skip a number of records (useful for pagination). | |
| Data Fields | Types of sleep data to retrieve. Options include: |
| - HR: Heart rate data | |
| - RR: Respiration rate data | |
| - SNORING: Snoring data |
Output
The node outputs JSON objects containing the retrieved sleep data structured as follows:
success: Boolean indicating if the request was successful.resource: The resource queried, here always"sleep".operation: The operation performed, here"get".- Other fields depend on the Withings API response body and typically include detailed sleep metrics such as sleep phases, durations, heart rate, respiration rate, and snoring events.
If the API call fails, the output includes error details with fields like:
error: Error message string.status: Numeric status code from the API.errorCode: Specific error code returned by the API.
The node does not output binary data.
Dependencies
- Requires an OAuth2 API credential configured for Withings API access.
- The node makes authenticated HTTP GET requests to Withings endpoints under
https://wbsapi.withings.net/v2/sleep. - It respects rate limits and implements retry logic with exponential backoff for transient errors.
- Requires n8n environment to have internet access and valid Withings account permissions.
Troubleshooting
Common Issues
- Authentication errors: Invalid or expired OAuth tokens will cause failures. The node attempts token refresh but may require manual re-authentication.
- API rate limiting: Excessive requests may be throttled; the node uses delays and retries to mitigate this.
- Incorrect date formats: Ensure date/time inputs are valid ISO timestamps or recognized date strings.
- Empty or incomplete data: If no sleep data exists for the specified period or filters, the output may be empty.
Error Messages and Resolutions
- Errors mentioning "token", "unauthorized", "expired", or "authentication" indicate credential issues. To resolve:
- Reconnect or refresh the Withings API credentials in n8n.
- Verify that the Withings developer app has required scopes enabled.
- Confirm the Withings user account is active and linked properly.
- API errors with status codes other than 0 indicate server-side or request issues. Check the error message for details.
- Network timeouts or connectivity problems may require retrying later.