How to send an HTML form to Notion
A Notion database is a handy place for form submissions. Each one becomes a page you can open, add notes to, give a status and assign, and the whole team sees it in a board or table view. Notion's own forms do this, but they live on a Notion page. If the form is already on your site, in plain HTML or React or Astro, something has to take the post and call Notion's API. This guide does it two…
To send an HTML form to Notion, first create a database in Notion with the necessary properties: Name (title), Email (email), and Message (text). After creating the database, set up an integration by accessing notion.so/profile/integrations, enabling the "Insert content" capability, and copying the Internal Integration Secret.
Next, add the integration to the database by opening the database page, clicking ⋯ → Connections, and selecting the integration. Make sure to obtain the database ID, which is the 32-character string found in the URL before the "?v=".
For the server-side solution, use a Cloudflare Worker. Define the PROPERTIES object with the field names and their corresponding Notion property names and types. Set the ALLOWED_ORIGIN to the website hosting the form. In the fetch event handler, check if the request method is POST, and if not, return a 405 status. Retrieve the form data, and for each property, process the value according to its type.
Ensure the email property is present before sending the request to Notion's API. If the response is not successful, log the error and return a 502 status. Otherwise, return the response as JSON.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.