A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
1.0 KiB

# Post a Message to Slack
The `slack` command may be used to send a message to a Slack channel. This uses the Incoming Webhooks feature, which requires some additional setup.
!!! note
The following steps were accurate as of September 2020.
## 1) Log in to Slack
Log in to Slack and go to [Your Apps](https://api.slack.com/apps).
## 2) Create New Slack App
Create a new Slack app.
## 3) Select Incoming Webhooks
On the next page, select Incoming Webhooks and then toggle activation.
![incoming webhooks](images/slack-1.jpg)
## 4) Select Channel
Next, click "Add new Webhook to Workspace" and select the channel to which the message will be posted.
![slack 2](images/slack-2.jpg)
![slack 3](images/slack-3.jpg)
## 5) Copy the URL
Copy the URL for the new webhook to use as the ``url`` parameter for the Slack command.
```ini
[send a message to slack]
slack: "This is a test message."
url: the URL you created goes here
```
!!! tip
Define this URL in a `variables.ini` file if you need to send multiple messages to the same channel.