I try to use the slack API to send a message to a workspace, I found this piece of code on their docs but I have an issue with the module slack. This is the code I used:
import os
import slack
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
response = client.chat_postMessage(
channel='#viktor',
text="Hello world!")
assert response["ok"]
assert response["message"]["text"] == "Hello world!"
I have put my app token but it does not recognize WebClient
... any idea?
pip install slack
pip install slackclient
Make sure you don't have any user files named slack
slack_client
.
A simple filename change to something more original solved my problem.
This was my setup:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With