Facebook API JavaScript SDK Upload Photo and Mention Tag Without Link

348 views Asked by At

The situation I am trying to create is:

  1. I have a photo I want to upload to Facebook via the page feed.
  2. I want to tag someone (who is not a friend) along with the photo.

Right now, I am using the following code which opens another window where I can create my post and tag someone:

FB.ui({
    method: 'feed',
    link: '',
}, function(response){});

However, when I try to create the post, it says "href or media is required."

How can I create a post with a photo without sharing a link, and so that I can still tag people who are not friends?

2

There are 2 answers

0
andyrandy On

To upload a photo, you need to use the /page-id/photos endpoint. You have to authorize the user and use the taggable_friends endpoint to get friends for tagging. You canĀ“t tag people who are not your friends and you have to let Facebook review your use of taggable_friends.

0
Ramya On

i have done this.just try below code.

  FB.ui({
      method: 'feed',
      display: 'popup',
      picture:'file_Path',
  }, function(response){});