Megacall (Batch Operations)
Run multiple analysis types in a single API call for efficiency.
Why Use Megacall?
A single request is faster than multiple requests for each kind of analysis. It is also more cost effective, as you are charged for fewer API calls than the individual features in the megacall.
Selecting Which Checks to Run
Each analysis type is optional. Only request what you need to minimize latency and cost.
- Python
- PHP
- REST API
Use boolean parameters to select analyses:
| Parameter | Analysis |
|---|---|
include_spam=True | Spam detection |
include_relevance=True | On-topic and banned topics check |
include_comment_score=True | Full quality analysis |
include_dogwhistle=True | Coded language detection |
Results are None for any analysis not requested.
Pass an array of service names as the third parameter:
| Service | Analysis |
|---|---|
'spam' | Spam detection |
'relevance' | On-topic and banned topics check |
'commentscore' | Full quality analysis |
'dogwhistle' | Coded language detection |
$client->megacall($comment, $articleId, ['spam', 'relevance']);
Results are null for any service not included.
Use boolean fields in the request body:
| Field | Analysis |
|---|---|
run_spam_check | Spam detection |
run_relevance_check | On-topic and banned topics check |
run_comment_score | Full quality analysis |
run_dogwhistle_check | Coded language detection |
Response fields are null for any check not requested.
Basic Usage
- Python
- PHP
- REST API
- Blocking Client
- Async Client
result = client.megacall(
"This is a test comment",
article_id,
include_spam=True,
include_relevance=True,
include_comment_score=True,
include_dogwhistle=True
)
# Access results (None if not requested)
if result.spam:
print(f"Is spam: {result.spam.is_spam}")
if result.relevance:
print(f"On topic: {result.relevance.on_topic.on_topic}")
if result.comment_score:
print(f"Overall score: {result.comment_score.overall_score}")
if result.dogwhistle:
print(f"Dogwhistles detected: {result.dogwhistle.detection.dogwhistles_detected}")
result = await client.megacall(
"This is a test comment",
article_id,
include_spam=True,
include_relevance=True,
include_comment_score=True,
include_dogwhistle=True
)
# Access results (None if not requested)
if result.spam:
print(f"Is spam: {result.spam.is_spam}")
if result.relevance:
print(f"On topic: {result.relevance.on_topic.on_topic}")
if result.comment_score:
print(f"Overall score: {result.comment_score.overall_score}")
if result.dogwhistle:
print(f"Dogwhistles detected: {result.dogwhistle.detection.dogwhistles_detected}")
$client->megacall(
"This is a test comment",
$articleId,
['spam', 'relevance', 'commentscore', 'dogwhistle']
)->then(function ($result) {
if ($result->spam) {
echo "Is spam: " . ($result->spam->isSpam ? 'Yes' : 'No') . "\n";
}
if ($result->relevance) {
echo "On topic: " . ($result->relevance->onTopic->onTopic ? 'Yes' : 'No') . "\n";
}
if ($result->commentScore) {
echo "Overall score: " . $result->commentScore->overallScore . "\n";
}
if ($result->dogwhistle) {
echo "Dogwhistles: " . ($result->dogwhistle->detection->dogwhistlesDetected ? 'Yes' : 'No') . "\n";
}
});
$client->run();
Try it out live →
curl -X POST https://app.respectify.ai/v0.2/megacall \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"comment": "This is a test comment",
"article_context_id": "550e8400-e29b-41d4-a716-446655440000",
"run_spam_check": true,
"run_relevance_check": true,
"run_comment_score": true,
"run_dogwhistle_check": true
}'
Response:
{
"comment_score": {
"logical_fallacies": [],
"objectionable_phrases": [],
"negative_tone_phrases": [],
"appears_low_effort": false,
"overall_score": 4,
"toxicity_score": 0.05,
"toxicity_explanation": "No significant toxicity detected."
},
"spam_check": {
"reasoning": "The comment appears to be a genuine contribution to the discussion.",
"confidence": 0.98,
"is_spam": false
},
"relevance_check": {
"on_topic": {
"reasoning": "The comment directly addresses the main topic of the article.",
"on_topic": true,
"confidence": 0.95
},
"banned_topics": {
"reasoning": "No banned topics were detected in this comment.",
"banned_topics": [],
"quantity_on_banned_topics": 0,
"confidence": 0.99
}
},
"dogwhistle_check": {
"detection": {
"reasoning": "No dogwhistles detected in this comment.",
"dogwhistles_detected": false,
"confidence": 0.95
}
}
}
With Additional Parameters
- Python
- PHP
- REST API
- Blocking Client
- Async Client
result = client.megacall(
"Comment text here",
article_id,
include_spam=True,
include_relevance=True,
include_dogwhistle=True,
banned_topics=['politics', 'religion'],
sensitive_topics=['controversial topic'],
dogwhistle_examples=['known coded phrase']
)
result = await client.megacall(
"Comment text here",
article_id,
include_spam=True,
include_relevance=True,
include_dogwhistle=True,
banned_topics=['politics', 'religion'],
sensitive_topics=['controversial topic'],
dogwhistle_examples=['known coded phrase']
)
$client->megacall(
"Comment text here",
$articleId,
['spam', 'relevance', 'dogwhistle'],
['politics', 'religion'], // banned topics
null, // reply_to_comment
['controversial topic'], // sensitive topics
['known coded phrase'] // dogwhistle examples
);
Try it out live →
curl -X POST https://app.respectify.ai/v0.2/megacall \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"comment": "Comment text here",
"article_context_id": "550e8400-e29b-41d4-a716-446655440000",
"run_spam_check": true,
"run_relevance_check": true,
"run_dogwhistle_check": true,
"banned_topics": ["politics", "religion"],
"sensitive_topics": ["controversial topic"],
"dogwhistle_examples": ["known coded phrase"]
}'
Related
- MegaCallResult Schema
- Individual features: Spam, Comment Scoring