import os
      import facebook
      def post_facebook(message, image_path):
        PAGE_ID = os.environ["FACEBOOK_PAGE_ID"]
         link = ""
         with open(image_path, 'rb') as picture_file:
          graph = facebook.GraphAPI(PAGE_ACCESS_TOKEN)
          photo_put = graph.put_photo(image=picture_file, message=message, published=True, link=link)

      Python language logo
      Post picture on Facebook

      Social Media Posting

      Put a picture that shows on the feed of a specific page.

      To get your token, see

      For this recipe, we store the facebook page id and the token as environment variable.


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.