Notion receives Immunization registration data from NodeJS

Tram Ho

Today we will learn how to send data to Notion using API

Initialize the project

Here I use “Express application generator” to be able to quickly create Nodejs & Express projects

Steps:

1/ Install express-generator

2/ Initialize the project with the name InjectionRegistrationNotion

Untitled

Untitled

3/ Khởi chạy server bằng lệnh

Access localhost:3000

Untitled

Project confirmation screen is active

Create an HTML form for vaccination registration

To make the interface I use ejs engin because it is similar to pure HTML so it is easy to access

In file index.jes in folder views

In file “public/stylesheets/style.css”

F5 back to the browser to see the results

Untitled

Handling Server with Notion API

By the way this is a simple example. So I will write all the code in “routers/index.js” for easy tracking

We need to create a new route to receive the form submission

Check submitted data

On the interface

Untitled

On terminal after pressing “Send” button

Untitled

Here we have successfully sent the data from the HTML Form to the Nodejs server

Send data to Notion using API

First, we usually install the package “@notionhq/client

Untitled

Register to use package

Send data to Notion via API

Configure the .env file containing the Notion API registration information

After performing the above steps, you can check the results

Access http://localhost:3000/ Fill in the information and click “Send”

The results will be sent to Notion as shown below

Untitled

End

Through this article, I have shown you the most basic way to interact with Notion through the API it provides.

Based on the above knowledge, you can learn more and apply it for your development purposes

Git repository

https://github.com/qt91/InjectionRegistrationNotion (Don’t forget to leave me 1* )

Share the news now