Accessing facebook user id for microsoft bot framework - bots

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?

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
First Name
Last Name
Email
Locale
Timezone
Gender

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

Related

Invalid user identity in provided tenant implementing bot proactive message

I have a bot application developed in java sdk. To integrate with MS Teams, I have a connector has been created using Bot Framework and Spring Boot and a Bot Channels Registration on the Azure portal. Everything working properly. Now I'm trying to implement proactive messages by following this tutorial: https://www.vrdmn.com/2020/02/microsoft-bot-framework-v4-send.html
I can already make the bot send proactive messages on channels, but now I need to implement the post a proactive personal message to a user.
I can get data from a user:
var user = await ((Conversations)connectorClient.Conversations).GetConversationMemberAsync(mentionUserPrincipalName, teamInternalId, default);
But when running the line...
var response = await connectorClient.Conversations.CreateConversationAsync(conversationParameters);
...a bad request result is returned with the message "Invalid user identity in provided tenant":
You can get the user details using teams roster. To create a new conversation or conversation thread in a channel, you must have the correct ID. You can receive or retrieve this ID. Please check Get the user ID, team ID or channel ID. You can also fetch the list the members of a team using teams roaster. Please check Fetch the roster or user profile.

How do I post as different users in react-activity-feed component using the same token?

Our Use case is Anyone can create a site in our platform bit as Wix lets say. Each Site has its own Community & Chat.
So I used my appId, secret key to create the user session token for the user of the site1 says site-1-user-1 for displaying the community of site1.
I used react-activity-feed components to display the timeline feed of user site-1-user-1 (timeline:site-1-user-1)
I also displayed status update from above the activity feeds using react component. So when I post in this status update form, the activity gets displayed as by site-1-user-1.
How do I post activity as a different user say site-1-user-2 using the same token? I want the timeline feed with status update form to be displayed as a discussion forum where any logged in user can post any topic and see other activities also.
I am able to do this using PHP and getStream SDK.
How is it possible by using the react component?
Stream restricts actions user is able to perform when using client-side tokens:
User is able to read any feed
User is able to make feeds with her user-id follow any feed
User is able to post to feeds with her user-id
Client side tokens can only be used to perform the actions as the user the token was created for.
If you need to be able to impersonate other users or post contents for users to feeds they have no access to you will have to user server-side stream api

Get user ID - WebAPI Spotify (Spotipy)

my question
is possible get a user id in any way? I would search a user from his name and print his recently artist played
Thanks
This is not possible due to Spotify's Web API has no endpoint where you can fetch user ids by their names.
What you can do is creating an application where a specific user can login using Spotify. Afterwards you can use this endpoint in order to retrieve the recently played tracks of that exact user. The track object in the response will hold the artist as well.

How to get user email from botbuilder with Skype for Business?

I'm using botbuilder package in a nodejs application and I need to get the user information from the Skype for Business channel, so that I can authorize against my custom authentication system - the username would work too.
Using session storage or anything like this doesn't work for my use case, so I need the actual user information.
How can I get this information?
In Skype for Business channel, you will found the user email in the id field of the user.
In Node.js: session.message.address.user.id field
In C#: activity.From.Id field
It has the following format: sip:mymail#mydomain.com

Obtaining the user's username via Foursquare API

I'm trying to obtain the user's username aka http://foursquare.com/USERNAME via the API. There seems to be no support for it in the User JSON response nor can I seem to find it anywhere else in the docu. Shouldn't it be available via a User request???
Foursquare identifies users by their user ID which is a number. Their default profile location is http://foursquare.com/user/USER_ID. You can also access a user's profile via http://foursquare.com/TWITTER_USERNAME if the user has connected their Twitter handle.
So given a user who has connected their twitter handle "FOOBAR" to foursquare, you can access their profile at http://foursquare.com/FOOBAR.

Resources