C# - Facebook Connect - How To Post To User's Wall Using Graph API
Jul 26, 2010
I've integrated my website with Facebook Connect, authorization/single-sign on all working great.
Now im trying to post something to the user's wall, which im having some problems with.
First of all, im using the "old" JavaScript API (FeatureLoader.js).
These are the Graph API URL's im using:
private const string UserDetails_Url = @"https://graph.facebook.com/{0}?access_token={1}";
private const string Feed_Url = @"https://graph.facebook.com/{0}/feed?access_token={1}";
private const string TokenExchange_Url = @"https://graph.facebook.com/oauth/access_token?{0}";
I'm using the TokenExchange_Url URL to receive the unique user OAuth token to make calls with.
This is working fine, because a) i receive the token back, and b) i can issue HTTP Get Requests to the Graph API (i.e UserDetails_Url) and it works fine.
But, i cannot Post to the User's wall using the Feed_Url.I'm pretty sure the issue is i haven't got the appropriate user permissions to post to a wall (i.e facebook-side setting).
Now, i realise i can use the fbPublish API method client-side to do this, but i want to do it server-side with the Graph API.
I wont bother showing my code which attempts the call to the Graph API to post to the user's wall, as its pretty straightforward (HttpWebRequest, set method to "POST', set content type/length, write bytes to Stream, etc).
I think the problem is i need the user to grant my aplpication "publish_stream" extended permissions.
The Facebook Graph API doco says to do this in your authorization request:
https://graph.facebook.com/oauth/authorize?
client_id=...&
redirect_uri=http://www.example.com/callback&
scope=user_photos,user_videos,publish_stream
Which confuses me because im using the following URL to get the OAuth token:
https://graph.facebook.com/oauth/access_token?bunchofqsparams
Am i using the wrong Token Exchange URL? Why is there two different URL's to seemingly get the same piece of information?
Yes - i have read the Facebook API doco (numerous times), and yes i have read other similar SO questions, but they all result in using the client-side API to publish to wall, i want to do it server side.
For the actual "Facebook Connect" button, i'm using the standard FBML:
<fb:login-button length="long" size="medium" autologoutlink="false" background="light" onlogin="facebookLogin('/login')" class=" fb_login_not_logged_in FB_login_button FB_ElementReady"><a id="RES_ID_fb_login" class="fbconnect_login_button"><img id="RES_ID_fb_login_image" src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif" alt="Connect"></a></fb:login-button>
When i click this (and not logged into Facebook), it pops up a window which the user can login. But it doesnt have the "Request Extended Permissions" dialog - shouldnt it? Or is that another popup i need to manually trigger?
So to sum up, here are my questions:
How do i grant extended permissions to publish to the user's wall?What is the correct URL for obtaining an OAuth token?Is there a definitive source for showing how to post to a user's wall using server-side Graph API calls?
View 1 Replies
Similar Messages:
Nov 15, 2012
how to post feed OUR wall. now, my friend wall, using their ID.tried with
FaceBookConnect.Post(ViewState["Code"].ToString(), "/<friend ID>/feed", data);
--> failed :-(
FaceBookConnect.Post(ViewState["Code"].ToString(), "/<friend ID>/notes", data);
--> also failed
also tried with : "/<friend ID>/notes" which also failed.
View 1 Replies
May 7, 2015
i want to post an image or photo into users facebook wall without using Fileupload control.i have retrieved an Image from my database in .bmp format and i want to post that bmp image into facebook wall. i don't want to use Fileupload controls.
View 1 Replies
Sep 24, 2012
i have find the way how can i find user id now the question is
with the use of user id how can i post on facebook wall when the user is not login
what info i need to store in database ?
View 1 Replies
Aug 6, 2012
code to integerate twitter and facebook in my application,
View 1 Replies
May 7, 2013
How user post comment on my website using gmail ,fb,yahoo ,hotmail account ...
how to apply this.. [URL] ....
View 1 Replies
Jan 24, 2011
I want Post to Wall Post functionality in facebook fan page application. I am developing it using ASP.Net. I am using javascript sdk and applying strem.publish method. Below is th code which i have used.
[Code]....
View 1 Replies
Mar 16, 2010
I'm using an ASP.NET Facebook Developers Toolkit (http://www.codeplex.com/FacebookToolkit) on an external website, and I'm also the admin of a facebook fan page for the website. Users on my website (may or may not be facebook users) create content articles.
I would like to hook up these articles to the Facebook fan page, so that, when they write the article, then ones with FB accounts can sign into FB and post on the Fan page. I'm sure they would need to be a fan first.
View 1 Replies
Sep 11, 2012
I can able to post now FB comment post from asp.net system but if i want to schedule some message from my sytem what can i do ? How can i store FB account ?
View 1 Replies
Feb 25, 2013
How do i post image on facebook wall from asp.net
View 1 Replies
Oct 15, 2010
I am creating Fan page and application for Post something in Fan page wall from ASp.net page. But Text get post Nicely. But Images and attachments not get post in my wall. Is ther any way to Pass HTML code from asp.net to post in my Facebook Fans page Wall.
View 2 Replies
Oct 5, 2012
i have an app to post on friends wall but i want it to prompt to choose from friends like adding friends by checkbox so that the messsage can be sent to all i selected simultaneously.
View 1 Replies
Aug 27, 2013
I am trying to post a image on multiple users ids wall. I have tried your code it is successfully posting the image on my wall.
I was given different user ids, My requirement is to post the same image on their wall individually is it possible?
View 1 Replies
Mar 27, 2011
i wrote an application for facebook but i couldn't upload image to album that i created,
code is in below
Facebook.FacebookAPI api = new Facebook.FacebookAPI(GetAccessToken());
Dictionary<string, string> album = new Dictionary<string, string>();
album.Add("name", "Test Album");
album.Add("message", "Message here!");
JSONObject result = api.Post("me/albums", album);
string AlbumId = result.Dictionary["id"].String;
Dictionary<string, string> photo = new Dictionary<string, string>();
photo.Add("message", "test Message");
photo.Add("source", "tgw.jpg");
JSONObject photoResult = api.Post("/" + AlbumId + "/photos", photo);
View 1 Replies
May 7, 2015
I am using the code to post on facebook wall from below url.
[URL]...
This works fine only if the developer from which the app is created. But its not working for any other logins.
View 1 Replies
Nov 16, 2013
I'm writing applications on Facebook located on an external website ASP.NET C #. The application should check whether or not a person likes my Fan Page (page) on Facebook, and if he or she doesn’t like it needs to like it before using this application. How this can be done using the Graph API and ASPSnippets Facebook API.
View 1 Replies
Feb 28, 2011
I have this requirement of fetching facebook user information like friends count and other basic information and integrate to our website.
I currently use facebook graph to ask user to authorise, fetch information and store in my database.
When their say, friend count changes how do I update my database without asking user to trigger it manually.
Is there a special permission where i can fetch user data when he/she isnt logged in.
I have seen this somewhere but not sure of the permission.
Or does facebook have any feature of publishing information on subscription ?
View 2 Replies
Mar 17, 2011
I am tying to get the work information from a facebook user using Graph API
When I use the Graph API and get the User object, it contains work information, which is essentially a list of the work history. The list elements contain nodes of employer, location, description, etc...
The FQL return it as a JsonObject, how do i get the the value employer out of it. I am only interested in the last employer. I tried something below but could not get it working.
[Code]....
There is more information that says it return the "work_history" as an array
http://developers.facebook.com/docs/reference/fql/user/
View 7 Replies
Jan 22, 2013
I was implementing codes taken from[URL] .... and [URL] ....
It works fine separatly but when i want to integrate it gives me an error "Bad Request......"at so how can i get user info and his friend list on login button.
protected void Login(object sender, EventArgs e)
{
FaceBookConnect.Authorize("user_photos,email,friends_photos", Request.Url.AbsoluteUri.Split('?')[0]);
}
protected void Page_Load(object sender, EventArgs e)
[Code] ....
View 1 Replies
Aug 20, 2012
I have website with facebook like box for facebook page (eg, abc) . Now if any new post in their at website it will automatically post at wall or not.
View 1 Replies
Mar 26, 2010
I like to send messages when I want from my aspx webpage. I used the different examples and used FaceBook API 3.1. I am getting error as "service temporarily unavailable". I have assigned AppKey, Secret Key and session key. My sample code is below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook;
using Facebook.Web;
using Facebook.Rest;
using Facebook.Session;
using Facebook.Utility;
using Facebook.BindingHelper;
using Facebook.Schema;
using Facebook.Web.FbmlControls;
using Facebook.Session.DesktopPopup;
namespace FaceBookApp
{
public partial class _Default : System.Web.UI.Page
{
private const string ApplicationKey = "MY_APP_KEY";
private const string SecretKey = "MY_SECRET_KEY";
private Api fbAPI;
private ConnectSession _connectSession;
// private List<EventUser> _eventUsers;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
_connectSession = new ConnectSession(ApplicationKey, SecretKey);
_connectSession.SessionKey = "MY_SESSION_KEY";
if (!_connectSession.IsConnected())
{
// Not authenticated, proceed as usual.
//lblStatus.Text = "Please sign-in with Facebook.";
}
else
{
// Authenticated, create API instance
fbAPI = new Api(_connectSession);
string response = fbAPI.Stream.Publish("publish steven on facebook.");
}
}
}
}
The error message is confusing. It must be a very simple solution. I don't know what I am missing. Here is the facebook exception.
{"Service temporarily unavailable"}
View 1 Replies
Jun 18, 2010
I am using Facebook Toolkit. I have appKey and appSecret, but I dont want that visitor need to conenct to facebook. I will use my login/passwork to get my wall posts.
View 1 Replies
Jan 25, 2011
Need the steps to show my facebook wall posts on my asp.net webiste/
View 3 Replies
Sep 16, 2010
I am making a db schema for facebook like wall structure. I need to save wall posts, share a link, share a video
stuff into my database. Till now I am able to make this schema :
GO
CREATE TABLE [Wall]
(
[ID] [int] NOT NULL IDENTITY(1, 1) ,
[PostText] [nvarchar](MAX)
[PostedByUserID] [int] NULL ,
[PostedOnUserID] [int] NULL ,
[DateCreated] [datetime] NULL
)
GO
Next I have to add the schema for adding the "share a link" and "share a video" feature.
GO
CREATE TABLE [Wall]
(
[ID] [int] NOT NULL IDENTITY(1, 1) ,
[WallText] [nvarchar](MAX)
[PostedByUserID] [int] NULL ,
[PostedOnUserID] [int] NULL ,
[DateCreated] [datetime] NULL,
[SharedLink] [nvarchar](1024) NULL ,
[SharedLinkTitle] [nvarchar](512) NULL ,
[SharedLinkDesc] [nvarchar](512) NULL ,
[SharedLinkImageSrc] [nvarchar](512) NULL
)
GO
Now with this schema:
1st case: When the wall post is inserted the [SharedLink], [SharedLinkTitle],[SharedLinkDesc], [SharedLinkImageSrc] columns will be inserted as null and rest of the columns will have the values.
2nd case: When the "link shared" is inserted the "[WallText]" column will be inserted as null and rest of the columns will have the values.
For my case 70% of the time the wall post will be made and 30 % "links" will be shared which means 70 % of the cases [SharedLink], [SharedLinkTitle],[SharedLinkDesc], [SharedLinkImageSrc] will be inserted as null. Now my concern is that is it okay to keep the null columns inserted or I should go for a separate table for "shared a link" purpose and have the separated table like this:
GO
CREATE TABLE [LinkShared]
(
[ID] [int] NOT NULL IDENTITY(1, 1) ,
[PostedByUserID] [int] NULL ,
[PostedOnUserID] [int] NULL ,
[SharedLink] [nvarchar](1024) NULL ,
[SharedLinkTitle] [nvarchar](512) NULL ,
[SharedLinkDesc] [nvarchar](512) NULL ,
[SharedLinkImageSrc] [nvarchar](512) NULL
)
GO
I have to go in similar manner to add the schema for sharing the videos further. Please guide me in which direction should I move?
View 1 Replies
Jun 10, 2010
Basically, I would like to include my latest Wall posting on my website. But, so far, everything I have read needs the visitor to the site to log-in to Facebook which, in theory, would then retrieve their latest Wall post. In prinicpal, I guess it would be like an RSS Feed.
View 1 Replies