Charca / bootbot

Facebook Messenger Bot Framework for Node.js
MIT License
974 stars 253 forks source link

chat.getUserProfile() not working #150

Open sarimhaq opened 6 years ago

sarimhaq commented 6 years ago

When I call chat.getUserProfile() I am getting the following error: { error: { message: '(#100) Insufficient permission to access user profile.', type: 'OAuthException', code: 100, error_subcode: 2018247, fbtrace_id: 'AMhQXIgh4lW' } }

Charca commented 6 years ago

Hey @sarimhaq, that's probably because the user needs to opt-in by chatting with your bot first. You can check the list of pre-requisites to make this request here: https://developers.facebook.com/docs/messenger-platform/identity/user-profile

jeandybryan commented 6 years ago

Update Facebook url in /bootbot/lib/BootBot.js remove const url = https://graph.facebook.com/v2.12/${userId}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=${this.accessToken} add const url = https://graph.facebook.com/${userId}?fields=first_name,last_name,profile_pic&access_token=${this.accessToken}

sarimhaq commented 6 years ago

Thanks @Charca and @jeandybryan !

phamngocduy98 commented 6 years ago

@Charca Can you update Facebook graph api url in the source code? I got the problem too while updating from API ver 3.0 to 3.1.

Charca commented 5 years ago

We should probably make the Graph API version an optional param of the BootBot constructor and default to not use a specific version. If anyone wants to jump in and open PR with this change, it should be a pretty straightforward update.

lehainam-dev commented 5 years ago

I created a PR in #161. I have just contributed to open source project recently (like this is my 5th PR). So please review my PR and send me any comments if the PR needs more update. Thank you.

theproj3ct commented 4 years ago

Update Facebook url in /bootbot/lib/BootBot.js remove const url = https://graph.facebook.com/v2.12/${userId}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=${this.accessToken} add const url = https://graph.facebook.com/${userId}?fields=first_name,last_name,profile_pic&access_token=${this.accessToken}

yeah for me, timezone wasnt approved yet, just removed timezone and it worked.

Thanks alot