Hello everyone!
This is my first post in the forum, hope i don’t get harsh comments
First of all, i am a Data Scientist and my expertise is in Python only; my js code below probably sucks and its there as a reference only.
In this post, i will quickly go over the 3 methods i implemented to eliminate spammer in wix forum, from easiest to more complex:
1. Email verification on Sign up.
Thanks to Wix, now it is possible to enable this feature without building it from scratch. Even with this method implemented, some spammers were still able to verify their emails.
2. Calling stopforumspam .com api when someone creates an account.
They have a huge database of spammers email addresses, calling their api would return the confidence they think it is a spammer.
try this for example: https://api.stopforumspam .org/api?email=crunchsmartphone@gmail.com&json
The way i implemented it is to check the frequency results from that api call. it deletes the member immediately if it is not zero (a scammer) and sends a triggered email explaining what happen (in case it was a false positive)
This is how its implemented in the events.js file:
export async function wixMembers_onMemberCreated(event) {
const email = event.entity.loginEmail;
const id = event.entity._id;
let results = await checkSpamEmail(email);
let freq = results['email']['frequency'];
if(freq != 0){
await sendEmailToSpammer(id);
await members.deleteMember(id)
.then(() => {
console.log('Member deleted');
})
.catch((error) => {
console.error(error);
});
console.log("deleted")
}
}
export async function checkSpamEmail(email){
let url = "https://api.stopforumspam .org/api?email=" + email + "&json"
console.log(url);
return await getJSON(url)
.then(result => {
return result
})
.catch(err => console.log(err));
}
- Use Machine learning to detect spam comments and posts. I went a little further and trained an ML model that classifies whether a comment/post is a spam using data i collected from the forum itself. The ML endpoint is hosted as a Flask app on pythonanywhere .com
try this comment for example, or any comment you would like to test on:
https://asenjab9094.pythonanywhere .com/predict?comment=There%20are%20particular%20dissertation%20web-sites%20through%20the%20world%20wide%20web%20to%20make%20risk-free%20apparently%20with%20their%20registered%20as%20part%20of%20your%20site.%20Remote%20work%20software
Unfortunately, wix api currently doesn’t offer a way to delete posts or comments. For this reason, i am currently just calling the event functions onCommentCreated/onPostCreated then check the probability it was a spam, if it was more than 75%, i send a triggered email to myself with some relevant information about the post.
There should be plenty of tutorials on how to setup a Flask app. but if you need help with an example python code to train the model, please let me know, you are free to use that endpoint as well.
Hope this is useful!