A FastAPI-powered backend for generating highly personalized, research-driven business development emails using real-time company news, case studies, and AI summarization. Deployable to Google Cloud Run with Docker and GitHub Actions, with secrets managed via Google Secret Manager.
- Company News Aggregation:
- Fetches recent news headlines using DuckDuckGo or Google Custom Search.
- Crawls news article URLs and extracts their content as markdown.
- Case Study Context:
- Integrates with Pinecone to retrieve relevant case studies and context for a given company or query.
- AI Summarization:
- Uses OpenAI's GPT models to summarize news and generate outreach emails.
- Reranking:
- Uses Pinecone’s reranker to prioritize the most relevant news and case study content.
- API Endpoints:
/chat: Main endpoint for generating a business development email based on a company name or query./: Serves a static HTML frontend for quick testing.
git clone https://github.com/aaronkao/clay-outreach-bot.git
cd clay-outreach-botIt is recommended to use uv or pip:
uv pip install -r requirements.txt
# or
pip install -r requirements.txtCreate a .env file in the project root with the following variables:
OPENAI_API_KEY=your-openai-api-key
PINECONE_API_KEY=your-pinecone-api-key
PINECONE_ASSISTANT_NAME=your-pinecone-assistant-name
GOOGLE_API_KEY=your-google-api-key
CSE_ID=your-google-custom-search-engine-id
GOOGLE_SEARCH_URL=https://www.googleapis.com/customsearch/v1
uvicorn main:app --reloadOr with Docker
docker build -t clay-outreach-bot .
docker run --env-file .env -p 8000:8000 clay-outreach-bot- GitHub Action is setup to run manually or pushing to
master. - Pipeline builds Docker image, uploads to Container Reigstry, and deploys to Cloud Run.
- See
.github/workflows/for workflow YAMLs.
- Store API keys and secrets in Google Secret Manager.
- Grant Cloud Run service account access to secrets.
- Reference secrets as environment variables in Cloud Run settings.
The response will be a generated business development email tailored to the company, using recent news and verified case studies.
Send a POST request to /chat with a JSON body:
curl -X POST "http://127.0.0.1:8000/chat" -H "Content-Type: application/json" -d '{"message": "Morgan Stanley"}' Replace YOUR_CLOUD_RUN_URL with your deployed URL:
curl -X POST "https://YOUR_CLOUD_RUN_URL/chat" \
-H "Content-Type: application/json" \
-d '{"message": "Morgan Stanley"}'Visit http://127.0.0.1:8000/ (or your Cloud Run URL) to use the static HTML frontend.
main.py: FastAPI app and main orchestration logic.crawler_utils.py: Utilities for crawling URLs, searching news, and summarizing content.rerank_utils.py: Pinecone reranking utilities.frontend.html: Static HTML frontend for quick testing.requirements.txt: Python dependencies..env: Environment variables (not committed).Dockerfile: Containerization for deployment..github/workflows/: GitHub Actions CI/CD workflows.
- Ensure all API keys are valid and have sufficient quota.
- The project uses async functions for crawling and summarization.
- Extend
crawler_utils.pyto add more search/crawling providers if needed.
Apache 2.0