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

# SMS Phone Heartbeats with Node.js

> Check that your Android SMS gateway phone is online from Node.js: list the heartbeats it sends every 15 minutes, with battery and charging state, in TypeScript.

## Overview

The Hypersender SMS app sends a heartbeat every 15 minutes. Each one records the battery level, whether the phone was charging, the app version, and the phone's local time. Use the Node SDK to list them, for example to chart battery level or find when a phone went quiet.

To react to a phone going offline as it happens, use the heartbeat webhooks instead. See the [SMS heartbeats guide](https://docs.hypersender.com/v2/hypersender/overview/sms/sms-heartbeats-guide.md).

## Methods

### List Heartbeats

Get a paginated list of heartbeats for the instance. [(learn more)](https://docs.hypersender.com/v2/api-reference/sms/heartbeats/sms-heartbeats-api.md)

> [tab] Basic Usage
>
> ```typescript theme={null}
> import { Hypersender } from "hypersender-node";
>
> const result = await Hypersender.sms().getHeartbeats();
>
> for (const heartbeat of result.data ?? []) {
>   console.log(heartbeat.createdAt, heartbeat.batteryLevel, heartbeat.isCharging);
> }
> ```

> [tab] Basic Usage with Filters
>
> ```typescript theme={null}
> import { Hypersender } from "hypersender-node";
>
> const result = await Hypersender.sms().getHeartbeats({
>   perPage: 50,
>   page: 1,
>   sort: "-created_at",
>   filterIsCharging: false,
>   filterCreatedAt: "2025-01-20 00:00:00,2025-01-21 00:00:00",
>   // other filters (check Parameters tab)
> });
>
> console.log(result.meta?.currentPage, result.meta?.lastPage, result.meta?.total);
> ```

> [tab] Parameters
>
> All parameters are optional.
>
> | Parameter | Type | Description |
> | - | - | - |
> | perPage | number | Items per page (max 50) |
> | page | number | Page number |
> | sort | string | `created_at` or `local_timestamp`. Add `-` for descending, for example `-created_at`. |
> | include | string | Related data to include: `phone`, or `phone.currentAppVersion` |
> | filterAppVersion | string | Part of the app version, for example `1.50` |
> | filterBatteryLevel | number | Exact battery level in percent, for example `87` |
> | filterIsCharging | boolean | `true` or `false` |
> | filterLocalTimestamp | string | The phone's local time, as a date or range |
> | filterCreatedAt | string | Date or range. A range is two dates separated by a comma, for example `2025-01-20 00:00:00,2025-01-21 00:00:00`. |
> | filterUpdatedAt | string | Date or range |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.