# Get hourly inbound WhatsApp statistics

`GET /v1/whatsapp/stats/inbound/hourly`

Returns the number of WhatsApp messages your business numbers received, one row per hour. Rows use the time each message reached your number, in UTC by default or local time when you set `timezone`. Hours with no messages contain a zero count.

Each row contains only a count because a received message has one state. Use the send statistics endpoints for lifecycle and delivery-latency data about messages you send.

`from` and `to` are optional RFC 3339 instants defaulting to the trailing 168 hours, rounded down to the enclosing hour and echoed back in `period`, both bounds inclusive. A single request may span at most 30 days (720 hourly rows); for longer ranges use the daily endpoint. Requesting an hourly window longer than 30 days, or a `from` after `to`, returns 422.

## Code samples

### TypeScript

```ts
const stats = await bird.whatsapp.stats.inbound.hourly({
  from: "2026-05-30T00:00:00Z",
  to: "2026-05-31T00:00:00Z",
});
for (const point of stats.data ?? []) {
  console.log(point.bucket, point.received);
}
```

### Python

```py
stats = client.whatsapp.stats.inbound.hourly(
    from_="2026-05-30T00:00:00Z", to="2026-05-31T00:00:00Z"
)
for point in stats.data or []:
    print(point.bucket, point.received)
```

### Go

```go
series, err := client.Whatsapp.Stats.Inbound.Hourly(context.Background(), bird.WhatsappStatsInboundHourlyParams{
	From: time.Now().Add(-24 * time.Hour),
	To:   time.Now(),
})
if err != nil {
	log.Fatal(err)
}
for _, point := range *series.Data {
	fmt.Println(*point.Bucket, *point.Received)
}
```

### PHP

```php
$inboundHourly = $bird->whatsapp->stats->inbound->hourly([
    'from' => '2026-05-30T00:00:00Z',
    'to' => '2026-05-31T00:00:00Z',
]);
foreach ($inboundHourly->getData() ?? [] as $point) {
    echo $point->getBucket(), ' ', $point->getReceived(), PHP_EOL;
}
```

### CLI

```sh
bird whatsapp stats inbound hourly
```

### cURL

```sh
curl -X GET "https://us1.platform.bird.com/v1/whatsapp/stats/inbound/hourly" \
  -H "Authorization: Bearer $TOKEN"
```

## Example response `200`

```json
{
  "period": {
    "from": "2026-05-01",
    "to": "2026-05-25",
    "grain": "day",
    "data_as_of": "2026-05-25T14:03:10Z"
  },
  "data": [
    {
      "bucket": "2026-05-25",
      "received": 182
    }
  ]
}
```

## Query parameters

- `from` (string): Start of the window (RFC 3339 instant). Rounded down to the start of its hour (the local hour when `timezone` is set, otherwise the UTC hour), and that hour is included. The window may not exceed 30 days (720 hours). Defaults to 168 hours (7 days) before `to` when omitted.
- `to` (string): End of the window (RFC 3339 instant). Rounded down to the start of its hour (the local hour when `timezone` is set, otherwise the UTC hour), and that hour is included (both bounds inclusive). The window may not exceed 30 days (720 hours). Defaults to the current hour when omitted.
- `timezone` (string): IANA timezone identifier used to group statistics, for example `Asia/Kathmandu`. The default is UTC. Day and hour boundaries, including the default window when `from` and `to` are omitted, follow this timezone. When this parameter is set, pass `from` and `to` as calendar days or `Z` instants instead of timestamps with explicit UTC offsets.

## Response body

- `period` (object, required): The window and bucket grain the response covers, echoed from the request, plus the freshness boundary the data is current to.
- `period.from` (string, required): Inclusive start of the window. A calendar day (YYYY-MM-DD) on the day grain, an RFC 3339 instant on the hour grain.
- `period.to` (string, required): Inclusive end of the window. A calendar day (YYYY-MM-DD) on the day grain, an RFC 3339 instant on the hour grain.
- `period.grain` (string, required)

  The bucket grain of the series, either `day` or `hour`.

  Possible values: `day`, `hour`
- `period.data_as_of` (nullable string): Latest time reflected in the statistics. More recent events might not be included yet. Null when the freshness boundary is unavailable.
- `data` (array of object, required): One row per bucket (day or hour, matching the request) in the period, in chronological order. Buckets with no activity are included with a count of zero, so the series charts continuously without client-side gap handling.
- `data.bucket` (string, required): The day (YYYY-MM-DD) or hour (RFC 3339, on the hour) this point covers, matching the request's grain.
- `data.received` (integer, required): Distinct messages received in this bucket.

## Related resources

- [Should I use a Bird SDK or call the API directly?](/explained/platform/should-i-use-an-sdk-or-call-the-api-directly) (answer)
- [Build your first integration](/learn/paths/integration) (course)
- [Send your first email](/docs/get-started/send-your-first-email) (docs)

[Get an implementation brief](/learn/workspace?topic=api-basics)
