Type Function
Return value Event
Revision Release 2024.3703
Keywords Facebook, request
See also facebook.*


Get or post data to the logged-in Facebook account. Can be used to post messages and photos to the account and friends' accounts. Can also be used to get user data and recent posts.

The request comes back in the form of a fbconnect event that is sent to the listener specified within facebook.setFBConnectListener() or facebook.login().


facebook.request( path [, httpMethod] [, params] )
path (required)

String. The Facebook Graph API path, for example "me", "me/friends", or "me/feed".

httpMethod (optional)

String. "GET", "POST", or "DELETE". If not specified, defaults to "GET".

params (optional)

Table. Table of key/value pairs passed as arguments to the Facebook API call. For more information, see this document.


Post Message
-- Post a message to the user's account
facebook.request( "me/feed", "POST", { message="Hello Facebook" } )
Open Graph Object
-- Create a user-owned Open Graph object for an episode of The Simpsons
local episodeObject = {
    object = "{\"fb:app_id\":\"[YOUR FACEBOOK APP ID HERE]\",\"og:type\":\"video.episode\",\"og:url\":\"https:\/\/www.simpsonsworld.com\",\"og:title\":\"Treehouse\ of\ Horror\ XXVI\",\"og:image\":\"https:\/\/upload.wikimedia.org\/wikipedia\/en\/e\/e6\/Treehouse_of_Horror_XXVI_poster.jpg\"}"
facebook.request( "/me/objects/video.episode", "POST", episodeObject )