Count the texts of a site over time
get_site_message_stats
Counts the texts a site sent over a period, split into delivered, in progress and failed, with the credits they took.
totals covers the whole window, with total, delivered, pending and failed, and credits, what the texts cost once refunds are taken off. days holds one entry per hour, day or month, as interval says, and windowDays says how many days the window spans. Entries with no text come back as zeros, so the list always covers the full window.
failed gathers every text that did not arrive: failed, filtered, blocked or cancelled, whose credits came back. pending is every text still on its way. These are the same counts Activity on the Overview tab of the site's Messages tab draws. Texts stay in the history for 90 days, so a longer window only counts the texts still there. See Overview.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
period |
string | No | One of day, 24h, 7d, 30d, 90d, 12mo or all. day is today so far, from midnight UTC, 24h is the current hour and the 23 before it, 7d, 30d and 90d are the last 7, 30 and 90 days counting today, 12mo is this month and the 11 before it, and all reaches back to the first record. Defaults to 30d, and is left out when you send from and to. |
from |
string | No | The first day of a custom range as YYYY-MM-DD in UTC, sent together with to. |
to |
string | No | The last day of a custom range as YYYY-MM-DD in UTC, included in the range and sent together with from. |