1
3 Comments

How I integrated Notion with Natural Language Processing (NLP) to help get better search results

I don't know about y'all but I ran into multiple problems with using Notion on a team. They're really the same problems of any knowledge base that is maintained over time:

  • People lose content or don't realize it exists
  • People ask the same questions frequently
  • Content is hard to find even if you know it exists

I built Zomory as an attempt to solve these things. You can follow these steps to build you're own too!

Notion

Notion is an incredibly powerful tool and is great for managing many different types of content. They also have an API available that makes programmatic access possible.

You can build your own on top of it using an Internal or Public integration. It's possible to run software on top of Internal integrations but in my opinion the user experience is much better with Public integrations.

Connect your code to your Public integration and begin syncing the content. Two things you'll need to do to sync the content:

  1. Poll workspaces for changes: Notion does not have webhooks so you'll have to monitor for changes on your own.
  2. Recursively access every Block across connected pages: Notion does not have a way to pull all content for a page in a single request.

Once you've synced your content, you can move on to the next step!

OpenAI Embeddings + Pinecone

Put simply, embeddings are a way to represent the semantics for written content. That is, they represent the meaning of particular sentences and paragraphs.

You can use OpenAI's API to generate Embeddings from your Notion content. You can't stop there, though. You'll need to save them so you can access them later! But where and how do you save them?

Enter Pinecone. Pinecone is a hosted Vector Database that enables you to store and search your embeddings. Take the embeddings you generated from OpenAI and insert them into Pinecone for later!

Searching

We're almost there. We've got our Notion content. We've generated embeddings. Now we need to search!

Take the user's question and generate another embedding from OpenAI. You can take that result and send it into Pinecone. Pinecone will find the most related results for you based on the similarity of words to those included in the question, even when they're not right next to each other or the exact words! For example, when a user asks "What is the price of Zomory's Base Plan?" it will find results for something that may say:

Pricing
$10 - Base Plan
Features:

  • Etc...

Now you've got context.

Answering questions

Take the results you just received, plop them into the Open AI Completion API using prompt engineering, and OpenAI will give you back an answer that is knowledgeable about your Notion workspace.

Alternatives

Of course, all of this takes time to build. Feel free to go develop your own! But, if you want to save that time, Zomory's available for free to try. In addition to searching and answering questions as described above, it also

  • integrates directly with your Slack team so your teammates can have their questions answered without leaving where they work
  • Runs a Chat GPT equivalent directly in Slack so you can interact with it there
  • Provides the source pages so you can further explore or verify answer accuracy

Have any of you done something similar? I'd love to hear your thoughts.

on March 13, 2023
  1. 2

    Is this still available? I want to use this for my team. Website is down. Happy to pay for it and/or collaborate. The email on my profile is the best way to get in touch with me.

    1. 1

      Looks like the app wasn't able to restart itself after a crash. Should be good to go now for you to try it out!

Trending on Indie Hackers
This Week in AI: The Gap Is Getting Clearer User Avatar 45 comments 1 small portfolio change got me 10x more impressions User Avatar 28 comments AI Is Destroying the Traditional Music Business and Here’s Why. User Avatar 22 comments Fixing my sleep using public humiliation and giving away a Kindle User Avatar 16 comments A Tiny Side Project That Just Crossed 100 Users — And Somehow Feels Even More Real Now User Avatar 13 comments From 1k to 12k visits: all it took was one move. User Avatar 11 comments