Tutorial

How to Score Reddit Threads by Purchase Intent

Score Reddit threads by purchase and decision intent signals. Rank high-intent threads for sales and marketing outreach. Python at $0.005/query.

Not all Reddit threads are equal for outreach. A thread asking 'what's the best SERP API for my startup' has far higher purchase intent than 'what is a SERP API'. This scorer searches Reddit for your product category, classifies threads by intent signals, and outputs a ranked list of high-intent threads worth engaging with. Each search costs $0.005.

Prerequisites

  • Python 3.8+
  • requests library
  • A Scavio API key from scavio.dev
  • Target product category or keywords

Walkthrough

Step 1: Define intent signal patterns

Create pattern matchers for different levels of purchase intent.

Python
import os, requests, re

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

INTENT_SIGNALS = {
    'high_purchase': {
        'patterns': ['looking for', 'need a', 'want to buy', 'budget for', 'willing to pay',
                     'recommend me', 'what should i use', 'shopping for'],
        'weight': 10
    },
    'comparison': {
        'patterns': ['vs', 'versus', 'compared to', 'alternative to', 'better than',
                     'switch from', 'migrate from'],
        'weight': 8
    },
    'evaluation': {
        'patterns': ['review of', 'experience with', 'thoughts on', 'worth it',
                     'anyone tried', 'opinions on', 'how is'],
        'weight': 6
    },
    'pain_point': {
        'patterns': ['frustrated with', 'problem with', 'struggling with', 'hate',
                     'broken', 'too expensive', 'unreliable'],
        'weight': 7
    },
    'informational': {
        'patterns': ['what is', 'how does', 'explain', 'eli5', 'tutorial', 'guide'],
        'weight': 2
    }
}

print('Intent signal categories configured:')
for cat, data in INTENT_SIGNALS.items():
    print(f'  {cat}: {len(data["patterns"])} patterns, weight {data["weight"]}')

Step 2: Search Reddit and score threads

Pull Reddit threads and score each one by intent signals found.

Python
def score_thread(title, snippet):
    text = f'{title} {snippet}'.lower()
    total_score = 0
    matched_intents = []
    for category, data in INTENT_SIGNALS.items():
        for pattern in data['patterns']:
            if pattern in text:
                total_score += data['weight']
                matched_intents.append(category)
                break  # One match per category
    return total_score, list(set(matched_intents))

def search_and_score(query):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': query, 'platform': 'reddit', 'country_code': 'us'}).json()
    scored = []
    for r in data.get('organic_results', []):
        title = r.get('title', '')
        snippet = r.get('snippet', '')
        score, intents = score_thread(title, snippet)
        scored.append({
            'title': title[:80], 'link': r.get('link', ''),
            'snippet': snippet[:120], 'score': score,
            'intents': intents
        })
    scored.sort(key=lambda x: x['score'], reverse=True)
    return scored

results = search_and_score('serp api recommendation')
for r in results[:5]:
    print(f'  [{r["score"]:2}] {r["title"][:60]} | {r["intents"]}')

Step 3: Search multiple queries and aggregate

Run multiple intent-focused queries and combine results.

Python
def multi_query_score(product, queries=None):
    if not queries:
        queries = [
            f'{product} recommendation',
            f'best {product} for startup',
            f'{product} alternative',
            f'{product} vs',
            f'looking for {product}',
        ]
    all_scored = []
    seen_links = set()
    for query in queries:
        results = search_and_score(query)
        for r in results:
            if r['link'] not in seen_links:
                seen_links.add(r['link'])
                all_scored.append(r)
    all_scored.sort(key=lambda x: x['score'], reverse=True)
    cost = len(queries) * 0.005
    print(f'Scored {len(all_scored)} unique threads from {len(queries)} queries. Cost: ${cost:.3f}')
    return all_scored

scored = multi_query_score('serp api')
print(f'\nHigh intent threads (score >= 8):')
high_intent = [s for s in scored if s['score'] >= 8]
for s in high_intent[:10]:
    print(f'  [{s["score"]:2}] {s["title"][:60]}')
    print(f'       Intents: {", ".join(s["intents"])}')

Step 4: Generate outreach priority list

Rank threads by intent score and recency for outreach prioritization.

Python
def outreach_list(scored, min_score=6):
    qualified = [s for s in scored if s['score'] >= min_score]
    print(f'\n=== Outreach Priority List ===')
    print(f'Threads above score {min_score}: {len(qualified)}/{len(scored)}')
    print(f'\n{"#":3} {"Score":6} {"Intents":30} {"Thread":50}')
    print('-' * 95)
    for i, s in enumerate(qualified[:20], 1):
        intent_str = ', '.join(s['intents'][:3])
        print(f'{i:3} [{s["score"]:2}]  {intent_str:28} {s["title"][:48]}')
    # Summary stats
    if qualified:
        avg_score = sum(s['score'] for s in qualified) / len(qualified)
        intent_dist = {}
        for s in qualified:
            for intent in s['intents']:
                intent_dist[intent] = intent_dist.get(intent, 0) + 1
        print(f'\nAvg intent score: {avg_score:.1f}')
        print(f'Intent distribution:')
        for intent, count in sorted(intent_dist.items(), key=lambda x: -x[1]):
            print(f'  {intent}: {count} threads')

outreach_list(scored)

Python Example

Python
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

HIGH_INTENT = ['looking for', 'recommend', 'budget for', 'need a', 'best']

def score_reddit(query):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': query, 'platform': 'reddit', 'country_code': 'us'}).json()
    for r in data.get('organic_results', [])[:5]:
        text = f"{r.get('title','')} {r.get('snippet','')}".lower()
        score = sum(1 for p in HIGH_INTENT if p in text)
        if score > 0:
            print(f'  [{score}] {r["title"][:60]}')

score_reddit('serp api recommendation')

JavaScript Example

JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
const HIGH_INTENT = ['looking for', 'recommend', 'budget for', 'need a', 'best'];
async function scoreReddit(query) {
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: SH,
    body: JSON.stringify({ query, platform: 'reddit', country_code: 'us' })
  }).then(r => r.json());
  for (const r of (data.organic_results || []).slice(0, 5)) {
    const text = `${r.title || ''} ${r.snippet || ''}`.toLowerCase();
    const score = HIGH_INTENT.filter(p => text.includes(p)).length;
    if (score > 0) console.log(`  [${score}] ${r.title.slice(0, 60)}`);
  }
}
scoreReddit('serp api recommendation').catch(console.error);

Expected Output

JSON
Intent signal categories configured:
  high_purchase: 8 patterns, weight 10
  comparison: 7 patterns, weight 8
  evaluation: 7 patterns, weight 6
  pain_point: 7 patterns, weight 7

Scored 42 unique threads from 5 queries. Cost: $0.025

High intent threads (score >= 8):
  [18] Looking for a SERP API alternative to SerpAPI, budget $50/mo
       Intents: high_purchase, comparison
  [16] Need a search API for my AI agent startup, what should I use?
       Intents: high_purchase, evaluation
  [14] Frustrated with SerpAPI pricing, looking for alternatives
       Intents: pain_point, high_purchase

=== Outreach Priority List ===
Threads above score 6: 15/42

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8+. requests library. A Scavio API key from scavio.dev. Target product category or keywords. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Score Reddit threads by purchase and decision intent signals. Rank high-intent threads for sales and marketing outreach. Python at $0.005/query.