Python-slack-sdk: Slack API Token to post Message

Created on 9 Jan 2018  路  5Comments  路  Source: slackapi/python-slack-sdk

How to get "Slack API Token" to post Message.

from slackclient import SlackClient
import os
slack_token = os.environ["Slack_Api_Token"]
sc = SlackClient(slack_token)
sc.api_call(
"chat.postMessage",
channel="#general",
text="Hello from Python! :tada:"
)

Thanks
Hemnath Naidu S
9686102725

Most helpful comment

I think this is too complicated, I just want to send a message to the slack channel, I don't want to build a whole app. It would be a no-brainer.

All 5 comments

Hi @hemanth1991 馃憢

We have a guide to help you get started: https://api.slack.com/slack-apps

You may also want to join the Bot Hangout where you can get additional help: http://dev4slack.xoxco.com/

Thanks Roach.

I know the process of creating app in Slack, but if i need to post message through Python code, what is "Slack_Api_Token" from where should i get this?

Python Code i have mentioned above in the query.

Thanks
Hemanth Naidu S

@hemanth1991 Slack API Token will be the Bot Token in your app's install page. This doc walks you through the process: https://github.com/slackapi/python-slack-events-api/tree/master/example See the "Install your app on your team" section.

I think this is too complicated, I just want to send a message to the slack channel, I don't want to build a whole app. It would be a no-brainer.

Was this page helpful?
0 / 5 - 0 ratings