I’ve been trying to whitelist my domains following the instruction that is given by facebook but nothing is working.
I first tried with curl, the response is {result:"success"}
but when I try to list the domains that are whitelisted I am getting {data:[]}
Then I tried using node request module as follow:
request.post("https://graph.facebook.com/v2.6/me/messenger_profile?access_token=sfdlksdfu79r9429049824982342348sjdfsf", {
"setting_type": "domain_whitelisting",
"whitelisted_domains": ["https://mydomainw.com", "https://mydomainw.com/profile", "https://sfujyx.com/ofr", "mydomain1.com", "mydomain.com"],
"domain_action_type": "add"}, function (err, res, body) {
console.log("Whitelisting domain");
if (!err) {
console.log(body);
console.log("Showing the list of whitelisted:");
request.get("https://graph.facebook.com/v2.6/me/messenger_profile?fields=whitelisted_domains&access_token=sfdlksdfu79r9429049824982342348sjdfsf", function (err, res, body) {
if (!err) {
console.log(body);
} else {
console.log(err);
}
});
} else {
console.log(err);
}
});
Still it bring the same result as curl :
And when I use Facebook Graph Api Explorer tool, here is the error I am getting:
I am really stuck, I don’t know what should I do or how people exactly whitelist domain for messenger extension.
What I am doing wrong? why isn’t the domains being added?
My project is on Google App Engine.
3
Answers
The problem is I was using the App Access Token instead of the Page Access Token, I didn't know the difference.
your domain: “https://mydomainw..com” is an invalid domain.
The request should return:
Actually, I didn’t use “setting_type” before. This is how I register domains: