我在Facebook的Graph API上成功实现了一篇帖子,该帖子将图片批量上传到其广告管理器。 POST成功,并创建了一个Facebook图像URL,但该内容未出现在我的广告管理器中。
我认为这是由于在沙盒环境中工作,但我假设如果我的Facebook帐户是开发者控制台中的管理员,则应该授予权限。我需要显示我的整个流程,包括查看广告管理器中的图像以通过应用审核以获取ads_management许可,以及确认我对广告管理器的推送已正常进行。这是我的代码:
Promise.all(imagePromises).then(imagePaths => {
const data = new FormData();
const readStreams = imagePaths.map(imagePath =>
fs.createReadStream(imagePath)
);
data.append('access_token', facebookAccessToken);
const batch = readStreams.map((item, index) => ({
method: 'POST',
relative_url: `act_${facebookID}/adimages`,
body: '',
attached_files: `file${index + 1}`,
}));
data.append('batch', JSON.stringify(batch));
readStreams.map((readStream, index) => {
data.append(`file${index + 1}`, readStream);
});
axios
.post(`https://graph.facebook.com/v3.2`, data, {
headers: data.getHeaders(),
})
.then(response => {
resolve(response);
})
.catch(error => {
reject(error)
});