Hi Rob,
Thanks for the reply… to give you a bit more info, a client of mine wants the functionality that users can post pictures to their Facebook page.
I figured that if I could mention a page, this would be a neat solution, so I’ve been reading the Facebook docs here:
https://developers.facebook.com/docs/opengraph/guides/tagging/#mentions
At the moment I’m trying to just post a message to Facebook that mentions a company. Here’s my code:
[lua]local facebook = require “facebook”
local fbAppID = FACEBOOK-APP-ID-STRING
local access_token = “”
local function onLoginSuccess()
facebook.request( “me/feed”, “POST”, {message=“This is a test post mentioning company @[COMPANY-FACEBOOK-PAGE-ID]”} )
end
– facebook listener
local function fbListener( event )
if event.isError then
native.showAlert( “Oh No!”, “Something has gone wrong!”, { “OK” } )
else
if event.type == “session” then
access_token = event.token
if event.phase == “login” then
onLoginSuccess()
elseif event.type == “loginFailed” or event.type == “loginCancelled” then
native.setActivityIndicator( false)
native.showAlert( “Oh No!”, “Something has gone wrong!”, { “OK” } )
end
elseif event.type == “request” then
native.setActivityIndicator( false )
native.showAlert( “Success!”, “The message has been posted to your wall.”, { “OK” } )
end
end
end
local function fbLogin( event )
native.setActivityIndicator( true )
facebook.login( fbAppID, fbListener, { “publish_stream” } )
end
[/lua]
The problem is that at the moment it’s posting to Facebook, but not mentioning the company - instead it shows this:
“This is a test post mentioning company @[COMPANY-FACEBOOK-PAGE-ID]”
ie it posts a long number instead of actually mentioning the Company name and linking to their Facebook page. I have the following ideas where I might have gone wrong:
i) I’m not using the access_token appropriately. I’ve basically followed what’s written in the Corona docs (http://docs.coronalabs.com/api/library/facebook/login.html), but I don’t understand whether or not I’ve used the access_token correctly, or whether I’ve just retrieved it and now need to use it (e.g. in facebook.request).
ii) Perhaps I need to “enable both tags and messages capabilities for your action type”, which is what’s suggested in the Facebook docs for when you’re mentioning a friend (although it doesn’t specifically state this for mentioning a page)
iii) Perhaps what I want to achieve isn’t even possible from an Android/iPhone app… I have been suggested this after doing some reading around online, but some of the posts were quite old - I’m not sure they’re relevant anymore
Rob or anyone else, do you reckon you can point me in the right direction?