@@ -25,11 +25,6 @@ const (
2525 MessengerProfileURL = "https://graph.facebook.com/v2.6/me/messenger_profile"
2626)
2727
28- var (
29- // NOTE: If you change this slice you should update the comment on the ProfileByID function below too.
30- defaultProfileFields = []string {"first_name" , "last_name" , "profile_pic" , "locale" , "timezone" , "gender" }
31- )
32-
3328// Options are the settings used when creating a Messenger client.
3429type Options struct {
3530 // Verify sets whether or not to be in the "verify" mode. Used for
@@ -154,17 +149,16 @@ func (m *Messenger) Handler() http.Handler {
154149 return m .mux
155150}
156151
157- // ProfileByID retrieves the Facebook user profile associated with that ID
158- // when no profile fields are specified it uses some sane defaults.
159- //
160- // These default fields are:
161- // - First name
162- // - Last name
163- // - Profile picture
164- // - Locale
165- // - Timezone
166- // - Gender
167- func (m * Messenger ) ProfileByID (id int64 , profileFields ... string ) (Profile , error ) {
152+ // ProfileByID retrieves the Facebook user profile associated with that ID.
153+ // According to the messenger docs: https://developers.facebook.com/docs/messenger-platform/identity/user-profile,
154+ // Developers must ask for access except for some fields that are accessible without permissions.
155+ //
156+ // At the time of writing (2019-01-04), these fields are
157+ // - Name
158+ // - First Name
159+ // - Last Name
160+ // - Profile Picture
161+ func (m * Messenger ) ProfileByID (id int64 , profileFields []string ) (Profile , error ) {
168162 p := Profile {}
169163 url := fmt .Sprintf ("%v%v" , ProfileURL , id )
170164
@@ -173,10 +167,6 @@ func (m *Messenger) ProfileByID(id int64, profileFields ...string) (Profile, err
173167 return p , err
174168 }
175169
176- if len (profileFields ) == 0 {
177- profileFields = defaultProfileFields
178- }
179-
180170 fields := strings .Join (profileFields , "," )
181171
182172 req .URL .RawQuery = "fields=" + fields + "&access_token=" + m .token
@@ -242,7 +232,7 @@ func (m *Messenger) GreetingSetting(text string) error {
242232 return checkFacebookError (resp .Body )
243233}
244234
245- // CallToActionsSetting sends settings for Get Started or Persist Menu
235+ // CallToActionsSetting sends settings for Get Started or Persistent Menu
246236func (m * Messenger ) CallToActionsSetting (state string , actions []CallToActionsItem ) error {
247237 d := CallToActionsSetting {
248238 SettingType : "call_to_actions" ,
0 commit comments