https://www.youtube.com/watch?v=Li4KWRzC8Ck (视频地址)
代码:
var accountId = require("BusinessUnifiedNavigationContext").adAccountID;
var fb_dtsg = require('DTSGInitialData').token;
var __user = require('CurrentUserInitialData').USER_ID;
var bm_id = location.href.split('?business_id=')[1].split('&')[0].trim();
var params = __user=${__user}&__a=1&__csr=&__req=u&__hs=19233.BP%3Abrands_pkg.2.0.0.0.0&dpr=1&__ccg=EXCELLENT&__rev=1006107908&__s=6n2lwc%3Aa7z5og%3Asrwkmr&__hsi=7137284028269070087&__comet_req=0&fb_dtsg=${fb_dtsg}&jazoest=25466&lsd=djOwmsZGMY8CPHYIPh6YoQ&__spin_r=1006107908&__spin_b=trunk&__spin_t=1661778434&__jssesw=1
;
//put your ad account id below, it must share to same facebook account keep BM.
var accountId = "701671047790172";
fetch("https://business.facebook.com/business/objects/add/connections/?business_id=" + bm_id + "&from_id=" + bm_id + "&from_asset_type=brand&to_id=" + accountId + "&to_asset_type=ad-account", {
"headers": {
"content-type": "application/x-www-form-urlencoded",
},
"body": params,
"method": "POST",
"mode": "cors",
"credentials": "include"
}).then(e => {
console.log("Fbceek Wesite ");
console.log(e.text());
})