Send messages to Slack using Python

Tutorial: Python Slack Bot

Gonzalo Fernandez Plaza

--

Hello everyone! This post will show us how to use the Slack API in Python. To do this, we will create a Python application that will send daily information to the Slack channel that we want. This is going to be the final behavior.

Final Setup of my application.
Final Setup of my application.

For this purpose, we will divide the tutorial into the following points:

  1. Creation of a Slack application
  2. Creation of a Slack channel and authorize the Slack app
  3. Integration with the Python Script using the Slack API

Let’s start wiht it! Also, remember that you can check my courses about AWS and SnowFlake at my profile:

CREATION OF A SLACK APPLICATION

1) Create the application

To do it, we have different options. We can go to the Slack API page and create one directly (scroll down a little bit on this page to see the option): https://api.slack.com/tutorials/tracks/getting-a-token

Creation of a pre-configured app.
Creation of a pre-configured app.

We select a workspace (the Slack account where we want to create the application) and confirm it.

Confirmation the pre-configured app.
Confirmation of the pre-configured app.

2) Install the application in Slack

Once we have created the app from the Slack API, we can access it from the following URL: https://api.slack.com/apps.

The application that we’ve just created.
The application that we’ve just created.

Once we are in our application, we install it on our workspace.

--

--

Gonzalo Fernandez Plaza

Computer Science Engineer & Tech Lead 🖥️. Publishing AWS & Snowflake ❄️ courses & exams. https://www.fullcertified.com