0% found this document useful (0 votes)
106 views3 pages

Facebook Ad Account Creation Script

The document is a JavaScript code snippet that automates the creation of ad accounts on Facebook's Business platform. It includes a list of positive names, functions to generate random names, and checks for the correct page and access tokens. The script creates a specified number of ad accounts with a delay between each creation, logging the results and handling errors appropriately.

Uploaded by

reedcrystaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views3 pages

Facebook Ad Account Creation Script

The document is a JavaScript code snippet that automates the creation of ad accounts on Facebook's Business platform. It includes a list of positive names, functions to generate random names, and checks for the correct page and access tokens. The script creates a specified number of ad accounts with a delay between each creation, logging the results and handling errors appropriately.

Uploaded by

reedcrystaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

[Link]("Copyright Maxvia88.

com");
const currency = `EUR`; // Tiền tệ
const timezone_id = `17`; // Mã múi giờ lấy tại [Link]
const delay = `3`; // Thời gian giữa 2 lần tạo tkqc
const length = 500; // Tổng TKQC muốn tạo

// ১০০টি পজিটিভ নামের লিস্ট


const namesList = [
"Shahin", "Ali", "Sara", "Sam", "Rahul", "Emily", "Lucas", "Zara", "Nashit",
"Ayesha",
"Omar", "Mia", "Nina", "Zain", "Eva", "David", "Anna", "Maya", "John", "Carlos",
"Sophia", "Tariq", "Grace", "Daniel", "Lina", "Mohammed", "Sara", "Ryan", "Amir",
"Diana",
"James", "Liam", "Amira", "Ahmed", "Sofia", "Tina", "Mohit", "Lana", "Max",
"Samantha",
"Nashit", "Emma", "Noah", "Lola", "Maya", "Kai", "Ella", "Eva", "Daniela",
"Lucas",
"Sara", "Aiden", "Rina", "Hassan", "Leila", "Liam", "Ravi", "Tariq", "Victor",
"Layla",
"Paul", "Jack", "Sophia", "Leah", "Mike", "Fayza", "Aliyah", "Mateo", "Evan",
"Lucia",
"Inaya", "Khalil", "Ava", "Yusuf", "Layla", "Abdi", "Sami", "Anna", "Kamilah",
"Ali",
"Aria", "Liam", "Ava", "Asad", "Omar", "Fatima", "Ella", "Ibrahim", "Sarah",
"Dylan",
"Rayyan", "Rafael", "Mia", "Samiya", "Sasha", "Joshua", "Anna", "Sophia", "Kira",
"Tariq",
"Leila", "Adam", "Mia", "Oliver", "Haider", "Zainab", "Owen", "Lina", "Zara",
"Sophia",
"Chris", "Kai", "Eva", "Alina", "Lily", "Rachel", "Yara", "Tarek", "Aidan",
"Mariam",
"Eva", "Eliza", "Samira", "Anwar", "Omer", "Ismail", "Chloe", "Ivy", "Luna",
"Kamal"
];

// নাম পছন্দ করার ফাংশন


function getRandomName() {
const randomIndex = [Link]([Link]() * [Link]); // ইনডেক্স
নির্বাচন
const randomName = namesList[randomIndex];
const randomNumber = [Link]([Link]() * 1000); // 0-999 র‍্যান্ডম সংখ্যা
return `${randomName}${randomNumber}`; // সাথে র‍্যান্ডম সংখ্যা যোগ করা
}

// Check if the user is on the correct page


if (![Link]("[Link]")) {
alert(`Please go to [Link] then try again`);
[Link] = "[Link]
}

const access_token = require('WebApiApplication').getAccessToken();


const businessId = require("BusinessUnifiedNavigationContext").businessID;

if (!businessId || !access_token) {
alert(`Please go to [Link] select BM then try
again`);
[Link] = "[Link]
} else {
maxvia88com(1);
}

async function maxvia88com(index) {


if (index > length) {
[Link](`Done !!`);
alert(`Done ALL ${index}/${length}`);
return;
}

const nameads = getRandomName(); // Generate random name for each ad account

const url = `[Link]


access_token=${access_token}`;
const params = {
method: 'POST',
credentials: 'include',
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
body: `__activeScenarioIDs=%5B%5D&__activeScenarios=%5B
%5D&__interactionsMetadata=%5B%5D&_reqName=object%3Abrand
%2Fadaccount&_reqSrc=[Link]&ad_account_created_from_bm_flag=true&c
urrency=${currency}&end_advertiser=${businessId}&invoicing_emails=%5B
%5D&media_agency=UNFOUND&method=post&name=${nameads}%20$
{index}&partner=UNFOUND&po_number=&pretty=0&suppress_http_code=1&timezone_id=$
{timezone_id}&xref=`,
};

try {
const response = await fetch(url, params);
if (![Link]) {
if ([Link] === 500) {
[Link](`Run:${index}/${length} ${businessId} => error 500`);
} else {
throw new Error(`HTTP error! Status: ${[Link]}`);
}
}
const data = await [Link]();
let now = new Date();
if (data.account_id) {
[Link](`%cRun:${index}/${length} - ${nameads} ${index} => Created $
{[Link]} [${[Link]()}:${[Link]()}:${[Link]()}|$
{[Link]()}/${[Link]() + 1}/${[Link]()}]`, 'color: green;');
} else if ([Link] && [Link]) {
[Link](`%cRun:${index}/${length} ${businessId} -> STOP => Error: $
{[Link]} [${[Link]()}:${[Link]()}:${[Link]()}|$
{[Link]()}/${[Link]() + 1}/${[Link]()}]`, 'color: red;');
[Link](`Done!!`);
let errormsg = `${[Link]}`;
if ([Link].error_user_msg) {
errormsg = `${[Link].error_user_msg}`;
}
alert(`Done: ${index - 1}/${length}\n${errormsg}`);
return;
} else {
[Link](`%cRun:${index}/${length} ${businessId} -> STOP => Error:
Unknow`, 'color: red; font-weight: bold;');
return;
}
} catch (error) {
[Link]('Error:', [Link]);
}

setTimeout(function () {
maxvia88com(index + 1);
}, delay * 2);
}

You might also like