How to embed charts into Slack

In this article we’ll see how to add a chart into Slack.

There are 2 ways you can embed charts in slack channel:

  1. As a user you can simply copy & paste chart URL that you got from Charttt editor. The chart will automatically appear after you paste the URL
  2. If you’re building a slack bot, you can use Slack Blocks API

1. How to generate and copy a chart you can paste into Slack

Start by generating your chart. Go to Charttt editor and edit your chart. When you’re done click Use.

Then, copy the URL

Now head over to Slack, and simply paste the URL that you copied and hit Enter.

After a second the chart will appear.

This is it! As simple as copy & paste!

2. How to use Slack Blocks API to embed charts in Slack channels

Start by generating your chart URL using Charttt API. You can learn more about it in Charttt API Reference.

Now use Slack Block API . Here’s an example of a chart block:

{

  "blocks": [

    {

      "type": "image",

      "title": {

        "type": "plain_text",

        "text": "Here's your chart :+1:",

        "emoji": true

      },

      "image_url": "https://get.charttt.com/v1/chart/t_bar/w_400/h_400/bg_ffffffff/ts_14/tt_top/lg_top,center/d_1,2,3/dl_Series%201/?l=A|B|C",

      "alt_text": "chart url"

    }

  ]

}

You can click here to see this example in Slack’s API playground and try it out.