Skip to content

Commit

Permalink
Merge pull request slack-go#132 from maxmcd/patch-1
Browse files Browse the repository at this point in the history
Syntax highlighting in the readme
  • Loading branch information
nlopes authored Jan 27, 2017
2 parents 77d2318 + 45558a4 commit 9bd40db
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,48 @@ Note: If you just updated from master and it broke your implementation, please c

### Getting all groups

import (
"fmt"

"github.com/nlopes/slack"
)

func main() {
api := slack.New("YOUR_TOKEN_HERE")
// If you set debugging, it will log all requests to the console
// Useful when encountering issues
// api.SetDebug(true)
groups, err := api.GetGroups(false)
if err != nil {
fmt.Printf("%s\n", err)
return
}
for _, group := range groups {
fmt.Printf("ID: %s, Name: %s\n", group.ID, group.Name)
}
```golang
import (
"fmt"

"github.com/nlopes/slack"
)

func main() {
api := slack.New("YOUR_TOKEN_HERE")
// If you set debugging, it will log all requests to the console
// Useful when encountering issues
// api.SetDebug(true)
groups, err := api.GetGroups(false)
if err != nil {
fmt.Printf("%s\n", err)
return
}
for _, group := range groups {
fmt.Printf("ID: %s, Name: %s\n", group.ID, group.Name)
}
}
```

### Getting User Information

import (
"fmt"
```golang
import (
"fmt"

"github.com/nlopes/slack"
)
"github.com/nlopes/slack"
)

func main() {
api := slack.New("YOUR_TOKEN_HERE")
user, err := api.GetUserInfo("U023BECGF")
if err != nil {
fmt.Printf("%s\n", err)
return
}
fmt.Printf("ID: %s, Fullname: %s, Email: %s\n", user.ID, user.Profile.RealName, user.Profile.Email)
func main() {
api := slack.New("YOUR_TOKEN_HERE")
user, err := api.GetUserInfo("U023BECGF")
if err != nil {
fmt.Printf("%s\n", err)
return
}
fmt.Printf("ID: %s, Fullname: %s, Email: %s\n", user.ID, user.Profile.RealName, user.Profile.Email)
}
```

## Minimal RTM usage:

Expand Down

0 comments on commit 9bd40db

Please sign in to comment.