Run your own code in a workflow

A workflow step that runs JavaScript or TypeScript you write, in an editor inside the builder that checks the code against your own Notion properties as you type.

Problem

A workflow can update records, send notifications, call a webhook, and change the screen. When the logic is more than those steps can express, the maker has to send the data to another service, write the code there, and pay for and maintain that service.

Who it is for

A developer, or a maker working with one, who needs custom logic in an app: a price calculation, a call to another system’s API, a check across several records, or a reply to an incoming webhook.

What happens today

Workflows have fixed step types. None of them runs code. Custom JavaScript in Settings runs in the browser only and cannot be part of a workflow. The Call webhook step can hand the work to an outside service, which then has to be hosted somewhere else.

Requirement

  • A new workflow step, Run code, written in JavaScript or TypeScript.
  • The step can be started by a button, a webhook, a schedule, or a message, like any other workflow.
  • The code editor is in the builder. It completes and checks the names of your Notion properties, the signed-in user’s fields, and the results of earlier steps. Errors show before you publish.
  • The code knows which app user pressed the button, including users who are not members of your Notion workspace.
  • The code can read and change the records in the databases connected to the app, and call other services.
  • What the code returns can be used by later steps, for example to open a screen, show a message, or update a record.
  • You can test a draft against the data from an earlier run. During a test, record changes are shown and not made.
  • Each run shows what the code logged and what it returned.
  • API keys are stored as secrets, separate from the code.
  • You can go back to an earlier published version of the code.
  • A failed run is retried, and can be retried by hand. The workflow is not paused.

How record changes reach Notion

Record changes made by the code go through the normal NotionApps sync, the same as a change made in the app. The code does not write to Notion directly.

A change made in Notion also arrives through the normal sync. It does not start code by itself. To start code when something changes in Notion, add a Send webhook action to a Notion automation and point it at the workflow’s webhook. That part is set up in Notion and is outside the control of NotionApps.

Two levels

Both levels run on the same engine. Code written for the first runs unchanged on the second, so moving up is a switch and not a rewrite.

Included with plans that have workflows Add-on, available on each plan
Editor, logs, testing, secrets, versions Yes Yes
npm packages No, built-in functions only Yes
Run time and memory Short scripts (target: 10 seconds, 128 MB) Long scripts (target: 5 minutes, 512 MB)
Monthly runs A monthly allowance A larger allowance, with more runs at the same time
Long jobs that pause and continue No Yes

The run time and memory figures are targets and may change before release. Prices and allowance sizes are not set yet.

How this compares with Notion

Notion added Workers in 2026, which also run custom code. The differences:

Notion Workers NotionApps
Where you write code On your computer, deployed with a command-line tool In the builder, in the browser
What can start it A schedule, an incoming webhook, or a Notion agent A button in your app, a webhook, a schedule, or a message
Who the code runs for The workspace The app user who pressed the button
What the result can do Write data Change records and change what the app user sees
When a run fails A failed webhook action pauses the automation The run is retried and the workflow keeps going
Testing Run after deploying Run a draft against an earlier run, before publishing

On cost:

  • Notion Workers need a Business or Enterprise plan. Business is listed at $20 per member per month, so a team of ten pays $200 a month before any code runs.
  • Notion then prices each run at about $0.0023 in Notion credits.
  • NotionApps does not charge per member or per run for code. Short scripts are part of the plan, with a monthly allowance. The add-on is a flat monthly price on top of any plan.

Out of scope

This does not write to Notion directly, and it does not start code from a change in Notion without a Notion webhook. It does not replace Custom JavaScript in Settings, which still runs in the browser. It does not let code reach databases that are not connected to the app.

Acceptance

  • A Run code step can be added to a workflow started by a button, a webhook, a schedule, or a message.
  • Typing a property name that does not exist in the connected database shows an error in the editor.
  • Code with an error cannot be published.
  • A value the code returns can be picked in a later step.
  • A record changed by the code shows in the app, and reaches Notion through the normal sync.
  • A Notion automation’s Send webhook action, pointed at the workflow’s webhook, starts the code.
  • A test run against an earlier run’s data changes no records.
  • A run’s logs and returned value are visible in Activity.
  • A secret’s value does not appear in the code, the logs, or the run details.
  • A script that runs too long is stopped, and the run shows why.
  • An app without the add-on cannot publish code that uses an npm package, and is told why.
  • Restoring an earlier version brings back that version’s code.