Try our conversational search powered by Generative AI!

Auto post to Facebook at content published


Hi there again.

In the project I am currently working on the client wants pages of a certain page type to be posted to their facebook page at publish. I have struggled with this the whole day not knowing which approach to choose. I have figured out a couple of solutions but there may be a better one.

1. Hook up a event to the ContentPublished event in DataFactory which posts the page name, description, link and an image to facebook using Facebook C# SDK (Graph API).

2. Create a RSS feed with all the latest pages and let a third-party application do the magic. This application would probably be RSS Grafitti.

The second solution would be the easiest to implement but may not be as direct as a post to facebook at the published event. It would also post as the third-party application and not trough the page (or a page custom application). The first solution would look best and I think it suits the client better but there is a problem with this solution. The problem is that offline_access for access_tokens are no longer supported meaning that a new access_token has to be generate each session. This needs to be done by sending the user to a facebook authorization page with a callback before we can post it to the facebook page (see this tutorial:

I did try doing a response.redirect at the published event but then EPiServer would not publish the page (perhaps because it does not expect the page to send a redirect call). One solution would be to open a new window but I really do not know how.

Does anyone have a better approach or some clues on how to solve my problem?

Thanks in advance,

David Rutqvist.

Jul 15, 2013 14:47

I came up with a third solution and will use that for now. The third solution was to set an application state varabel with the contentlinkID and then call a JS-script in the next load of the page in edit mode. This next load will be when episerver refreshes the page after publishing it.

Edited, Jul 16, 2013 11:12
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.