Discover how to integrate v0 with Notion seamlessly. Our guide walks you through setup, tips, and troubleshooting for a smoother and more productive workflow.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
package.json file.
{
"dependencies": {
"@notionhq/client": "^2.2.2",
// other dependencies...
}
}
notionIntegration.ts in your project's source folder (for example, in a folder named src if available).notionIntegration.ts. This code initializes the Notion client and defines a helper function to create a Notion page.
import { Client } from "@notionhq/client";
// Initialize Notion client with an API key.
// Replace 'YOURNOTIONAPI_KEY' with your actual Notion integration token.
// In a real application, consider storing this token in an environment variable.
const notion = new Client({
auth: process.env.NOTIONAPIKEY || "YOURNOTIONAPI_KEY"
});
/**
- Create a new page in a specified Notion database.
- @param databaseId - The ID of the Notion database.
- @param properties - An object containing the properties for the new page.
- @returns The response from the Notion API.
*/
export async function createNotionPage(databaseId: string, properties: any) {
try {
const response = await notion.pages.create({
parent: { database_id: databaseId },
properties: properties,
});
console.log("Notion page created:", response);
return response;
} catch (error) {
console.error("Error creating Notion page:", error);
}
}
config.ts), add the following line to set your token:
process.env.NOTIONAPIKEY = "YOURNOTIONAPI_KEY";
"YOURNOTIONAPI_KEY" with your actual Notion integration token.
main.ts or another relevant file).createNotionPage function:
import { createNotionPage } from "./notionIntegration";
createNotionPage at the appropriate place in your application. For instance, to create a page when a specific event occurs, add:
async function onEventTrigger() {
const databaseId = "YOURDATABASEID"; // Replace with your Notion database ID
const properties = {
Name: {
title: [
{
text: {
content: "New Page Title"
}
}
]
},
// Add other property configurations as needed
};
const page = await createNotionPage(databaseId, properties);
// Handle the response or update your UI accordingly
}
onEventTrigger();
package.json.When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.