code: def post_slack():
      
      try:
          token = os.environ['SLACK_TOKEN']
          slack = Slacker(token)
  
          obj = slack.chat.post_message('#general', 'Hello fellow slackers!')
          print(obj.successful, obj.__dict__['body']['channel'], obj.__dict__[
              'body']['ts'])
      except KeyError as ex:
          print('Environment variable %s not set.' % str(ex))
docs: Post slack message.