Facebook Graph API Post with_tags option

16,007

Solution 1

I actually think the "with_tags" option is read only when returning the feed object. It's not an option you can POST https://developers.facebook.com/docs/reference/dialogs/feed/#graphapicall .I think what you want to use is just "tags" and it should just contain id's as specified here https://developers.facebook.com/docs/reference/api/user/#posts

**note you cannot do this though without also specifying a place

EDIT**** Facebook have now released mention tagging which might be the solution you need https://developers.facebook.com/docs/opengraph/mention_tagging/

Solution 2

Here's an example on how to publish to user feed while tagging some friends:

FB.api(
    "/me/feed",
    "POST",
    {
        "message": "This is a test message",
        "place": "link",
        "tags": "friend_id1,friend_id2"
    },
    function (response) {
      if (response && !response.error) {
        console.log(response); /* post id will be returned */
      }
    }
);

From: https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed

Share:
16,007
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm experiencing an issue with http://developers.facebook.com/docs/reference/api/post/. Namely, option called "with_tags".

    options = {
        "message": "Test123", 
        "with_tags": {
            "data":[
                {"id": 100001686722916, "name": "Aret Aret"}
            ]
        }
    };
    FB.api('/me/feed', 'post', options, function(response) {
        if (!response || response.error) {
            alert('Error occured');
            console.log(response);
        } else {
            console.log(response);
        }
    });
    

    As a result, I just get a message "Test123" but no "with" tags in my post. The user I use in "with" section is on my friends list and is a developer of the app as well. Thanks.