0

I am building a bot for messenger using Microsoft Bot Framework. I got the bot registered with messenger and have set up a basic echo bot. I however want to access the user's email id to check for security. How do I access this from the framework. The user id in the session object gives me the page id but not the user id.

Any idea on how the user id can be retrieved?

camelCase
  • 1,549
  • 2
  • 16
  • 28
Akshay
  • 783
  • 6
  • 20

2 Answers2

1

Answering for someone looking at this now. The user id in the session object is actually the page scoped user id.

On the node.js SDK of Microsoft Bot Framework it can be accessed with

var user_id = session.user.id

This id along with the page access token can be used with the Facebook Graph API to get additional details. Using the requests module from npm

r = requests.get("https://graph.facebook.com/v2.6/"+ user_id + "?fields=first_name,last_name,profile_pic,email,locale,timezone,gender&access_token=" + page access token)

The return object contains the following data

  1. First Name
  2. Last Name
  3. Email
  4. Locale
  5. Timezone
  6. Gender
Akshay
  • 783
  • 6
  • 20
-1

you can use channel data in the Activity To access all the original information That comes from the facebook (or all other channel) e.g:

Activity activity;

dynamic d = JObject.Parse(activity.ChannelData.ToString());

Documentation

Yehezkel
  • 36
  • 4