import axios from 'axios';
import imageToBase64 from 'image-to-base64';
export const getImageHashFromAdAccount = async ({
accessToken,
adAccountId,
imageUrl,
}) => {
try {
console.log(` ---- generating image-hash from ad account ----`);
const bytes = await imageToBase64(imageUrl);
// console.log(bytes)
const res: any = await axios.post(
`https://graph.facebook.com/v12.0/act_${adAccountId}/adimages`,
{
access_token: accessToken,
bytes,
}
);
console.log(
`-------------------------- returning image hash -----------------------------`
);
console.log(res?.data?.images?.bytes?.hash);
return {
success: true,
data: {
imageHash: res?.data?.images?.bytes?.hash,
},
};
} catch (error) {
console.log(
` --- an error occurred while getting image hash from ad account ---`
);
console.log(error);
console.log(error?.response?.data);
return {
success: false,
data: null,
};
}
};
export const getVideoIdFromFacebookGraph = async ({
accessToken,
adAccountId,
videoUrl,
}) => {
try {
console.log(` ---- getting video-id from facebook graph -----`);
const request: any = await axios.post(
`https://graph.facebook.com/v12.0/act_${adAccountId}/advideos`,
{
access_token: accessToken,
file_url: videoUrl,
transport: 'cors',
}
);
console.log(`----------- uploaded video id ------------`);
console.log(request?.data?.id);
return {
success: true,
data: {
videoId: request?.data?.id,
},
};
} catch (error) {
console.log(
` --- an error occurred while getting image hash from ad account ---`
);
console.log(error);
console.log(error?.response?.data);
return {
success: false,
data: null,
};
}
};
mark area restore marked area hide marks detect click / evnt on marked area e paper backend define db schema [https://dbdiagram.io/d/61c4e1833205b45b73cae22b] laravel refresh / necessary concepts r&d define apis
Jan 28, 2022local Rule baseed engine for facebook optimization define rules in frontend at the time of campaign creation need a practical example for rule apply rules in backend refs
Jan 20, 2022this seem to help first add containers to screen add components in the container a container will take up all the row there will be container with differnt innter columns (1,2,3,4) taking up the whole space allow container drag and drop but only in colum direction (up and down) for responsive live preview show all the content in an <iframe/> an contain the iframe in a dif , now chaning the surrounding divs size we will he able to see live preview in different screen size <div class="target-div" width='420px'> <iframe/>
Jan 8, 2022creators of golang a small team of google robert griesemer rob pike ken thompson (unix,unicode) why create golang google used three languages
Dec 14, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up