Talk:Feed.publishUserAction
From Facebook Developer Wiki
Guys this is really stupid - your documentation clearly states the API key and blah blah blah needs to be accompanied with this call. However the example does not require the API key. The client code does not show the same requirements either. This is seriously frustrating! Sorry If I've simply made a mistake - but someone please explain it to me.
Thanks!
Could somebody PLEASE provide some kind of example for this, or tell me why this doesn't work: http://www.6112northwolcott.com/dij_dev/publishUserAction.php
I also tried json_encode($tokens) for the whole array to no effect.
The smiley example doesn't even seem to use this function at all.
I went ahead and added an example, but somebody who groks wacky-wicky markup is gonna have to make some minor edits...
Sorry!
548871286 21:36, 19 August 2008 (PDT) Can someone please why the function returns Array([0] => 0),
that is not false thanks.
12:28, 25 August 2008 (CET) I agree, specs say that it returns a boolean, while it returns an array.
However, you should get array('0'=> 1) as response if your user allows for the feed to be published
Could somebody with access please state it VERY CLEARLY that the 'required' parameters are not required when using the facebook PHP library from within the canvas (as in the PHP example) - that info colud have just saved me a couple hours :P - Hope it can help somebody else
It seems this code snippet & comment are incorrect: {{{ //There is no target for the story in this example, but if there was, //$target_ids would be an array of user ids $target_ids = array(); }}}
$target_ids needs to be a string containing comma separated of id's or the API throws an error... But the story still doesn't seem to get sent to my user's friends, it just doesn't throw an exception anymore...
[edit] How do you get the popup to show?
I assumed this method would show the popup like Visual Bookshelf does, asking you what size of story you would like to publish. I can't figure out how to get this to happen at all, any ideas? I can only get one line stories to publish. - 193700405 09:30, 30 September 2008 (PDT)
MY BAD! I was thinking of feed forms. - 193700405 09:40, 30 September 2008 (PDT)
[edit] Missing Error codes?
I'm getting the standard 102... it's not listed. Is it a bug I'm getting it, or is are the docs lacking?
I'm thinking the 102 is different than user nto giving permission -- in that I've taken too long to publish the story and the user hasn't given me offline-access? --543396022 16:03, 18 October 2008 (PDT)
- Good catch, Chris. Looking at the code, the docs were not matching up, so I fixed it up. -- Pete (User:563683308).
[edit] image size
Issues:
The width/height of the images is probably the same 30-100 range as the flash movie images, right?... Maybe the docs should explicitly list that.
If you provide an incomplete/bogus URL for 'src' or 'href' for 'images', there is no error message, but the story publishes anyway, with no image. Ditto if you have wrong array structure for 'images', which needs an array for the four potential images, and an array of 'src'=>'...','href'=>'...' Some kind of error/warning/notice feedback would have been nice, at least for the second case.
The return value is not boolean, at least not in PHP client, and should be documented as such, unless that's how all the PHP APIs work...
[edit] 450 Session key specified has passed its expiration time
This function will sometimes also return: 450 Session key specified has passed its expiration time as it happened to me 2008-NOV-11
[edit] Content-type by URL ending, not header
Took me a day to figure this one out:
If you have a dynamic image and the URL doesn't end in .jpg (or .png or .gif) then this function will silently IGNORE your 'images'
You have to tack on /ignore.jpg or somesuch to the URL.
I guess they're using the MSIE logic that those pesky HTTP headers can't possibly be right, and the URL *must* end in an 8.3 DOS filename. Unh-hunh. :-)
[edit] How to publish images and videos
I have created a template that has a oneline, short and full story. I can post just fine to this template. I then added "images" and "flash" tokens in different posts. I am using the .NET API. I use the JSON Helper routines to convert the arrays.
I get a "true" returned to me whenever I make the call (independent of whether there is a "images", "flash" or no additional token at all. In any of these cases, I get the story published, but do not get the images or flash video posted.
Is there something I need to add to the template in order for these tokens to work?
Any help would be greatfully appreciated.
Thanks,
PeterDOlson
- Peter, to clarify -- are you sending these as tokens? If so, we don't allow that, as we reserve images, flash, mp3, etc for rendering the media. You can specify them as keys in your template_data array. Also, you may find it easier to create templates in the Feed console. Does this help? -- Pete (563683308 00:09, 6 January 2009 (PST))
I just learnt the hard way that one-line stories don't have images - they use the _Application_'s image. --Gwyn
[edit] What are the maximum lengths for feed stories?
E.g., is there a maximum length in characters for a one line story?
-- I remember reading here http://wiki.developers.facebook.com/index.php/Action_Link_Guidelines that it shouldn't go up to 3 lines, but I could be wrong. Test it out. --514417 19:56, 4 February 2009 (PST)
[edit] Is there a function like this that posts to other users' walls? I don't like using the multiFeedStory form.
--514417 19:56, 4 February 2009 (PST)
Does anybody grok the 'body_general' bit from this documentation? I sure don't get it, and I've been using this API call in a half-dozen places already.
To clarify the bit about not JSON_encode-ing $tokens: You don't need to json_encode($tokens) as the PHP API will do it for you. It doesn't hurt to do it, though, as the PHP API will skip it if you already did it. feed_publishUserAction($bundle, $tokens, implode(',', $target_ids)); feed_publishUserAction($bundle, json_encode($tokens), implode(',', $target_ids)); Either one will work just fine.
[edit] Please Add Ability to Publish Short/Full Stories and Publish to Other's Walls
There are two serious limitations to this function that I would love to see addressed:
1. Please allow a story size to be specified. Right now if you use anything other than 1 (one line story), a permissions error is returned.
- We're giving users the control over what they want published on their Walls. So if a user selects to always publish a short or full story from your application, then that size is going to be the default. Otherwise, it defaults to a one line story.
2. Please allow the story to be published to a friend's feed. I'm OK with this being limited to just one friend to avoid SPAM, but some actions that a user takes doesn't even make sense to publish without using a target ID and publishing to that friend's wall as well.
I TOTALLY understand that there are feed forms and multi story feed forms for this, but please keep in mind that these don't work with Facebook Mobile. Feed forms are ignored on pages wrapped with the fb:mobile tags and its impossible to allow a user to publish stories via the SMS interface. This renders Facebook Mobile almost useless for 3rd-party applications.
- I've raised this issue with our Mobile team. I'm waiting for a response, and I'll include it here when I get it. Thanks for your patience on this. Pete (563683308 11:47, 12 February 2009 (PST))
[edit] One line stories and Facebook Connect
Beware:
Facebook applications are allowed to publish one line stories without prompting the user
However, this does NOT extend to Facebook Connect applications [1] [2] 776158039 14:34, 18 March 2009 (PDT)
- Keep in mind that one line stories will not appear in the News Feed on the new home page, but will appear on users' own profiles and do contribute to stories that appear in the Highlights section. See Stream Release Notes and the accompanying announcement. -- Pete (563683308 14:46, 18 March 2009 (PDT))
[edit] POST_ID
Is there any way of getting a post_id for items published this way as you can with Stream.publish? Or am I better off recoding to use Stream.publish instead? Steve ( --892645194 05:11, 12 October 2009 (PDT) )
- No there isn't (these posts return true or false when calling stream.get), so updating to stream.publish would be your best bet here. Another option is you can pop a Feed form with FB.Connect.showFeedDialog, as the post_id gets returned in the Callback. Pete -- 563683308 10:46, 12 October 2009 (PDT)
- Thanks for that. Its someone else's code that I've been hacking round so I've got a dirty work round at the moment (I publish and then do a stream get to find the last post made by the application) and I'll see if I can persuade the developer to rehash his code, or failing that I might have a go at it myself.. I just don't want to clutter up my live FB account with test posts. Steve --892645194 03:42, 13 October 2009 (PDT)
- You can set up some test accounts and test with them. Pete -- 563683308 08:21, 13 October 2009 (PDT)
- Thanks for that, I've set an account up and rehashed the code to use streams.publish. Steve --892645194 02:15, 15 October 2009 (PDT)
