Search code examples
facebookfacebook-wall

Post to user's wall as if it is them posting


I have an app and I am able to post to a user's wall when they allow it. However, when the app makes a wall post, it shows that it is from me (the administrator of the app) posting on the user's wall. I want it to look like it was the actual user posting on their own wall... (using VS 2008, .Net 3.5)

Here is my code...

    Dim oFB As Facebook.FacebookClient
    Dim sAppId As String = "my app id"
    Dim sAppSecret As String = "it's a secret"

    Dim webClient As System.Net.WebClient = New System.Net.WebClient()
    Dim result As String = webClient.DownloadString("https://graph.facebook.com/oauth/access_token?client_id=" & sAppId & "&client_secret=" & sAppSecret & "&grant_type=client_credentials")

    '- Access token changes every hour
    oFB = New Facebook.FacebookClient(sAppId, sAppSecret)

    oFB.AccessToken = result.Substring(result.IndexOf("=") + 1)

    Dim oPost As Collections.Generic.IDictionary(Of String, Object)
    oPost = New Collections.Generic.Dictionary(Of String, Object)
    oPost.Add("message", "(websitepipeline test post) Check out this new product!") '- This is the wall post / the description input for the DM function
    oPost.Add("link", "http://www.example.com/content/somepage.html")
    oPost.Add("from", "the user who authenticated")
    oFB.Post("the user who authenticated/feed", oPost)

Solution

  • Here's a link to a library someone made for .NET that it wraps around ;) [link]http://www.lagorio.net/windows/facebook/) Obviously you will need to present a FBDialog asking the user for his credentials of course! :) Not too sure what library your using but maybe the string for "from" is incorrect or needs to be a user token of some sort

    Use the .setStatus command w/ this API.