I’ll give some context on what we are trying to achieve and the steps we have taken so far.
Related issues we have filled on this issue:
- https://developers.facebook.com/bugs/756908861120246
- https://developers.facebook.com/bugs/518554448320040
When a user signs a petition we present them with a custom dialog used to make a facebook post. We would like to present them with a list of taggable friends. The user would then select a subset of these users. Then those users would be @mentioned in the content of the post. Additionally we would like this post to show in the user’s feed.
taggable_friends:
We are able to request the ‘user_friends’ permission and make a call to ‘/me/taggable_friends’ to get a list of users with their names, pictures and uids.
Our first attempt was to get the user’s uid from the taggable_friends end point and embed this into a post to ‘/me/feed’ in the following format: given a user with uid: useruidstring
message content
@[useruidstring]
We were under the impression that the ‘@[useruidstring]’ would be replaced by the user’s name when the post would be made. However the literal string showed in the post.
Here is how we make the request (from my local testing environment):
FB.api(‘/me/feed’, ‘post’, {"name":"Dr. Adaline Armstrong: Implement Grass-roots fault-tolerant migration - Sign the Petition!","caption":"{*actor*} just signed this petition on Change.org.","description":"89 signatures are still needed!","link":"http://www.local-change.org:3000/p/dr-adaline-armstrong-implement-grass-roo…_medium=facebook&utm_campaign=share_page&utm_term=des-lg-no_src-custom_msg","picture":"http://www.local-change.org:3000/public/img/default-petition.gif","action_link_text":"Sign the Petition","facebook_method":"feed","actions":{"name":"Sign the Petition","link":"http://www.local-change.org:3000/p/dr-adaline-armstrong-implement-grass-roo…_medium=facebook&utm_campaign=share_page&utm_term=des-lg-no_src-custom_msg"},"message":"@[AaLnYbOHgH2GxJHhoRSFHEoGBbPYudyYDfBtz8s41JpCZIlKYIopVyUautD-dgjR-UojS1ZNjP5phAVbWvfjUmpY4qYBuH56W9CSfMldTQmTLQ]"})
The response that is returned contains {id: "10156131218745608_10156264709580608"}
The post that is created contains the text: @[AaLnYbOHgH2GxJHhoRSFHEoGBbPYudyYDfBtz8s41JpCZIlKYIopVyUautD-dgjR-UojS1ZNjP5phAVbWvfjUmpY4qYBuH56W9CSfMldTQmTLQ]
In this second scenario we are performing an action_type on an object_type. More specifically we are doing a ‘sign’ action on a ‘website’ object type (defined in our dashboard).
Using the same format as above we created a post with a user mention. The target user was notified by email with a link to the created post. However this post does not show in the feed of the author and when the link is clicked from the email an error message is displayed.
The request is made in the following fashion:
FB.api(‘/me/change_org_dev:sign’,’post’, {"name":"Dr. Adaline Armstrong: Implement Grass-roots fault-tolerant migration - Sign the Petition!","caption":"{*actor*} just signed this petition on Change.org.","description":"89 signatures are still needed!","link":"http://www.local-change.org:3000/p/dr-adaline-armstrong-implement-grass-roo…_medium=facebook&utm_campaign=share_page&utm_term=des-lg-no_src-custom_msg","picture":"http://www.local-change.org:3000/public/img/default-petition.gif","action_link_text":"Sign the Petition","facebook_method":"feed","actions":{"name":"Sign the Petition","link":"http://www.local-change.org:3000/p/dr-adaline-armstrong-implement-grass-roo…_medium=facebook&utm_campaign=share_page&utm_term=des-lg-no_src-custom_msg"},"message":"@[AaI4-pMMO1PNU4bNMcoDjfMiPl9U1HS9gwMLDemCrj5TjNZRcoH8u4y2LDg9yp1-95ib5WA1E_2vWuRc50VvXntwOCjxFwnwbkwn_UhIdVviEQ]","website":"http://www.local-change.org:3000/p/dr-adaline-armstrong-implement-grass-roo…_medium=facebook&utm_campaign=share_page&utm_term=des-lg-no_src-custom_msg"});
The response returned is: {id: "10156264723625608"}
Trying to navigate to this content using the UI (https://www.facebook.com/dtishchenko/activity/10156264723625608) gives a content not found error.
I can, however, make an api call to get the content of this post.
FB.api('/10156264723625608', function(){ console.log( JSON.stringify(arguments) ); })
giving the response:
{"0":{"end_time":"2015-11-16T19:17:05+0000","message":"Justin Change","start_time":"2015-11-16T19:17:05+0000","type":"change_org_dev:sign","application":{"link":"http://www.local-change.org:3000/","name":"Change.org Dev","namespace":"change_org_dev","id":"189752094378413"},"comments":{"data":[],"can_comment":true,"comment_order":"chronological","count":0},"from":{"name":"Dimitri Tishchenko","id":"10156131218745608"},"likes":{"data":[],"can_like":true,"count":0,"user_likes":false},"message_tags":{"0":[{"id":"111653382532697","length":13,"name":"Justin Change","offset":0,"type":"user"}]},"no_feed_story":false,"publish_time":"2015-11-16T19:17:05+0000","data":{"website":{"id":"1089768557722890","type":"website","url":"http://www.local-change.org:3000/p/dr-adaline-armstrong-implement-grass-roo…_medium=facebook&utm_campaign=share_page&utm_term=des-lg-no_src-custom_msg"}},"id":"10156264723625608"}}
The response leads me to believe that post was created as expected.
Conclusion: If it would be possible would like to to use the first method to make posts to a user’s feed and be able to @mention users from the taggable friends list. Could you shed some light on how we can get this working?
Thanks,
Dimitri Tishchenko