Posting on Facebook Friend's Timeline/Wall with v4

Hi,

The sample Facebook v4 app included with the Corona SDK has very good examples on how to post to your own timeline including links, photos, messages, etc. However, I do not see where it has any examples of posting on friends’ timelines.

Does anyone have any examples where they have had success in posting to FB friends’ timelines using v4?

I am trying to present the user with a list of their friends who do not currently have the app installed, allow them to select the ones they wish to invite, then have the app send those users a game request. Seems simple but I am having a dickens of a time getting it to work.

The sample code below appears to do all that I need. I even get a response from FB that says the game request was sent successfully. However, the request never shows up on any of the friends’ timelines.

(Even better would be if the post were a private message and could bypass the timeline altogether but I won’t be that picky!)

Thanks ahead of time!

Scott

local facebook = require( "plugin.facebook.v4" ) local util = require("Utility") local function inTable( table, item ) for k,v in pairs( table ) do if v == item then return true end end return false end function facebookListener( event ) print("facebookListener") util:print\_r(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then accessToken = event.token if accessToken == nil then local alert = native.showAlert( "Notification", "Facebook error. Please check your Facebook credentials.", { "OK" } ) else if facebook.isActive then local accessToken = facebook.getCurrentAccessToken() if accessToken == nil then print( "Need to log in" ) facebook.login( listener ) elseif not inTable( accessToken.grantedPermissions, "publish\_actions" ) then print( "Logged in, but need permissions" ) facebook.login( listener, {"publish\_actions"} ) else print( "Already logged in with needed permissions" ) util:print\_r(accessToken) facebook.showDialog( "requests", {message="You should download this app!", filter="APP\_NON\_USERS"}) end else print( "Please wait for facebook to finish initializing before checking the current access token" ); end end end elseif ( "request" == event.type ) then print( "request" ) elseif ( "dialog" == event.type ) then print( "dialog" ) --util:print\_r(event.response) facebook.logout() elseif ( "friends" == event.name ) then print("friends") else print("none of the above", event.type) end end print("start facebook login") facebook.login( facebookListener, {"public\_profile","email","user\_friends"} )

Output from code:

UPDATE: A little more digging revealed that the requests were actually making it to my FB friend only they did not show up on his wall nor did he get an actual notification. Instead, we found them in the FB app center. You can get there by going to http://www.facebook.com/games/activity while logged into FB. The requests were all listed under the “Invites” section.

Since my app has not been published yet, I decided to add my FB friend as a “test user” within the FB developer portal. Once I did that he started receiving all the notifications correctly via the above code.

UPDATE: A little more digging revealed that the requests were actually making it to my FB friend only they did not show up on his wall nor did he get an actual notification. Instead, we found them in the FB app center. You can get there by going to http://www.facebook.com/games/activity while logged into FB. The requests were all listed under the “Invites” section.

Since my app has not been published yet, I decided to add my FB friend as a “test user” within the FB developer portal. Once I did that he started receiving all the notifications correctly via the above code.