Ingest S3 documents into a Notion knowledge base

By General Input

Every hour, pull freshly uploaded PDFs and Word docs from an S3 inbox, summarize them, and file each one as a structured Notion page.

Integrations

  • Amazon S3
  • Notion

Type

Agentic Task

Categories

  • Operations

Every hour, scan a designated Amazon S3 inbox bucket for newly arrived PDFs and Word documents, extract their contents, and file a structured summary as a new Notion page. Trigger on cron: run once an hour.

Let the user configure four things at setup: the S3 bucket name, the S3 key prefix that scopes the inbox (a folder path inside the bucket, empty string means the whole bucket), the destination Notion database ID where summaries land, and a maximum file size in megabytes so oversized uploads are skipped.

Also configure the Notion tracking database ID: a separate small database that records which files have already been processed. Each row is one processed file keyed by its S3 object key. This is how the workflow avoids re-summarizing anything.

On each run: call Amazon S3 List Objects (V2) with the configured bucket and prefix. Paginate through the continuation token until every candidate is enumerated. Filter the returned keys to those ending in .pdf, .docx, or .doc (case insensitive) and drop the rest.

For each candidate key: query the Notion tracking database, filtering by the file key property, to check whether it has already been processed. If a matching row exists, skip the file. Otherwise proceed.

Call Amazon S3 Head Object on the key to confirm size and content type without downloading. If the size exceeds the configured maximum, log a skip and move on. If the content type does not match a PDF or Word document, log a skip and move on.

Call Amazon S3 Get Object (Download) to pull the file bytes. Parse the document to plain text (PDF or Word). From the extracted text, identify the following: a title (fall back to the filename if none is clear), the author or client the document is about, the three to seven most important topics, any explicit dates mentioned (deadlines, meeting dates, effective dates), and any action items or next steps written in the document.

Then call Notion Create a Page in the destination database with these fields: Title (the extracted title), Source File (the S3 key), Uploaded At (the LastModified timestamp from List Objects), Topics (the extracted topics as a multi-select or comma-separated list depending on the property type), and Summary (a two to four paragraph write-up covering what the document is, who it involves, the important dates, and the action items). Include the raw extracted key points as bulleted blocks in the page body so the full detail is preserved.

Finally, create a row in the Notion tracking database recording the file key, the processed timestamp, and a link to the newly created summary page so the next run knows to skip it.

If any step fails for a specific file (parse error, oversized, wrong type, download failure), log the failure and continue with the next file. Do not abort the run because one document was bad.

Related prompts

Explore more prompts
Screen chartered vessels for AIS gaps and sanctions red flagsCompare candidate store locations with drive time trade areasBrowse every competitor ad and build a Notion swipe fileAudience persona studio for brand and product marketersArtwork desk for the Notion posts still missing an imageShare of voice dashboard for your brand and competitorsInfluencer campaign roster board with AI creator briefsSmart home entity health cockpit for Home AssistantOpen model approval desk for your production AI stackBid board that watches every procurement portal for you