2010-12-03 155 views
4

我使用的JavaScript SDK才能發佈內容到用戶的朋友牆:Facebook的 - 發佈多個朋友牆壁

var publish = 

    { 
       method: 'stream.publish', 
       message: 'Some kind of test', 
       uid: uid, 
       target_id: friendID, 
       attachment: { 
       name: 'Test', 
       caption: 'Facebook API Test', 
       description: ('Sure hope it worked!'), 
       href: 'http://www.test.com/', 
       media: [ 
        { 
        type: 'image', 
        href: 'http://test.com/', 
        src: 'http://test.com/image.jpg' 
        } 
       ] 
       }, 
       action_links: [ 
       { text: 'Enigma Marketing', href: 'http://www.test.com/' } 
       ], 
       user_prompt_message: 'Share your thoughts about test' 
      }; 

      FB.ui(publish); 
      return false; 

這是工作不錯,但我不知道是否有辦法,我可以張貼到多朋友的牆壁?我注意到流行音樂在列表中顯示了一個目標朋友,所以看起來可以將該帖子發佈到多個用戶。我找不到任何文件,任何幫助將不勝感激。

回答

5

不,您不能在一次調用中發佈給多個朋友流。

做到這一點的最好方法可能是服務器端,以便用戶不會得到多個提示。注意這通常是不鼓勵的,因爲它可以被視爲垃圾郵件。

與您的代碼,您可以循環在剛剛發送事件部分:

var publish = 

{ 
      method: 'stream.publish', 
      message: 'Some kind of test', 
      uid: uid, 
      attachment: { 
      name: 'Test', 
      caption: 'Facebook API Test', 
      description: ('Sure hope it worked!'), 
      href: 'http://www.test.com/', 
      media: [ 
       { 
       type: 'image', 
       href: 'http://test.com/', 
       src: 'http://test.com/image.jpg' 
       } 
      ] 
      }, 
      action_links: [ 
      { text: 'Enigma Marketing', href: 'http://www.test.com/' } 
      ], 
      user_prompt_message: 'Share your thoughts about test' 
}; 

publish.target_id = friendID; 
FB.ui(publish); 

publish.target_id = friendID; 
FB.ui(publish); 

     return false;