Tutorial

How to Enrich LinkedIn Reply Context with Search Data

Enrich LinkedIn reply context with company and person data from Scavio search before replying. Write informed replies, not generic ones.

An r/micro_saas post showed that the best LinkedIn replies reference specific company context. The problem: manually researching each prospect before replying takes too long. This tutorial builds an enrichment step that pulls company data from search before you craft a reply.

Prerequisites

  • Scavio API key
  • Python 3.8+
  • LinkedIn messages or connection requests to respond to

Walkthrough

Step 1: Extract prospect info from LinkedIn message

Parse the company and person name from the conversation.

Python
def parse_prospect(linkedin_message):
    # In practice, you would extract from LinkedIn UI or API
    return {
        'name': linkedin_message.get('sender_name', ''),
        'company': linkedin_message.get('company', ''),
        'title': linkedin_message.get('title', ''),
        'message': linkedin_message.get('text', '')
    }

Step 2: Enrich with search data

Search for the prospect's company and recent news.

Python
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def enrich_prospect(company, person_name):
    # Company info
    company_data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=H,
        json={'platform': 'google', 'query': f'{company} company'}).json()
    # Recent news
    news = requests.post('https://api.scavio.dev/api/v1/search',
        headers=H,
        json={'platform': 'google', 'query': f'{company} news 2026'}).json()
    # Person background
    person = requests.post('https://api.scavio.dev/api/v1/search',
        headers=H,
        json={'platform': 'google', 'query': f'{person_name} {company}'}).json()
    return {
        'company_results': company_data.get('organic_results', [])[:3],
        'news': news.get('organic_results', [])[:3],
        'person': person.get('organic_results', [])[:3]
    }

Step 3: Generate reply context summary

Summarize the enrichment data into a brief context sheet.

Python
def context_summary(enrichment):
    summary = 'CONTEXT FOR REPLY:\n\n'
    summary += 'Company:\n'
    for r in enrichment['company_results']:
        summary += f"  - {r.get('title', '')}: {r.get('snippet', '')}\n"
    summary += '\nRecent News:\n'
    for r in enrichment['news']:
        summary += f"  - {r.get('title', '')}\n"
    summary += '\nPerson Background:\n'
    for r in enrichment['person']:
        summary += f"  - {r.get('title', '')}: {r.get('snippet', '')}\n"
    return summary

Step 4: Draft an informed reply

Use the context to write a reply that shows you did your homework.

Python
def draft_reply(prospect, context):
    # In production, feed context to an LLM for drafting
    # Here is a manual template approach
    news_ref = context['news'][0].get('title', '') if context.get('news') else ''
    reply = (f'Thanks for reaching out, {prospect["name"]}.\n\n')
    if news_ref:
        reply += f'I noticed {prospect["company"]} was recently covered -- '
        reply += f'"{news_ref}" caught my eye.\n\n'
    reply += 'Would love to explore how we might work together.'
    return reply

Python Example

Python
import os, requests
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def enrich_for_reply(company, person):
    for q in [f'{company} company', f'{company} news 2026', f'{person} {company}']:
        data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
            json={'platform': 'google', 'query': q}).json()
        for r in data.get('organic_results', [])[:2]:
            print(f"  {r.get('title', '')}")

enrich_for_reply('Notion', 'Ivan Zhao')

JavaScript Example

JavaScript
const enrichment = await fetch('https://api.scavio.dev/api/v1/search', {
  method: 'POST',
  headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
  body: JSON.stringify({platform: 'google', query: `${company} news 2026`})
}).then(r => r.json());

Expected Output

JSON
Context sheet with company overview, recent news, and person background. 3 search queries per prospect = $0.015. Use the context to write informed LinkedIn replies.

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.

Scavio API key. Python 3.8+. LinkedIn messages or connection requests to respond to. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 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

Enrich LinkedIn reply context with company and person data from Scavio search before replying. Write informed replies, not generic ones.