How to embed a Slack channel in a web page

Dennis Mellican
2 min readNov 7, 2019

Use Slack View to live stream a Slack channel on a web site.

Slack View demo: https://mellican.com/badactors

The latest version of Slack View now features Real-Time-Streaming of Slack channels to multiple Slack View web pages. You can personalize Slack View with themes and deploy Slack View as a Docker container.

Slack View leverages Python and Flask-SocketIO to achieve real time streaming of Slack events. The rendered Slack View page becomes a read only display of Slack channel.

A custom implementation of Slack View at https://mellican.com/badactors, live streams a #bad-actors Slack channel of hackers probing and attempting to infiltrate a system. This demonstrates how Slack messages in a channel can be published outside a Slack client. In this example, stakeholders who normally don’t use Slack, suddenly realize that their systems are constantly under siege by bad actors like “Steven Seagal” and are grateful for those IT Security policies that protect the organization.

Another implementation of Slack View could be to embed Slack support channels into a dashboard to monitor multiple discussions, war rooms or issues.

Instructions

  1. You’ll need Python 3.
  2. Download or clone the Slack View Github repository: https://github.com/meltaxa/slackview
  3. Copy the sample config.yml-example as config.yml.
  4. Follow the instructions below to add the Slack API and BOT tokens to the config.yml file.

To obtain a Slack API and BOT token:

  1. Visit https://api.slack.com/apps
  2. Click “Create New App”
  3. Call the App “SlackView”
  4. Under Features > OAuth & Permissions > Scopes, add the following OAuth scopes:
  • channels:history
  • channels:read
  • users:read
  • emoji:read

Under App Level Tokens > Generate Token and Scopes > add a token name and the connections.write scope.

  1. Click “Generate”
  2. Copy App Token value and update it in the config.yml file.
  3. Click Install App to Workspace
  4. Accept permissions by clicking the “Allow” button.
  5. Copy the Bot User OAUTH Token value and update it in the config.yml file.

Using Slack View

  1. Start Slack View from command line:
    python3 ./app.py
  2. Visit the Slack View web site on port 7000:
    http://<ip address>:7000.

Docker version

  1. Create a config directory which will be mounted as a volume for Docker.
  2. Place your config.yml in the config directory.
  3. Run the Docker image with the volume switch to mount your config directory as /config in the image. For example:
    docker run -v /path/to/config_dir:/config -p 7000:7000 -e TZ=Australia/Brisbane meltaxa/slackview
  4. Note, by default the Docker container will be set in UTC timezone. Set the timezone using the -e TZ=... option.
  5. The Slack View app will be running on: http://<ip address>:7000

PHP version

Slack View was originally written in PHP which only provided a snapshot of the channel and a page refresh is required to display the latest messages. For posterity, the php version of Slack View is available under the GitHub php branch.

--

--