Home > Software engineering >  Posting url through Facebook Graph API does not embed the url, just puts it as a url
Posting url through Facebook Graph API does not embed the url, just puts it as a url

Time:06-25

I am trying to post a URL to wall. Usually, when you post by hand it will load and include a snippet with the title, image, and byline. This does not happen with my API call. Using Python 3.10, with the facebook-sdk.

def post(self, article):
    print(f"\n\n[FacebookPoster] Posting on Facebook:\n\n\"{article.post}\"\n\n")
    self.graph.put_object(parent_object="me", connection_name="feed", message=article.post)

Thanks ahead of time!

CodePudding user response:

Try to use the link parameter to pass your URL.

If I modify your code, it should give something like:

def post(self, article):
  print(f"\n\n[FacebookPoster] Posting on Facebook:\n\n{article.post}\n\n")
  self.graph.put_object(parent_object="me", connection_name="feed", message=article.post, link=article.link)
  • Related