threadHeatmapMetric returns a grid of 7 days by 24 hours, with the count for each hour of each weekday across the date range. It powers the heatmaps in Insights.
For TypeScript, the GraphQL SDK gives you a fully typed client for these operations.
metrics:read permission for threads_created_count_heatmap, and metricsAgent:read for agent_messages_sent_count. See Permissions.
Get a heatmap
input takes these fields:
metricName:threads_created_count_heatmapfor threads created, oragent_messages_sent_countfor threads users sent messages onfromandto: the date range, in UTC. The heatmap doesn’t widen themmode:METRICfor counts, orTHREAD_IDSfor the threads behind a cell, row, or columnfilters: see Filter and group reporting queries. Heatmaps don’t supportgroupBy. Foragent_messages_sent_count, setfilters.userIdsto count only some users
Query
Variables
Read the response
days has 7 entries, from Monday at index 0 to Sunday at index 6. Each holds 24 entries for hours 0 to 23 in UTC. Every cell has a total and a percentage, which is the cell’s share of the whole grid from 0 to 100. Empty cells are 0.
agent_messages_sent_count counts threads, not messages: each cell counts the threads a user sent at least one message on in that hour of that weekday.
Get the threads behind a cell
Setmode to THREAD_IDS and pass threadIdsArgs to pick the slice:
dayOfWeek:1for Monday to7for SundayhourOfDay:0to23, in UTC
dayOfWeek for a row, or only hourOfDay for a column. At least one is required. dayOfWeek starts at 1 while days starts at index 0, so add 1 to the index of the day you read from days.
This query returns the threads created on any Monday between 09:00 and 09:59 UTC in September:
Query
Variables
days is null in this mode.
