From f3642f1e87ac65163729decb320dfed9e2e65423 Mon Sep 17 00:00:00 2001 From: Harrison Date: Sun, 18 Sep 2016 14:13:02 +1000 Subject: [PATCH] Fix profile fields not being entirely populated --- messenger.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/messenger.go b/messenger.go index 8a83a33..dafc118 100644 --- a/messenger.go +++ b/messenger.go @@ -10,8 +10,10 @@ import ( const ( // ProfileURL is the API endpoint used for retrieving profiles. - // Used in the form: https://graph.facebook.com/v2.6/?fields=first_name,last_name,profile_pic&access_token= + // Used in the form: https://graph.facebook.com/v2.6/?fields=&access_token= ProfileURL = "https://graph.facebook.com/v2.6/" + // ProfileFields is a list of JSON field names which will be populated by the profile query. + ProfileFields = "first_name,last_name,profile_pic,locale,timezone,gender" // SendSettingsURL is API endpoint for saving settings. SendSettingsURL = "https://graph.facebook.com/v2.6/me/thread_settings" ) @@ -114,7 +116,7 @@ func (m *Messenger) ProfileByID(id int64) (Profile, error) { return p, err } - req.URL.RawQuery = "fields=first_name,last_name,profile_pic&access_token=" + m.token + req.URL.RawQuery = "fields=" + ProfileFields + "&access_token=" + m.token client := &http.Client{} resp, err := client.Do(req)