0

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?

123
  • 127
  • 3
  • 18

1 Answers1

1

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.

Arpit Jain
  • 1,599
  • 9
  • 23
  • Thank you it works! Do you know how can I post multiple images in the same post? – 123 Jun 22 '23 at 12:20
  • 1
    @123, Glad it works for you :). I am not sure about posting multiple images as I haven't tried it yet but you may find this useful:- https://stackoverflow.com/questions/23015640/how-do-i-can-post-a-multiple-photos-via-facebook-api – Arpit Jain Jun 22 '23 at 13:08