Spam Detection
Detect spam comments in your discussions.
What it detects:
- Promotional/advertising content
- Bot-generated text patterns
- Link spam and SEO manipulation
- Repeated/duplicate comments
- Off-topic noise
Reference
See the Spam Detection API Reference for method signatures and parameters.
Response: SpamDetectionResult
By Example
Basic Usage
- TypeScript
- Python
- PHP
- REST API
// With article context (more accurate)
const result = await client.checkSpam(
"Buy cheap watches at example.com!",
articleId
);
// Without context (standalone check)
const result2 = await client.checkSpam("Buy cheap watches at example.com!");
console.log(`Is spam: ${result.is_spam}`);
console.log(`Confidence: ${result.confidence.toFixed(2)}`);
console.log(`Reasoning: ${result.reasoning}`);
- Blocking Client
- Async Client
# With article context (more accurate)
result = client.check_spam(
"Buy cheap watches at example.com!",
article_id
)
# Without context (standalone check)
result = client.check_spam("Buy cheap watches at example.com!")
print(f"Is spam: {result.is_spam}")
print(f"Confidence: {result.confidence:.2f}")
print(f"Reasoning: {result.reasoning}")
# With article context (more accurate)
result = await client.check_spam(
"Buy cheap watches at example.com!",
article_id
)
# Without context (standalone check)
result = await client.check_spam("Buy cheap watches at example.com!")
print(f"Is spam: {result.is_spam}")
print(f"Confidence: {result.confidence:.2f}")
print(f"Reasoning: {result.reasoning}")
$client->checkSpam("Buy cheap watches at example.com!", $articleId)
->then(function ($result) {
echo "Is spam: " . ($result->isSpam ? 'Yes' : 'No') . "\n";
echo "Confidence: " . number_format($result->confidence, 2) . "\n";
echo "Reasoning: " . $result->reasoning . "\n";
});
$client->run();
Try it out live →
# With article context (more accurate)
curl -X POST https://app.respectify.ai/v0.2/antispam \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key" \
-d "comment=Buy cheap watches at example.com!" \
-d "article_context_id=550e8400-e29b-41d4-a716-446655440000"
# Without context (standalone check)
curl -X POST https://app.respectify.ai/v0.2/antispam \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key" \
-d "comment=Buy cheap watches at example.com!"
Response:
{
"is_spam": true,
"confidence": 0.95,
"reasoning": "Detected repetitive phrasing and promotional language with external links."
}
Best Practices
- Use article context when available for better accuracy.
- Set confidence thresholds based on your needs:
- High confidence (above 0.9): Consider auto-rejection or flag for review
- Medium (0.7 to 0.9): Flag for human review
- Low (below 0.7): Allow through
- Log false positives to understand patterns.
- Consider showing feedback even for spam, to help users understand why their comment was flagged.