Search code examples
facebookfacebook-graph-apifile-upload

Is it possible to upload an image to my own Facebook group via FB Group API?


I have a Facebook group that I manage and I want to use the Facebook groups API to post some images automatically from my server, at the moment I use the POST https://graph.facebook.com/v17.0/{group-id}/feed endpoint to upload text and links to the group but I want to be able to publish an image as well (multiple images would be best), but I don't understand if it's possible or not, it seems like Meta API docs point to the group photos API but it is not clear how to use it I can't find the body param where I should provide the image URL/base64 to, there's only aid (album id) which is deprecated.

Is what I'm trying to achieve possible? How can I do it?


Solution

  • You can use url Param of Group Photos API to specify the image file.

    Example request:-

    curl -i -X POST \
     "https://graph.facebook.com/v17.0/222863893908133/photos?url=https%3A%2F%2Fimg.freepik.com%2Ffree-photo%2Fwide-angle-shot-single-tree-growing-clouded-sky-during-sunset-surrounded-by-grass_181624-22807.jpg&access_token=EAAOPZAhS8Nx4BAHP4gGZXXX"
    

    Response:-

    {
      "id": "571144611858970",
      "post_id": "222863893908133_222867323907790"
    }
    

    I hope this helps.