Skip to content

[Notion actions improvement] Integrate notion-helper createPage() and appendBlocks() functions for splitting API requests #18764

@TomFrankly

Description

@TomFrankly

Name of app / service

Pipedream's Notion actions have a common failure point (which all other automation apps share). The Notion API has a large list of request limits, which often cause workflow runs to fail.

A very common one is the tendency for input content (e.g. the contents of an email) to feature nested bullet lists. Pipedream already uses the martian package to convert markdown to Notion blocks, but this package does nothing to handle the Notion API's limits.

My package – notion-helper – does this. My suggestion is that notion-helper be used in Pipedream's Notion actions that create new pages or append blocks to existing pages.

Alternatively, that the code from my package's requests API specifically be incorporated into these Notion actions. A fork of the package might be the best way to do this.

For creating pages, the createPage() function can be used, and for appending blocks, there is appendBlocks().

I've put a large amount of time into building a block-splitting algorithm in appendBlocks() that respects every Notion API limit regarding the body of requests:

  1. Deeply nested child blocks
  2. Arrays containing more than 100 blocks
  3. The 1,000 total-block per-request limit
  4. All character limts

When strings go over the character limit, the package splits them intelligently and creates multiple Rich Text Objects where possible. When requests are too big, have too many blocks, or nest too deeply, the algorithm splits them into multiple requests as efficiently as possible.

I find myself having to regularly write my own custom Pipedream actions that do the exact same thing that Pipedream's native actions do, simply so that I can use my package and harden my workflows against these common, limit-based API failures.

I'd love to see my work incorporated into these native steps so that I can start using the native actions!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttriagedFor maintainers: This issue has been triaged by a Pipedream employee

Type

No type

Projects

Status

Ready for PR Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions