Facebook Integration

Thomas McGrath III mcgrath3 at mac.com
Wed Dec 11 21:52:40 EST 2013

Dear Use List:

We have the wonderful mergSocial extension from Monte for Facebook 'one way' integration on iOS, but I really need a solution that will ‘get’ information ‘from' Facebook and also for Android use as well. I have already contributed previously to a social plugin that was never really completed. The tutorials on RunRev require Andre’s plugin which doesn’t work. So we don’t really have a solution that will work for two way integration with Facebook. Or for both iOS and Android use. It gets more confusing on iOS since Facbook is signed into at the OS level.

Specifically I am interested in getting a list of the App’s End User's Facebook friends for use in my mobile app and then getting a random friend from that list of friends and then getting that friends profile picture. A lot of this relies on the Facebook API and is relatively easy to implement, but it starts getting confusing when the end users authentication is needed for the end user of the app (and not using my information) and then trying to get and keep updated the client_id and access_token for that end user of the app.

All of the following works using the “me”  word and “my” access_token BUT what we need and what I’m told is that ALL we need is for the  access_token to be replaced with the “end user” of the app’s access_token. That’s where the problem lies.

To get a list of “MY” friends: 
	get ("https://graph.facebook.com/me/friends?access_token=LongAssIDGoesHereaaaaaaaaaaadsfsdlkfajasdlkfjklasdjflk")
	get url it	
	put it into field 1

To get a random ‘friend’ and ID from the above query:
	set the itemDelimiter to "{"
     	put field 1 into tField
     	put "{" & quote & "data" & quote & ":[" into tPrefix
	if char 1 to 9 of tField is tPrefix then delete char 1 to 9 of tField
	put the number of items of field 1 into tLine
	put random(tLine) into tNum
	put item tNum of tField into tItem
     	set the itemDelimiter to quote
     	put item 4 of tItem into tName
     	put item 8 of tItem into tID
     	if last char of tName is quote then delete last char of tName
     	if last char of tID is quote then delete last char of tID
     	put tName & cr & tID into field 2

To get the profile picture of that random friend then any of these works:
	get ("https://graph.facebook.com/" & tID & "/picture?type=square”)

	get ("https://graph.facebook.com/" & tID & "/picture?type=small”)

	get ("https://graph.facebook.com/" & tID & "/picture?type=large”)

	get ("https://graph.facebook.com/" & tID & "/picture?width=400&height=400”)
	get url it
	put it into image 1

I have read all of the forum issues and have asked here on the use list before for any current solutions but it seems like no one is doing this??????
Any solutions?

Is there an interest in two way/ multi platform integration with Facebook? If so is there a monetary interest as well? It is my understanding that this would require about  1K to have created into an easy to implement solution. So is it possible to raise the money to have this written? 

My app idea is really simple and I don’t plan on making much money (if any) on it but I really want to publish it. But it is no good without the friends of the current users profile pictures. 

I would be willing to contribute to this project and need to know if there is any others that would be interested in contributing to it as well?

-- Tom McGrath III
mcgrath3 at mac.com

More information about the Use-livecode mailing list