Skip to content
Notifications
Clear all

Step-by-step: How I linked ChatPDF to my Notion for client research.

2 Posts
2 Users
0 Reactions
5 Views
(@grafana_knight_shift)
Estimable Member
Joined: 4 months ago
Posts: 92
Topic starter   [#19685]

I've been experimenting with ChatPDF for client research—mostly parsing dense technical whitepapers and long RFCs—but the real win came when I figured out how to pipe the summaries directly into a Notion database. It's cut my report assembly time in half. Here's the workflow I settled on.

The core of it is a simple Python script that uses the ChatPDF API. I trigger it from a Make (formerly Integromat) scenario whenever I drop a new PDF into a dedicated S3 bucket, but you could just as easily run it locally after a manual upload. The script fetches the file, sends it to ChatPDF, asks a predefined set of questions, and posts the structured answers to Notion via their API.

Here's the key part of the script. I keep my prompts focused on extracting specific, actionable data.

```python
import requests

# 1. Upload PDF to ChatPDF and get sourceId
pdf_response = requests.post(
'https://api.chatpdf.com/v1/sources/add-file',
files={'file': open('client_rfc.pdf', 'rb')},
headers={'x-api-key': CHATPDF_API_KEY}
)
source_id = pdf_response.json()['sourceId']

# 2. My standard set of research questions
questions = [
"List the primary technical objectives stated in this document.",
"Extract any mentioned performance benchmarks or SLO targets.",
"What are the stated implementation risks or dependencies?"
]

answers = []
for q in questions:
chat_response = requests.post(
'https://api.chatpdf.com/v1/chats/message',
json={
'sourceId': source_id,
'messages': [{'role': 'user', 'content': q}]
},
headers={'x-api-key': CHATPDF_API_KEY}
)
answers.append(chat_response.json()['content'])

# 3. Format and send to Notion
notion_data = {
"parent": {"database_id": NOTION_DB_ID},
"properties": {
"Document Title": {"title": [{"text": {"content": "Client RFC Analysis"}}]},
"Date Reviewed": {"date": {"start": today_iso}}
},
"children": [
{
"object": "block",
"type": "paragraph",
"paragraph": {"rich_text": [{"text": {"content": f"Q: {q}nA: {a}"}}]}
}
for q, a in zip(questions, answers)
]
}
```

I've set up the Notion database with properties for Client Name, Project Phase, and Status, so each new ChatPDF analysis creates a page that's already categorized. The biggest pitfalls I ran into:
* ChatPDF's context window for very large PDFs—sometimes I have to chunk the document.
* Needing to tune the prompts heavily to avoid vague summaries. Asking for *lists* and *direct quotes* works much better than "summarize this."

For anyone doing client or incident post-mortem research, this kind of glue logic turns ChatPDF from a neat chat tool into a real pipeline component. Curious if others have built similar bridges to their note-taking systems.

- away



   
Quote
(@devops_grunt)
Estimable Member
Joined: 4 months ago
Posts: 159
 

I like the automation approach, but you're introducing two points of failure and latency with S3 and Make. Have you containerized the Python script? This feels like a perfect job for a lightweight Lambda or Cloud Run instance triggered directly from the bucket event. You'd drop the Make dependency entirely.

Also, hardcoding the questions in the script means a change requires a redeploy. I'd pull them from a config map or a simple JSON in S3 so your research focus can shift without touching the pipeline. Your API keys are environment variables, I hope, not sitting in that source file.

How are you handling retries when the ChatPDF API has a hiccup? That POST to Notion will fail silently if you don't have logic for it.


Automate everything. Twice.


   
ReplyQuote