Last active
May 21, 2020 14:52
-
-
Save fpaupier/44de53749e6648791848b012cb3ebc4e to your computer and use it in GitHub Desktop.
Parse an incoming Telegram request for webhook update.
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
| // parseTelegramRequest handles incoming update from the Telegram web hook | |
| func parseTelegramRequest(r *http.Request) (*Update, error) { | |
| var update Update | |
| if err := json.NewDecoder(r.Body).Decode(&update); err != nil { | |
| log.Printf("could not decode incoming update %s", err.Error()) | |
| return nil, err | |
| } | |
| return &update, nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment