Ever tried to research a potential client minutes before a sales call, only to find that your expensive data provider has outdated information? Yeah, me too. That's precisely why I spent last weekend building something different.
The Problem with Static Data π
Here's a scenario that might sound familiar:
Your sales rep is about to jump on a call with a hot prospect. They quickly look up the company in your fancy data enrichment tool and confidently mention, "I see you recently raised your Series A!" Only to hear an awkward laugh followed by "Actually, that was two years ago. We just closed our Series C last month."
Ouch.
Static databases, no matter how comprehensive, share one fundamental flaw: they're static. By the time information is collected, processed, and made available, it's often already outdated. In the fast-moving world of tech and business, that's a real problem.
A Different Approach π‘
What if instead of relying on pre-collected data, we could:
- Get real-time information from across the web
- Structure it exactly how we need it
- Never worry about data freshness again
That's exactly what we're going to build today using Linkup's API. The best part? It's just 50 lines of Python.
Let's Build It! π
Time to write some code! But don't worry - we'll break it down into bite-sized pieces that even your non-technical coworkers could understand (well, almost π).
1. Setting Up Our Project π
First, let's create our project and install the tools we need:
mkdir company-intel
cd company-intel
pip install linkup-sdk pydantic
Nothing fancy here - just creating a new folder and installing our two magical ingredients: linkup-sdk
for fetching data and pydantic
for making sure our data looks pretty.
2. Defining What We Want to Know π―
Before we start grabbing data, let's define what we actually want to know about companies. Think of this as your wishlist:
# schema.py - Our data wishlist! π
from pydantic import BaseModel
from typing import List, Optional
from enum import Enum
class CompanyInfo(BaseModel):
# The basics
name: str = "" # Company name (duh!)
website: str = "" # Where they live on the internet
description: str = "" # What they do (hopefully not just buzzwords)
# The interesting stuff
latest_funding: str = "" # Show me the money! π°
recent_news: List[str] = [] # What's the buzz? π°
leadership_team: List[str] = [] # Who's running the show? π₯
tech_stack: List[str] = [] # The tools they love β‘
This is like telling a restaurant exactly what you want in your sandwich. We're using pydantic
to make sure we get exactly what we ordered!
3. The Magic Machine π©β¨
Now for the fun part - the engine that makes everything work:
# company_intel.py - Where the magic happens! πͺ
from linkup import LinkupClient
from schema import CompanyInfo
from typing import List
class CompanyIntelligence:
def __init__(self, api_key: str):
# Initialize our crystal ball (aka Linkup client)
self.client = LinkupClient(api_key=api_key)
def research_company(self, company_name: str) -> CompanyInfo:
# Craft our research question
query = f"""
Hey Linkup! Tell me everything fresh about {company_name}:
π’ The name of the company, its website, and a short description.
π¦ Any recent funding rounds or big announcements?
π₯ Who's on the leadership team right now?
π οΈ What tech are they using these days?
π° What have they been up to lately?
PS: Only stuff from the last 3 months, please!
"""
# Ask the question and get structured answers
response = self.client.search(
query=query, # What we want to know
depth="deep", # Go deep, not shallow
output_type="structured", # Give me clean data
structured_output_schema=CompanyInfo # Format it like our wishlist
)
return response
Let's break down what's happening here:
- We create a new
CompanyIntelligence
class (fancy name, right?) - Initialize it with our API key (the key to the kingdom)
- Define a method that takes a company name and returns all the juicy details
- Write a friendly query that tells Linkup exactly what we want
- Get back clean, structured data that matches our wishlist
4. Making It Production-Ready π
Now let's wrap it in a nice API that your whole team can use:
# api.py - Sharing is caring! π€
from fastapi import FastAPI
app = FastAPI()
intel = CompanyIntelligence(api_key="your-linkup-api-key")
@app.get("/company/{name}")
async def get_company_info(name: str):
return intel.research_company(name)
What's cool here:
- FastAPI makes our tool available over HTTP (fancy!)
- Simple GET endpoint that anyone can use
5. Let's Take It for a Spin! π’
Time to see our creation in action:
# Let's try it out!
intel = CompanyIntelligence(api_key="your-key")
# Research Vercel (because who doesn't love Next.js?)
company = intel.research_company("Vercel")
print("π Here's what we found:")
print(f"π° Latest Funding: {company.latest_funding}")
print(f"π° Hot News: {company.recent_news[0]}")
print(f"β‘ Tech Stack: {', '.join(company.tech_stack)}")
And voilΓ ! Fresh, real-time company data at your fingertips!
6. Fun Extensions π¨
Want to make it even cooler? Here are some fun additions you could make:
# Add sentiment analysis to news
from textblob import TextBlob
def analyze_sentiment(news: List[str]) -> str:
sentiment = TextBlob(news[0]).sentiment.polarity
return "π" if sentiment > 0 else "π" if sentiment == 0 else "π"
# Add company size estimation
def estimate_size(funding: str) -> str:
if "Series C" in funding:
return "π¦ Big player!"
elif "Series B" in funding:
return "π¦ Growing fast!"
return "π₯ Startup vibes!"
Real World Impact π
We've been using this in production for our sales team, and it's been a game-changer:
- Pre-call research is always current
- Sales reps are more confident in their outreach
- We catch important company updates as they happen
- Our data actually gets better over time, not worse
Why This Matters π―
- Always Fresh: Information is gathered in real-time, not pulled from a static database
- Comprehensive: Combines data from multiple sources across the web
- Customizable: Structure the data exactly how your team needs it
- Efficient: Fast enough for real-time lookups before calls
- Maintainable: Simple code that any developer can understand and modify
Future Ideas π
The possibilities are endless! Here are some ideas to take it further:
For Sales Teams:
- Slack bot for instant lookups (
/research company-name
) - Chrome extension that shows company info on LinkedIn
- Automatic CRM enrichment
For Marketing Teams:
- Track competitor content strategies
- Monitor industry trends
- Identify potential partnership opportunities
For Product Teams:
- Track competitor feature launches
- Monitor customer tech stacks
- Identify integration opportunities
Try It Yourself π οΈ
Ready to build your own? Here's what you need:
- Get a Linkup API key
- Copy the code above
- Customize the schema for your needs
- Deploy and enjoy always-fresh company data!
Wrapping Up π
The days of static databases are numbered. In a world where companies pivot overnight, raise rounds weekly, and change their tech stacks monthly, real-time intelligence isn't just nice to haveβit's essential.
What we built here is just the beginning. Imagine combining this with:
- AI for automatic insights
- Trend detection across industries
- Predictive analytics for company growth
Have you built something similar? How do you handle the challenge of keeping company data fresh? Let me know in the comments!
python #api #saas #webdev #buildinpublic
Built with β and a healthy obsession with fresh data
Top comments (4)
Thanks for sharing this @guillaumelarch. Would try to do something similar for people and celebs
Great idea!
Insane ! π
Great tutorial!! This is actually super powerful!