I would like to create a Slack bot to answer a simple question or perform some task on the server. Here is what I tried
token = "i-put-my-bot-token-here"
sc = SlackClient(token)
sc.api_call("chat.postMessage", channel="magic", text="Hello World!")
Was this published as Slackbot and not the bot account I created?
Also, if I had to listen to the message, according to the python library, it says
if sc.rtm_connect():
while True:
print sc.rtm_read()
time.sleep(1)
else:
print "Connection Failed, invalid token?"
Or should I use an incoming webhook instead?
source
share