
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@sharpapi/sharpapi-node-detect-spam
Advanced tools
SharpAPI.com Node.js SDK for detecting spam content in text

SharpAPI Spam Detector uses advanced AI to identify spam, malicious content, and unwanted messages. Perfect for content moderation, email filtering, and user-generated content protection.
npm install @sharpapi/sharpapi-node-detect-spam
Visit SharpAPI.com to get your API key.
const { SharpApiDetectSpamService } = require('@sharpapi/sharpapi-node-detect-spam');
const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
const service = new SharpApiDetectSpamService(apiKey);
const suspiciousText = `
URGENT! You have won $1,000,000!!! Click here NOW to claim your prize!
Send your bank details to claim@fake-site.com immediately!
Limited time offer!!!
`;
async function checkSpam() {
try {
// Submit spam detection job
const statusUrl = await service.detectSpam(suspiciousText);
console.log('Job submitted. Status URL:', statusUrl);
// Fetch results (polls automatically until complete)
const result = await service.fetchResults(statusUrl);
const spamResult = result.getResultJson();
console.log('Is spam:', spamResult.is_spam);
console.log('Confidence score:', spamResult.score);
} catch (error) {
console.error('Error:', error.message);
}
}
checkSpam();
detectSpam(text: string): Promise<string>Analyzes text content to determine if it's spam.
Parameters:
text (string, required): The text content to analyze for spamReturns:
Example:
const statusUrl = await service.detectSpam(userGeneratedContent);
const result = await service.fetchResults(statusUrl);
The API returns spam detection results with confidence score:
{
"is_spam": true,
"score": 95,
"confidence": "high",
"reasons": [
"Contains urgency language",
"Requests financial information",
"Uses excessive punctuation",
"Contains suspicious URLs"
],
"categories": ["phishing", "financial_scam"]
}
const { SharpApiDetectSpamService } = require('@sharpapi/sharpapi-node-detect-spam');
const service = new SharpApiDetectSpamService(process.env.SHARP_API_KEY);
const userComment = 'Check out my website for amazing deals!!! Click here now!!!';
service.detectSpam(userComment)
.then(statusUrl => service.fetchResults(statusUrl))
.then(result => {
const spamCheck = result.getResultJson();
if (spamCheck.is_spam) {
console.log(`⚠️ SPAM DETECTED (${spamCheck.score}% confidence)`);
console.log('Reasons:', spamCheck.reasons.join(', '));
} else {
console.log('✅ Content is clean');
}
})
.catch(error => console.error('Detection failed:', error));
const service = new SharpApiDetectSpamService(process.env.SHARP_API_KEY);
async function moderateContent(content) {
const statusUrl = await service.detectSpam(content);
const result = await service.fetchResults(statusUrl);
const spamCheck = result.getResultJson();
return {
approved: !spamCheck.is_spam || spamCheck.score < 70,
confidence: spamCheck.score,
reasons: spamCheck.reasons,
action: spamCheck.score >= 90 ? 'block' :
spamCheck.score >= 70 ? 'review' :
'approve'
};
}
const userPosts = [
'Great product! Highly recommend.',
'WIN MONEY NOW!!! CLICK HERE!!!',
'Thanks for the helpful information.'
];
for (const post of userPosts) {
const moderation = await moderateContent(post);
console.log(`Post: "${post}"`);
console.log(`Action: ${moderation.action} (${moderation.confidence}% spam)`);
console.log('---');
}
const service = new SharpApiDetectSpamService(process.env.SHARP_API_KEY);
const messages = [
{ id: 1, text: 'Looking forward to our meeting tomorrow.' },
{ id: 2, text: 'URGENT! Update your password immediately!!!' },
{ id: 3, text: 'Could you send me the project files?' }
];
const results = await Promise.all(
messages.map(async (msg) => {
const statusUrl = await service.detectSpam(msg.text);
const result = await service.fetchResults(statusUrl);
const spamCheck = result.getResultJson();
return {
id: msg.id,
text: msg.text,
is_spam: spamCheck.is_spam,
score: spamCheck.score
};
})
);
const spamMessages = results.filter(r => r.is_spam);
console.log(`Found ${spamMessages.length} spam messages out of ${messages.length}`);
The spam detector identifies various types of unwanted content:
POST /content/detect_spam
For detailed API specifications, refer to:
This project is licensed under the MIT License. See the LICENSE.md file for details.
Powered by SharpAPI - AI-Powered API Workflow Automation
FAQs
SharpAPI.com Node.js SDK for detecting spam content in text
We found that @sharpapi/sharpapi-node-detect-spam demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.