medo ampir
medo ampir

Reputation: 1910

how to add share action to the post in facebook?

i'm using this code to post to my application wall

$attachment = array('message' => 'xxxxxxxxxxxxxxxx...',
            'name' => 'xxxxxxxxxxxxxxxxxxx',
            'caption' => 'xxxxxxxxxxxxxxxxxx',
            'link' => 'xxxxxxxxxxxxxxxxxx',
            'description' => 'xxxxxxxxxxxxxxxxxx',
            'picture' => 'xxxxxxxxxxxxxxxxxx',
            'actions' => array(array('name' => 'Download!',
                              'link' => 'xxxxxxxxxxxxxxxxxx'))
            );

$result = $facebook->api('/2222222222222/feed/','post',$attachment); 

when i post to my application wall manually the post is appearing on the application users wall with the share action but when i use the above code it only appear on the app wall with like and comment actions only. why? and how to add the share action to the actions array?

Upvotes: 4

Views: 2781

Answers (4)

mbouzahir
mbouzahir

Reputation: 1564

Hi the solution is here instead of

$result = $facebook->api('/2222222222222/feed/','post',$attachment); 

use

$result = $facebook->api('/2222222222222/links/','post',$attachment); 

i'm still facing one little problem with the picture not showing after this change, if i come to a solution to it I'll come back here and post it.

Upvotes: 0

Sunny Frimley
Sunny Frimley

Reputation: 1

http://facebookanswers.co.uk/?p=270

This article explains it. The key is this:

'actions' => array('name'=>'Sweet FA','link'=>'http://www.facebookanswers.co.uk'),

This is fine for adding one action. However, I'm not sure how to add two.

Upvotes: 0

adkatrit
adkatrit

Reputation: 153

the proper names for the action link is: array( array('text' => 'Download!', 'href' => 'xxxxxxxxxxxxxxx'));

Keep in mind that you can't use action links in the graph api (yet). so this functionality is limited to the REST api.

Let me know if this helps

Upvotes: 0

medo ampir
medo ampir

Reputation: 1910

i didn't find any answer online, but i just found the solution to my problem by chance i removed the action parameter from the attachment.

but if there is a link parameter in the attachment the share action won't appear so you will have to give up the link parameter.

Upvotes: 1

Related Questions