abjerner / Skybrud.Social

Skybrud.Social is a framework in .NET for integration with various social services like Twitter, Facebook and Instagram. The framework will handle all the technical parts and API communication so you don't have to.
http://social.skybrud.dk/
MIT License
96 stars 32 forks source link

Using Skybrud Social Posting to Facebook using Facebook user id and access token #75

Closed Dee4GitHub closed 5 years ago

Dee4GitHub commented 7 years ago

Hi,

I have required permission to post on user's Facebook Timeline. I am not clear how to use Skybrud social to post to user's timeline. Is there an example to do this via Skybrud social.

I am using 7.6.1 version of umbraco and have the latest Skybrud social installed from August 26, 2017.

There is a class called SocialPostData, I am not clear how to use it as it has different methods which are undocumented and not clear how to pass information to construct facebook post.

Looked at the documentation on http://social.skybrud.dk/facebook/endpoints/posts/

Could you please provide an example to post to facebook using user's Id and access token and sample post parameters like message, story, image, video? image

thanks, Deepak

abjerner commented 7 years ago

@Dee4GitHub Skybrud.Social is primarily made for reading from the various APIs, so posting content back to the APIs is pretty much not supported not supported at the moment.

Right now you have probably installed Skybrud.Social and possibly also Skybrud.Social.Umbraco. For the Facebook part, Skybrud.Social will soon be replaced by Skybrud.Social.Facebook, which then lets you do something like:

@using Skybrud.Social.Facebook
@using Skybrud.Social.Facebook.Options.Posts
@using Skybrud.Social.Facebook.Responses.Posts
@inherits WebViewPage<FacebookService>

@{

    FacebookCreatePostResponse response = Model.Posts.CreatePost(new FacebookCreatePostOptions {
        Identifier = "me",
        Message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id enim vel tellus eleifend malesuada sit amet nec tortor. Suspendisse pretium ut lectus et convallis. Mauris rutrum nisl et tellus cursus aliquet.",
        Link = "https://www.skybrud.dk/"
    });

    <pre>@response.Body.Id</pre>

}

Skybrud.Social.Facebook is however still in beta, and probably not compatible with the Umbraco package. Alternatively, if you wish to stick with Skybrud.Social for now, you can use this class for inspiration:

https://github.com/abjerner/Skybrud.Social.Facebook/blob/master/src/Skybrud.Social.Facebook/Options/Posts/FacebookCreatePostOptions.cs#L103

Dee4GitHub commented 7 years ago

Hi,

Thanks for replying to my post.

First of all, to clarify your thoughts, I am using Skybrud.Social.Umbraco. Yet, I am unable to post videos or images along with the story or post. In your sample, I want to publish a full blown post with message, link, video and or image into facebook using Skbrud.Social.Umbraco. Your example only shows very simple scenario of text and link in the post. How about other fields like video, picture/image, caption etc?? Thats where I am struggling to understand how Skybrud.Social.Umbraco works.

abjerner commented 7 years ago

@Dee4GitHub What you're looking for is not possible with Skybrud.Social and Skybrud.Social.Umbraco at the moment, as posting to the Facebook Graph API has been outside the scope of the package. You might still be able to use some of the underlying logic to do it anyways, but I don't have any examples for that.

In Skybrud.Social.Facebook (which again is still in beta), I've tried adding support for some of that. Like the Message property in my example, you can also specify a Caption and a Picture property - these are however not supported in v2.9 and newer of the Facebook Graph API as Facebook has deprecated them. With the new versions of the Graph API, it is no longer possible to specify a caption. To specify a picture, you should first upload it to an album and the user, and then reference it when creating the post - but this is also currently not supported by my package at the moment.

abjerner commented 5 years ago

Closing due to inactivity.