2011-11-26 15 views
3

是否可以使用多個動作鏈接創建wallpost?單個牆貼上的更多動作鏈接

我的代碼僅適用於一個操作鏈接。帶有兩個操作鏈接的Wallpost不會發送到Facebook(沒有錯誤信息)。

var publish = { 
    method : 'feed', 
    name : name, 
    link : link, 
    picture : picture, 
    caption : caption, 
    description : description, 
    message : message, 
    actions : [{ 
     name : 'Link 1', 
     link : 'http://www.example.com' 
     },{ 
     name : 'Link 2', 
     link : 'http://www.example2.com' 
     }] 
}; 

FB.api('/me/feed', 'POST', publish, function(response) {}); 

回答

3

我有一個response from Facebook,你真的不能添加多個動作鏈接

添加一個鏈接正確的代碼是:

var publish = { 
    // .... 
    actions : { 
     name : 'Some Action Link!', 
     link : 'http://www.example.com' 
     } 
}; 
+0

我有同樣的問題。但行動領域已於2015年7月棄用:/ – Dpedrinha

1

是的。

根據http://developers.facebook.com/docs/reference/rest/stream.publish/action_links參數是「JSON編碼的動作鏈接對象陣列,包含鏈接文本和超鏈接。」

它看起來像你叫它actions,而不是action_links。試試這個:

var publish = { 
    method : 'feed', 
    name : name, 
    link : link, 
    picture : picture, 
    caption : caption, 
    description : description, 
    message : message, 
    action_links : [{ 
     name : 'Link 1', 
     link : 'http://www.example.com' 
     },{ 
     name : 'Link 2', 
     link : 'http://www.example2.com' 
     }] 
}; 
+1

我想你的解決方案,可惜不工作。發佈沒有行動鏈接。 我使用FB.api發送帖子:[http://developers.facebook.com/docs/reference/api/post/](http://developers.facebook.com/docs/reference/api/post/ ) 「** action:**該帖子的可用操作列表(包括評論,喜好和可選的應用程序指定的操作)」 我發現此帖:[http://developers.facebook.com /blog/post/321](http://developers.facebook.com/blog/post/321)並寫有: 「(...)展望未來,一個流程故事最多隻能有一個動作鏈接和鏈接中的25個字符。「 – illagrenan

+0

有完全相同的問題。 – BerggreenDK

+0

同樣的問題,因爲這個怪異的「JSON編碼數組」描述而丟失了幾個小時。感謝您的回答。 – Dpedrinha