---
title: Build a Notion AI Assistant
---


### Intro

Notion is a powerful tool for managing knowledge. Its flexibility and extensibility make it an excellent personal knowledge library and shared workspace. Many people use it to store their knowledge and work in collaboration with others, facilitating the exchange of ideas and the creation of new knowledge.

However, this knowledge remains static, as users must search for the information they need and read through it to find the answers they're seeking. This process is neither particularly efficient nor intelligent.

Have you ever dreamed of having an AI assistant based on your Notion library? This assistant would not only assist you in reviewing your knowledge base, but also engage in the communication like a seasoned butler, even answering other people's questions as if you were the master of your personal Notion library.

### How to Make Your Notion AI Assistant Come True?

Now, you can make this dream come true through [Dify](https://dify.ai/). Dify is an open-source LLMOps (Large Language Models Ops) platform.

Large Language Models like ChatGPT and Claude, have been using their impressive abilities to reshape the world. Their powerful learning aptitude primarily attributable to robust training data. Luckily, they've evolved to be sufficiently intelligent to learn from the content you provide, thus making the process of ideating from your personal Notion library, a reality.

Without Dify, you might need to acquaint yourself with langchain, an abstraction that streamlines the process of assembling these pieces.

### How to Use Dify to Build Your Personal Notion AI Assistant?

The process to train a Notion AI assistant is relatively straightforward. Just follow these steps:

1. Login to Dify.
2. Create a new datasets.
3. Connect with Notion and your datasets.
4. Start training.
5. Create your own AI application.

#### 1. Login to dify

Click [here](https://dify.ai/) to login to Dify. You can conveniently log in using your GitHub or Google account.

> If you are using GitHub account to login, how about getting this [project](https://github.com/langgenius/dify) a star? It really help us a lot!

#### 2. Create new knowledge base

Click the `Knowledge` button on the top side bar, followed by the `Create Knowledge` button.

![](https://assets-docs.dify.ai/2025/03/a5d9c40fb35b0f80e7de2b7418f6eedd.png)

#### 3. Connect with Notion and Your Knowledge[​](https://wsyfin.com/notion-dify#3-connect-with-notion-and-datasets)

Select "Sync from Notion" and then click the "Connect" button..

![](https://assets-docs.dify.ai/2025/03/f7a0f9cab9e93ea0e8874c001ffd2af3.png)

Afterward, you'll be redirected to the Notion login page. Log in with your Notion account.

![](https://assets-docs.dify.ai/2025/03/fd4714139bdcf1509d8a8ae2a3d7afd9.png)

Check the permissions needed by Dify, and then click the "Select pages" button.

![](https://assets-docs.dify.ai/2025/03/b4b7faedab6c232a5680322801e4466a.png)

Select the pages you want to synchronize with Dify, and press the "Allow access" button.

![](https://assets-docs.dify.ai/2025/03/fe00306264fa0334c6f96ba049460d08.png)

#### 4. Start training[​](https://wsyfin.com/notion-dify#4-start-training) <a href="#id-4-start-training" id="id-4-start-training"></a>

Specifying the pages for AI need to study, enabling it to comprehend the content within this section of Notion. Then click the "next" button.

![](https://assets-docs.dify.ai/2025/03/4e86d66f5ce46b2043f0eb9165a73572.png)

We suggest selecting the "Automatic" and "High Quality" options to train your AI assistant. Then click the "Save & Process" button.

![](https://assets-docs.dify.ai/2025/03/21184bca8647509abc58c75ad3002582.png)

Enjoy your coffee while waiting for the training process to complete.

![](https://assets-docs.dify.ai/2025/03/73cddadbf3b34edda974f8f47165d988.png)

#### 5. Create Your AI application[​](https://wsyfin.com/notion-dify#5-create-your-ai-application) <a href="#id-5-create-your-own-ai-application" id="id-5-create-your-own-ai-application"></a>

You must create an AI application and link it with the knowledge you've recently created.

Return to the dashboard, and click the "Create new APP" button. It's recommended to use the Chat App directly.

![](https://assets-docs.dify.ai/2025/03/8e91ce29dd346b3edd0f26a261e27ad2.png)

Select the "Prompt Eng." and link your notion datasets in the "context".

![](https://assets-docs.dify.ai/2025/03/853c348bfc86a2f845a7698fe715f6f1.png)

I recommend adding a 'Pre Prompt' to your AI application. Just like spells are essential to Harry Potter, similarly, certain tools or features can greatly enhance the ability of AI application.

For example, if your Notion notes focus on problem-solving in software development, could write in one of the prompts:

_I want you to act as an IT Expert in my Notion workspace, using your knowledge of computer science, network infrastructure, Notion notes, and IT security to solve the problems_.

![](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/learn-more/use-cases/f5a5e95e1120906669b3c1ad4e186dea.png)

It's recommended to initially enable the AI to actively furnish the users with a starter sentence, providing a clue as to what they can ask. Furthermore, activating the 'Speech to Text' feature can allow users to interact with your AI assistant using their voice.

![](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/learn-more/use-cases/ffa36d0313dba8ac4255424c4f880191.png)

Finally, Click the "Publish" button on the top right of the page. Now you can click the public URL in the "Monitoring" section to converse with your personalized AI assistant!

![create-app-4](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/learn-more/use-cases/1f8c6f7d7f3d61a1928d25ab85f7b1ff.png)

### Utilizing API to Integrate With Your Project <a href="#utilizing-api-to-integrate-with-your-project" id="utilizing-api-to-integrate-with-your-project"></a>

Each AI application baked by Dify can be accessed via its API. This method allows developers to tap directly into the robust characteristics of large language models (LLMs) within frontend applications, delivering a true "Backend-as-a-Service" (BaaS) experience.

With effortless API integration, you can conveniently invoke your Notion AI application without the need for intricate configurations.

Click the "API Reference" button on the page of Overview page. You can refer to it as your App's API document.

![using-api-1](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/learn-more/use-cases/4062ac40525d573f14a8059a6605688a.png)

#### 1. Generate API Secret Key[​](https://wsyfin.com/notion-dify#1-generate-api-secret-key) <a href="#id-1-generate-api-secret-key" id="id-1-generate-api-secret-key"></a>

For security reasons, it's recommended to create a new API secret key to access your AI application.

![using-api-2](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/learn-more/use-cases/b2546aa50caff4316798edc0b950661d.png)

#### 2. Retrieve Conversation ID[​](https://wsyfin.com/notion-dify#2-retrieve-conversation-id) <a href="#id-2-retrieve-conversation-id" id="id-2-retrieve-conversation-id"></a>

After chatting with your AI application, you can retrieve the session ID from the "Logs & Ann." pages.

![using-api-3](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/learn-more/use-cases/6feec1081814299c574b5fb4af3f2bb8.png)

#### 3. Invoke API[​](https://wsyfin.com/notion-dify#3-invoke-api) <a href="#id-3-invoke-api" id="id-3-invoke-api"></a>

You can run the example request code on the API document to invoke your AI application in terminal.

Remember to replace `YOUR SECRET KEY` and `conversation_id` on your code.

> You can input empty `conversation_id` at the first time, and replace it after you receive response contained `conversation_id`.

```
curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inputs": {},
    "query": "eh",
    "response_mode": "streaming",
    "conversation_id": "",
    "user": "abc-123"
}'
```

Sending request in terminal and you will get a successful response.

![](https://assets-docs.dify.ai/2025/03/fb57e6a8fdb61fbc7b3c3d42f32d2ca5.png)

If you want to continue this chat, go to replace the `conversation_id` of the request code to the `conversation_id` you get from the response.

And you can check all the conversation history on the "Logs & Ann." page.

![](https://assets-docs.dify.ai/2025/03/1b7644c76a65eb6b7ad4937ba681fcd3.png)

### Sync with notion periodically[​](https://wsyfin.com/notion-dify#sync-with-notion-periodically) <a href="#sync-with-notion-periodically" id="sync-with-notion-periodically"></a>

If your Notion's pages have updated, you can sync with Dify periodically to keep your AI assistant up-to-date. Your AI assistant will learn from the new content.

![](https://assets-docs.dify.ai/2025/03/5a2b362a900401b85f1ba69414edf076.png)

### Summary

In this tutorial, we have learned not only how to import Your Notion data into Dify, but also know how to use the API to integrate it with your project.

[Dify](https://dify.ai/) is a user-friendly LLMOps platform targeted to empower more individuals to create sustainable, AI-native applications. With visual orchestration designed for various application types, Dify offers ready-to-use applications that can assist you in utilizing data to craft your distinctive AI assistant. Do not hesitate to contact us if you have any inquiries.

{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}

---

[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/learn-more/use-cases/build-an-notion-ai-assistant copy.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?title=Documentation%20Issue%3A%20-an-notion-ai-assistant c&body=%23%23%20Issue%20Description%0A%3C%21--%20Please%20briefly%20describe%20the%20issue%20you%20found%20--%3E%0A%0A%23%23%20Page%20Link%0Ahttps%3A%2F%2Fgithub.com%2Flanggenius%2Fdify-docs%2Fblob%2Fmain%2Fen/learn-more/use-cases%2Fbuild-an-notion-ai-assistant copy.mdx%0A%0A%23%23%20Suggested%20Changes%0A%3C%21--%20If%20you%20have%20specific%20suggestions%20for%20changes%2C%20please%20describe%20them%20here%20--%3E%0A%0A%3C%21--%20Thank%20you%20for%20helping%20improve%20our%20documentation%21%20--%3E)

