A simple way to post form data to a Notion DB.
- Create a Table page in Notion, and add columns:
- Firstname
- Lastname
-
Head over to the Notion API Documentation to generate an API key. You will have to click the
My integrations
on the top right to create an integration and generate an API key. -
Go back to your Notion page, click
Share
in the top right, and search for the integration you just created and give it access to the DB. In the sameShare
dialog, clickCopy Link
. This will give you a link to your page. It should look something like this: https://www.notion.so/{DB-ID}?v={PAGE-ID} -
Copy the
DB-ID
from the URL and add it to the.env
file under the keyNOTION_DB_ID
. Also add your API key to theNOTION_TOKEN
key. -
Run
npm run dev
to start up remix, and submit your form!
- .env - Stores your Notion integration key and DB ID.
- notion.server.ts - Initializes the Notion client and exports it for use across your application.
- root.tsx - imports the notion client from the
notion.server.ts
file, and calls the Notion API with the submitted form data via the action function.