Created
          February 14, 2016 22:58 
        
      - 
      
 - 
        
Save voidabhi/d799d2cce39dcc580ad3 to your computer and use it in GitHub Desktop.  
    Slack snippets in python
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def post_message(token, channel, text, username): | |
| ''' | |
| Sending a message(text) as username to channel | |
| ''' | |
| params = { | |
| "token": token, | |
| "channel": channel, | |
| "text": text, | |
| "username": username, | |
| } | |
| return requests.post("{}/{}".format('https://slack.com/api', 'chat.postMessage'), data=params) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment