-
Notifications
You must be signed in to change notification settings - Fork 2.3k
How to access Messenger User Profile? #544
Comments
In the greeting thread, you can refer to the user's ID by using {{user_name}}
You can try {{user_first_name}} or {{user_last_name}} as well, or refer to any feature of the user's public profile. https://developers.facebook.com/docs/facebook-login/permissions |
Thanks devhaoy for the quick response! I tried your suggestion and it worked fine on the welcome/greeting/home page. In fact, I wanted to greet the user with the first name every time the user starts a conversation with the bot by saying hello or hi. Sorry, I wasn't clear earlier. I tried as below, but didn't work.
|
This may be the built in template parser getting in the way of the Facebook tags, which use the same {{}} syntax. I'll do some testing. |
Thanks Ben! Let me know the best way to retrieve the profile info. |
I don't think Botkit is the cause of the issue. Seems the {{user_name}} tag is only available within the greeting message.
This call grants access to the user's public profile only, depending on what you request in the url. Would be super nice if we had a native Login flow built in our Botkit :) |
Great! That worked very well. Thanks devhaoy! 👍 Yes, would have been nice if we could retrieve the public profile info without making the http call to Graph API. :) |
Marking this as a enhancement request for Botkit, if anyone wants to take a stab as at PR. |
I wrote this middleware to populate a |
Do I have to make the http call each time I want to use the user information in a chatbot in the same conversation? |
@pibicalderon it saves the user profile to the storage to avoid making several API calls |
What is the best way to retrieve the User Profile info in Messenger using Botkit?
https://developers.facebook.com/docs/messenger-platform/user-profile
I'm trying to greet the user by the FB profile first name.
The text was updated successfully, but these errors were encountered: