I was trying to post a post to Facebook with multiple images, but facebook was giving me error when I was adding attached_media parameter to the ${pageId}/feed, This is how I ended up doing it:
const postData = {
message: post.text,
};
images.forEach((imageId, index) => {
postData[`attached_media[${index}]`] = `{"media_fbid": "${imageId}"}`
});
Looping over all the images, and manually adding attached_media[index] parameter.
It would be nice if we could just add it as an array, like this:
const postData = {
message: post.text,
attached_media: [{"media_fbid": "${imageId1}"}, {"media_fbid": "${imageId2}"}]
};
I was trying to post a post to Facebook with multiple images, but facebook was giving me error when I was adding
attached_mediaparameter to the${pageId}/feed, This is how I ended up doing it:Looping over all the images, and manually adding
attached_media[index]parameter.It would be nice if we could just add it as an array, like this: