Skip to content

Instantly share code, notes, and snippets.

@alessiamarcolini
Last active July 19, 2019 07:29
Show Gist options
  • Save alessiamarcolini/cf215cbd86214dae01a4247798db4ca5 to your computer and use it in GitHub Desktop.
Save alessiamarcolini/cf215cbd86214dae01a4247798db4ca5 to your computer and use it in GitHub Desktop.
# ! pip install slackclient
# get your token: https://api.slack.com/custom-integrations/legacy-tokens
# composing messages: https://api.slack.com/messaging/composing
import os
from slack import WebClient
sc = WebClient(token='<your_token>', run_async=True)
sc.chat_postMessage(channel='#tasks-notifications', text='', icon_emoji=':smile:', username='') # username is the "sender" name
async def post_my_message(channel, msg):
await sc.chat_postMessage(channel=channel, text=msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment