Skip to content

Commit

Permalink
Add subscribed event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mileusna committed Jun 22, 2017
1 parent e794e43 commit f46e22b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion viber.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ func (v *Viber) ServeHTTP(w http.ResponseWriter, r *http.Request) {
switch e.Event {
case "subscribed":
if v.Subscribed != nil {

var u User
if err := json.Unmarshal(e.User, &u); err != nil {
return
}
go v.Subscribed(v, u, e.MessageToken, e.Timestamp.Time)
}

case "unsubscribed":
Expand Down

0 comments on commit f46e22b

Please sign in to comment.