I ran across the problem recently trying to write to a users wall using the Facebook API. The Facebook documentation is hardly sane as it’s a mix of languages, not entirely up to date, and lacks good examples. The error messages are hardly ideal either. “A session key is required” at least leads me in the right direction. “Invalid parameter” is just unacceptable and makes me stabby.
So here’s some cleaned up pseudocode I pulled together that will hopefully be of use to others who bang their heads against the wall. This “works for me” in my limited testing over several days:
Getting the right permissions is key.
The thing that ends up being the most confusing is the session_key
. After reading the docs, I was inclined to do:
What you really want is:
You can also use adapt this to use stream.publish if you’d like.