LATEST VERSION 1.5 (21.02.2016)

Description

facebook (1)Current FLASH team research concerns developing new robot competencies and examining the possibility of establishing and maintaining relationships with humans during long-term interaction. The human need for information will stimulate contacts with personal robot, and the variable nature of information will assure non-schematic interactions. Therefore, social robots must be enriched with functions allowing people to find and read news from the Internet, utilize search engines, communicate via social networking services like FB, text messages, MMS and e-mails. 

UFacebook is a module enabling URBI to handle Facebook social networking service. It enables the robot to post new stories, upload photos (eg. from his camera), retrieve posts and a perform a variety of other tasks that your FB app might require. With the module you can use our official "FLASH Connect" facebook application or create your own app. 
 
facebook (1)You can find more info about FLASH Connect here:
By clicking "Log In" below, the app will receive: your friend list, your email address, your profile info: birthday, groups, likes and location, your events, your photos. This app may post on your behalf, including status updates, photos and more.
If you would like to use your own app you must change APP_ID in the sources and recompile the module. It is also easy to extend the module by adding new fields and more detailed information from wall or user profile.

Requirements

The module is utilizing cURL library with SSL-based communication (OpenSSL). cURL is free and open software for transferring data with URL syntax. UFacebook was compiled with all the shared libraries (all included in ufacebook1x.zip package). Copy them to the uobjects folder or set path in system environment variable (PATH). 
  • libcurl.dll
  • libeay32.dll
  • ssleay32.dll

How to run

First of all, connect "FLASH Connect" app with your FB account (described above). Click FB login button below
 
 
 
Next 5 screenshots show how to start using UFacebook module in URBI-based robot control system:
 
facebook (2)  facebook (3)  facebook (4)  facebook (5)  facebook (6)
 

Module functions

Main Functions

UFacebook.new("locale") - set locale of the API, eg. "en_US"
see https://www.facebook.com/translations/FacebookLocales.xml 
UFacebook.Login("user", "password", check_permissions) - log in,
user - facebook login,
password - login password,
check_permission - request the permissions scope for your app (bool value). 
 Permissions are strings that are passed along with a login request. When you set check_permission to true, the following scope will be requested from the person using your app (eg. FLASH Connect):
"read_stream" - provides access to all the posts in the person's news feed,
"read_mailbox" - provides the ability to read from a user's Facebook Inbox,
"email" - provides access to the user's primary email address,
"manage_notifications" - enables your app to read notifications,
"publish_actions" - enables app to post content, comments and likes to a user's stream,
"user_birthday" - provides access to the birthday with year as the birthday property,
"user_location" - provides access to the user's current city,
"user_likes" - provides access to the list of all of the pages the user has liked,
"user_photos" - provides access to the photos the user has uploaded, and photos the user has been tagged in,
"user_friends" - grants the app permission to read a list of friends who also use your app,
"user_events" - provides access to the list of events the user is attending,
"user_groups" - provides access to the list of groups the user is a member.
 You can also manually set multiple permissions. In this case set check_permission to false and use the slot below. 
UFacebook.SetPermissions(["permission1","permission2",...,"permission"]) - manually set permission scope,
UFacebook.errorMessage; - error message received from FB service,
UFacebook.errorCode; - error code received from FB service,
UFacebook.errorSubCode; - error subcode received from FB service.

User functions

UFacebook.GetUser("user_id") - get user info (see slots below),
UFacebook.userID - The id of user account, this ID is unique to each app and cannot be used across different apps,
UFacebook.userName - user's full name,
UFacebook.userFirstName - user's first name,
UFacebook.userLastName - user's last name,
UFacebook.userGender - gender pronoun selected by the user,
UFacebook.userBirthday - user's birthday in the format MM/DD/YYYY (user_birthday permission required),
UFacebook.userLocation - user's current location as entered by them on their profile (user_location permission required),
UFacebook.userEmail - user's primary email address listed on their profile (email permission required),

Like functions

UFacebook.GetUserLikes("user_id") - get user's likes,
UFacebook.userLikeID; - like's ID,
UFacebook.userLikeName; - like's Name,
UFacebook.userLikeCategory; - like's category,

Posts/Feed/Home functions

(read_stream and publish_action permissions required)

UFacebook.GetPosts("user_id", limit, "mode") - returns posts
limit - number of posts,
mode:
"posts" - get posts created by the user (on their own wall or the wall of a friend); these may include any kind of content such as shared links, check-ins, photos and status updates,
"feed" - all the things that a user might see on his own wall, shared links, check-ins, photos and status updates. This also includes posts made by friends on the user's wall,
"home"-  all the posts created by the user and their friends, i.e. the content of “News Feed” on Facebook,
UFacebook.PutPost("user_id", "message") - post a message,
UFacebook.postID - post id number,
UFacebook.postFromID - the ID of the user who posted the post,
UFacebook.postFromName - the full name  of the userwho posted the post,
UFacebook.postMessage - post message content,
UFacebook.postType - indication of the object type of this post (link, status, photo, video),
UFacebook.postStatusType - description of the type of status update (mobile_status_update, created_note, added_photos, added_video, shared_story, created_group, created_event, wall_post, app_created_story, published_story, tagged_in_photo, approved_friend),
UFacebook.postStory - text from stories unintentionally generated by users, such as those generated when two people become friends, or when someone else posts on the person's wall,
UFacebook.postObjectID - the ID of any uploaded photo or video attached to the post,
UFacebook.postDescription - a description of a link in the post,
UFacebook.postCaption - a caption of a link/photo in the post,
UFacebook.postUpdatedTime - the time of the last change to the post, or the comments on it.

Statuses functions 

(read_stream and publish_action permissions required)

UFacebook.GetStatuses("user_id", limit) - returns only status updates posted by the user on his own wall,
UFacebook.statusID - the status message ID, 
UFacebook.statusFromID - the ID of the user who posted the message, 
UFacebook.statusFromName - the full name of the user who posted the message, 
UFacebook.statusMessage - the status message content, 
UFacebook.statusUpdatedTime - the time the message was published.

Photos functions 

(user_photos permission required)

UFacebook.GetAlbums("user_id") - get all user albums,
UFacebook.albumID - the album ID,
UFacebook.albumName - the title of the album,
UFacebook.albumCount - number of photos in this album,
UFacebook.albumType - the type of the album (app, cover, profile, mobile, wall, normal, album),
UFacebook.albumCanUpload - whether the viewer can upload photos to this album.

UFacebook.GetPhotos("album_id") - get all photos in the album,
UFacebook.PutPhoto("album_id", "name", "source") - send a photo to the album, 
name - brief description of the photo,
source - path or url of the photo,
UFacebook.photoID - the photo ID,
UFacebook.photoName - the user provided caption given to this photo,
UFacebook.photoSource - link to the image source of the photo,
UFacebook.photoUpdatedTime - the last time the photo or its caption was updated.

Notifications functions 

(manage_notifications permission required)

UFacebook.GetNotifications("user_id") - get unread facebook notifications,
UFacebook.ClearNotifications("user_id") - clear all pending notifications,
UFacebook.notifID - the notification's ID,
UFacebook.notifFromID - the ID (of the user, page, app, etc.) that 'sent', or is the source of the notification,
UFacebook.notifFromName - the full name (of the user, page, app, etc.) that 'sent', or is the source of the notification,
UFacebook.notifMessage - the message text in the notification,
UFacebook.notifTitle - the message title text in the notification,
UFacebook.notifType - the notification type,
UFacebook.notifObjectID - the object (this can be a post, a photo, a comment, etc.) that was the subject of the notification,
UFacebook.notifUpdatedTime - when the notification was last updated.

Messages functions 

(read_mailbox permission required)

UFacebook.GetMessages("user_id", "mode") - get all unread or unseen messages, mode:
"unread" - get unread messages,
"unseen" - get unseen messages,
UFacebook.messageConversationID - the ID of a conversation, in a format similar to t_id.000000000000000,
UFacebook.messageFromID - the ID of the user who sent the message,
UFacebook.messageFromName - the ID of the user who sent the message,
UFacebook.messageMessage - the text of reply,
UFacebook.messageCreatedTime - when the notification was created.

Messages functions

 (user_groups permission required)

UFacebook.GetGroups("user_id") - get user groups,
UFacebook.groupID - the group ID,
UFacebook.groupName - the name of the group.

Friends functions 

(user_friends permission required)

Since April 30th, 2014 (FB API 2.0) friends list no longer includes the full list of a person's friends. Instead, it now returns the list of that person's friends who are also using your app.
 
UFacebook.GetFriends("user_id") - get friends using your app,
UFacebook.friendID - the friend's ID,
UFacebook.friendName - the name of the friend.

Events functions

(user_events permission required)

UFacebook.GetEvents("user_id") - get user's events,
UFacebook.eventID - the event ID,
UFacebook.eventName - the name of the event,
UFacebook.eventLocation - the location of the event, if any,
UFacebook.eventStartTime - start time of the event,
UFacebook.eventEndTime - end time of the event,
UFacebook.eventDescription - long-form description of the event.

Likes functions

UFacebook.GetLikes("object_id") - get list of  user's likes,
UFacebook.PutLike("object_id") - like something,
UFacebook.likeFromID - the like from ID,
UFacebook.likeFromName - the like from Name;.

Comments functions: 

UFacebook.GetComments("object_id") - get comments on object id,
UFacebook.PutComment("object_id", "message") - comment something,
UFacebook.commentFromID; - the ID of the user who commented,
UFacebook.commentFromName - the name of the user who commented,
UFacebook.commentMessage - comment text;.

Other functions:

UFacebook.DownloadContent("link", "path") - download content from the given link, eg. photo.

 

Urbiscript example

loadModule("UFacebook");
var facebook = UFacebook.new("en_US");
facebook.Login("XXXXXXXXX", "XXXXXXXXX", false);
facebook.GetUser("me");
echo(facebook.userName);
echo(facebook.userGender);
echo(facebook.userLocation); 
facebook.GetNotifications("me");
echo(facebook.notifFromName[0]);
echo(facebook.notifTitle[0]);
facebook.GetAlbums("me");
facebook.GetPhotos(facebook.albumID[0]);
facebook.PutPhoto(facebook.albumID[0],"It's me.","image.jpg");
facebook.DownloadContent(facebook.photoSource[0],"saved/");
facebook.GetPosts("me",-1,"feed");
echo(facebook.postFromName[0]);
echo(facebook.postMessage[0]);
facebook.PutPost("me","Hello world!");
facebook.GetPosts("me",-1,"feed");
facebook.PutLike(facebook.postID[0]);
facebook.PutComment(facebook.postID[0],"It's me!");

Download

LINK

 

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 0.8.0, 27.04.2016

FLASH Documentation