Guide
Charts in Slack: build the image URL, post the block
A Slack message is text plus blocks. There is no JavaScript and no canvas inside a message, so a chart in Slack is an image fetched from a public https URL, which Slack proxies to the clients. A UrlChart URL is that image: a bot or a scheduled job builds the URL and posts the payload.
Why the chart has to be an image
- A message body is mrkdwn text plus blocks or attachments. Message JSON carries no renderer for scripts, and Slack does not execute code sent to it.
- Interactive elements exist — buttons, selects, overflow menus — but they are form controls, not a drawing surface.
- An image URL is a first-class block: Slack shows it inline in the message column and the clients render it like any other image.
A screenshot works once, and then stops scaling. It is a paste rather than a reference: nothing in the message records which period, which filter or which query produced it, and next week's post means taking the screenshot again. An image URL keeps the chart reproducible — the message carries the exact parameters that drew it.
The mechanism
Two payload shapes carry an image. An incoming webhook or chat.postMessage can send an image block:
{
"blocks": [
{
"type": "image",
"image_url": "https://urlchart.com/chart?cht=lc&chs=720x260&chd=t:1820,1930,1780,2110,2050,2460,2230&chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&chxt=x,y&chco=2f5fe0&chm=o,ff3b30,0,5,8&chtt=Daily+active+users",
"alt_text": "Daily active users: Sat 2,460, the week's peak"
}
]
}
alt_text is required by the image block, and it is what a client shows while the image loads or when it fails. A legacy attachment with an image_url still works and is what older bots send.
Either way the URL must be reachable from Slack over public https. Slack's servers fetch the bytes, proxy them and cache them: a URL that only resolves inside your network will not render, and an Authorization header cannot be attached to the fetch.
A real render
image_url.https://urlchart.com/chart?cht=lc&chs=720x260&chd=t:1820,1930,1780,2110,2050,2460,2230&chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&chxt=x,y&chco=2f5fe0&chm=o,ff3b30,0,5,8&chtt=Daily+active+users
One parameter is worth knowing in this context: chm=o,ff3b30,0,5,8 draws a point marker — shape o, colour ff3b30, series 0, point 5 (Saturday), size 8 — so the peak is visible at chat size without a second chart or a sentence of explanation.
Parameters that matter at chat size
cht: a bar chart (bvs) for comparisons between a handful of categories, a line chart (lc) for one series over time, where the shape is the message.chd: the data. Simple encoding (t:followed by comma-separated values) is readable in a message and reviewable in a pull request.chxtandchxl: keep one axis pair and short label names. A chart in a channel is read in a second, so the axis is a scale, not a table.chco: one accent colour. Two or three colours in a 360 px image read as noise, and thin colour distinctions are the first thing a downscaled PNG loses.chtt: a title of two to four words. It is the only text large enough to read without opening the image.
Sizing for the message column
- The chat column is narrow: a few hundred pixels in a desktop client, full width on a phone. Designing for a ~360–400 px display slot is safe in both.
- Render at twice that and display at half —
chs=720x260shown at 360 px stays crisp on a retina display. - There is no device-pixel-ratio parameter in the legacy syntax. Double-and-display-half is the compatible way to get a sharp image, and it is what a plain
<img>in a web page would do too. - Keep the height modest. A chart taller than the message column pushes the text and the buttons below it out of the way.
Legibility when the image is small
- Fewer labels beat smaller type. Seven labels across 720 px are about 103 px apart, about 51 px once the image is displayed at 360 px; twelve would not survive that.
- Keep the title short (
chtt). It is read at thumbnail size, so “Daily active users” informs and a full sentence does not. - One clear series. Three series stacked into a 360 px slot become indistinguishable in a busy channel.
- To flag an anomaly, mark the point (
chm=o,<colour>,0,<point>,8) instead of adding a second chart.
Repeated posts and caching
- Successful renders are immutable for one year:
Cache-Control: public, max-age=31536000, immutable. - A scheduled post that repeats the same URL is served from cache and is not a metered unique render.
- Slack caches the bytes as well, so a changed chart needs a changed URL. Change a rendered parameter — the data — not a cache-buster:
cb,cachebust,tand_are stripped before rendering and produce the same image.
Keys and signed URLs in a channel
An image URL cannot send an Authorization header, and everyone in the channel — plus anyone the message is forwarded to — can read the URL. Two consequences follow.
- Do not put a long-lived
?key=in a channel post. It is a permanent credential in a searchable message history. - Use a signed URL with an expiry when the chart data is not public. After it lapses the request fails closed to the free tier rather than exposing the paid chart, and rotating or revoking the key invalidates every signature minted with it. The parameters are in the docs.
For a public metric — a status line, a weekly signup count — the plain URL is the simpler answer: no secret to rotate, and every past post keeps working.
Alerts, standups and daily posts
Three shapes cover most of the traffic. A daily metric post repeats one URL shape with the day's numbers; an alert posts one URL when a threshold trips; a deploy or incident note posts a chart of the window it affected. All three want the same two things:
- The message text carries the headline number, so it is readable in a notification preview where images are not shown at all.
- The
alt_textrepeats the numbers the image shows, so the message is still complete when the fetch fails or a client renders it as a link.
Uploading a PNG instead of referencing a URL stores the bytes in the workspace. That is fine for a one-off, but it makes every scheduled post a second copy of the same picture and it decouples the image from the query that produced it.
Bots and scheduled jobs
Nothing above is specific to a Slack app. A cron job, a CI step or a small bot assembles the URL for the current period, posts the payload to an incoming webhook or calls chat.postMessage, and the message carries the image block. Two practical notes: build the URL from the period rather than a random value, so the same day's post is idempotent; and log the URL you posted, because the URL is the chart.
Next: Getting started · chart examples · Pricing · Drop-in Tester