Skip to main content

The New Facebook Wall Publishing method Stream.publish

As recently facebook stopped supporting the feedstory publishing method to publish news on users wall and application developers from now on can't create feed templates. Facebook released a new methods to do so which are:


I figured out those new methods when I was building a new facebook application yesterday to predict who will win the soccer match between Egypt and Algeria tonight. It took me sometime to succeed in publishing the story on the wall, so I will share with you my experience and how I solved it out in Coldfusion.

As I build my applications using the work of Andrew Duckett who created the Facebook Rest Client Component, I will start from FacebookFBMLCLient.cfc file which contains the methods that communicates with facebook APIs.

As I have used one of the three methods above which sounded the best as I guess, this example will be based on stream.publish method.

The first step is to add the following method to the FacebookFBMLCLient.cfc file:

<cffunction name="publishStream" access="public" output="false" returntype="any" hint="Publish on Wall">

<cfargument name="session_key" type="string" required="true" hint="the session id of the logged in user">

<cfargument name="to_ids" type="string" required="true" hint="ids of all the friends user has chosen">

<cfargument name="message" type="string" required="true" hint="message">

<cfargument name="attachment" type="Any" required="true" hint="JSON Object">

<cfargument name="action_links" type="Any" required="true" hint="JSON Object">

<!--- local vars --->

<cfset var params = StructNew() />

<!--- the api call --->

<cfset params["session_key"] = arguments.session_key />

<!--- <cfset params["uids"] = arguments.to_ids />--->

<cfset params["message"] = arguments.message />

<cfset params["attachment"] = arguments.attachment />

<cfset params["action_links"] = arguments.action_links />

<!--- Invoke stream.publish API --->

<cfset sendNoteVar = xmlToStructParam('',params) />

<cfreturn sendNoteVar />


The second step is that you need permission from the users of the application to grant the method permission to publish on their walls, this can be done in many ways see this link, in my application I ask the permission from users when they submit the form, which I believe is the best way. So if you are using a form in your application you may get the permission to publish on users wall by By including the promptpermission attribute in the form as below:

form name="Form" promptpermission="publish_stream" action="Action.cfm" method="post">

The third step is to call the publish stream method:

cfset attachment = '{"properties":{"Votes":{"text":"Members Voted: (#eg# Votes for EGYPT)(#al# Votes for ALGERIA) (No Winner #equ#)","href":"#faceBookPath#/#appName#","rating":"rate"}},"media": [{"type":"image","src":"","href":""}]}'>

cfset action_links = '[{"text":"Make Your Prediction","href":"#faceBookPath#/#appName#"}]'>

cfset #FBMLClient.publishStream(session.fb_session_key,session.fb_uid,answer1,attachment,action_links)#>

The attachment and action_links must be in JSON format, any simple format mistake will prevent the attachment or the action_links from being published, so you should be careful.

Please note that I didn't use all options that can be published using Stream.Publish method, you may add more options to your code see the list of media and other options here.

I believe thats all what you need to publish to wall using the new facebook api's, if you need any help or have any question please add a comment to the article.


  1. Nice post. Is there any chance you can add a link to download all the files you talk about? Thanks.

  2. I will post a full tutorial with the code soon

  3. Hi,
    Though it sounds good but bit tough to make it functional.If can you please provide a sample code regarding facebook wall publishing then it would be helpful for me.

  4. I will upload a full example soon.

  5. Would really like to see the full example. Great work Mustafa! /herve

  6. Is there a way to post to many wall at the same time ?


  7. In your function call what is answer1? Also I cannot find the function 'xmlToStructParam' anywhere in FacebookRestClient.cfc - where are you getting it from? Trying to get this working. Thanks!

  8. Answer1 is a variable that is to be published on the wall, it is a string variable.

    For the xmlToStructParam it is a coldfusion function.

  9. Is there any chance you can add a link to download all the files you talk about? Thanks.

  10. Please go to this post and copy the post and save them as advised, the link is:

  11. Is there a way to post to many wall at the same time ?

  12. Yes you can, just go to this example:

    now replace the code below:


    With the code below:

    Now this loop will publish to all ur friends walls.

  13. it looks the code is not appearing in the comment contact me on mustafa at abusalah dot info

  14. Hi Mustafa, I am trying to use your code but I am getting this error:
    Variable XMLTOSTRUCTPARAM is undefined.

    I just have the .cfm file and I am calling the function and passing the parameters...what am I doing wrong?

  15. This is an old method by now, please see this post:

    This is 100% working and up to date.


Post a Comment

Popular posts from this blog

Error: Write to Disk Access Denied - Troubleshooting - BitTorrent

I have downloaded Bit Torrent software and when trying to download I got an error after few seconds saying: Error: Write to Disk Access Denied Solving this problem is so simple: Shut down BitTorrent program. Go to Start and in the small search box on top of windows start button start typing Bittorrent and the program will show, right click with the mouse on the icon and Run as Administrator. All ur problems are sorted out now and you can enjoy downloading... Good Luck.

Coldfusion Facebook Graph API publish to your wall and your friends walls

In this tutorial we will learn by full coldfusion Graph API code example how to publish on your wall and your friends walls. This application uses new oauth authentication method. The code is divided into four files: we will first start with a file called index.cfm: <cfoutput>         <!--- Your FB application IDS --->       <cfset api_key = ""/>     <cfset secret_key = ""/>     <cfset appID = ""/>     <!--- create a connection to the fb graph cfc --->     <cfset graphCFC = createObject("component", "graph").init(#appID#, #api_key#, #secret_key#) />     <!--- If user is authenticated or his access token is set create a cookie --->        <cfif not isdefined("cookie.access_token") and isdefined("url.access_token")>         <cfset cookie.access_token=url.access_token>     </cfif>     <!--- If the user is authenticated and access token

IDLE subprocess didn't make connection Python 3.7

After installing Python on Windows 10. When trying to open IDLE, Python's IDE, you might get a  message saying that " IDLE's subprocess didn't make connection . Either IDLE can't start a subprocess or personal firewall software is blocking the connection ". To solve this issue just run IDLE as an Administrator, by right click on the IDLE icon and click Run as administrator. See Photo below: