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 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

Line chart of daily active users: Mon 1,820, Tue 1,930, Wed 1,780, Thu 2,110, Fri 2,050, Sat 2,460, Sun 2,230, with the Saturday peak marked in red.
This is a real UrlChart render, not a screenshot: it is the image this page fetched from the URL below, and the same string is what goes into 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

Sizing for the message column

Legibility when the image is small

Repeated posts and caching

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.

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:

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.