Skip to content

Instantly share code, notes, and snippets.

@nl5887
Created March 10, 2015 17:18
Show Gist options
  • Save nl5887/0f70d642f6c91f33535e to your computer and use it in GitHub Desktop.
Save nl5887/0f70d642f6c91f33535e to your computer and use it in GitHub Desktop.
Slack invite by email
v := url.Values{}
v.Set("email", "email")
v.Set("channels", "channel")
v.Set("first_name", "firstname")
v.Set("token", "xox-")
v.Set("set_active", "true")
v.Set("_attempts", "1")
url := fmt.Sprintf("https://%s.slack.com/api/users.admin.invite?t=%d", "team", time.Now().Unix())
var err error
var resp http.Response
if resp, err = http.PostForm(url, v); err != nil {
panic(err)
}
var msg map[string]interface
if err = json.NewDecoder(resp.Body).Decode(&msg); err !=nil {
panic(err)
}
fmt.Printf("%#v", msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment