Created
          March 13, 2019 20:13 
        
      - 
      
- 
        Save rms1000watt/011619842708b1c26fa8936fc25d4f88 to your computer and use it in GitHub Desktop. 
    Send Slack Incoming Webhook in Golang
  
        
  
    
      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
    
  
  
    
  | func Slack(url, msg string) (err error) { | |
| buf := bytes.NewBufferString(fmt.Sprintf(`{"text":"%s"}`, msg)) | |
| if _, err := http.Post(url, "application/json", buf); err != nil { | |
| fmt.Println("Failed posting to slack:", err) | |
| } | |
| return | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment