Skip to content
Ask Questions to your Notion Tables with Zapier

Ask Questions to your Notion Tables with Zapier

Today we're going to learn how to build a custom ChatGPT that can answer questions about your recruiting tracker database that you store in Notion.

ChatGPT is a game-changer, but it doesn't have any knowledge about your company, your product, or your data. Embedbase makes it easy for you to connect your data to ChatGPT.

Overview

We're going to cover a few things here, but the big picture is that:

  1. We'll need to send our Notion database to Embedbase every time it changes
  2. We'll use Zapier to listen to new Notion database items and send them to Embedbase
  3. We'll use Embedbase dashboard to ask questions about our recruiting tracker database

Diving into the implementation

As a reminder, we will create a custom ChatGPT that can answer questions about your recruiting tracker database that you store in Notion.

Creating a Notion database

If you don't already have a Notion database, let's create one. Head to your Notion workspace.

Then click on "Templates" and search for "Recruiting".

Creating a Zapier Zap

Alright, now that we have a Notion database, let's create a Zapier Zap that will send new items to Embedbase.

If you don't already have a Zapier account, you can create one for free here (opens in a new tab).

Once you have your account, open this link (opens in a new tab) to get access to the Embedbase Zapier app.

Then, go to the Zapier dashboard (opens in a new tab) and click on "Create Zap".

Notion Trigger

Let's find the Notion event that will trigger our Zap. Search for "Notion".

Now select the "New Database Item" trigger.

You will need to connect your account to Zapier. Click on "Connect an Account". You need to give access to Zapier to the pages you want to use that contain the database.

Now you should be able to select your database from the dropdown in the next step:

You should get some success message like this:

Awesome! You just created a Zap which triggers when a new Notion database item is created.

Embedbase Action

Now let's do something with this event data, like sending it to Embedbase, search for "Embedbase":

Choose the "Add Document" action.

You need to connect your Embedbase account by adding your Embedbase API key, you can find it in the Embedbase dashboard (opens in a new tab).

The most important step here is to add the right information from this Notion database item to Embedbase. We'll need to add the following:

ℹī¸

Note that path as a metadata key is a best practice in Embedbase as a way to let ChatGPT provide links to what he says, like and URL or a path to a file. Here ChatGPT will be able to point you to your Notion pages in his answers.

You can now test your Zap and see if it works.

Importing existing data

Let's import existing data:

Now, head to Embedbase dashboard (opens in a new tab) and you should see your documents.

Try the playground

The final result, head to the playground and select your Notion dataset and ask a question:

Closing thoughts

In summary, we have:

  • created a Notion database
  • created a Zapier Zap that sends new Notion database items to Embedbase
  • asked questions to our recruiting tracker database

Note here that we imported the existing data, but every time you will add a new item to your Notion database, it will be automatically sent to Embedbase.

The magic here is that Embedbase automatically find the right information to provide to ChatGPT (or any other AI).

That's it for today, you just learned how to use Zapier to connect any data source to Embedbase.

If you liked this blog post, leave a star ⭐ī¸ on https://github.com/different-ai/embedbase (opens in a new tab), we are also eager for feedback ❤ī¸. Please feel free to contact us for any help or join the Embedbase Discord (opens in a new tab) if you have any questions.

Where to go from here

Now that all your Notion data is in Embedbase, you can also build experiences programmatically with the Embedbase API and SDKs, just run npm i embedbase-js copy the following code in ask-your-notion.tsx:

ask-your-notion.tsx
import { createClient } from 'embedbase-js'
const embedbase = createClient('https://api.embedbase.xyz', process.env.EMBEDBASE_API_KEY)
 
const ask = async () => {
    const datasetId = 'notion-recruiting-tracker'
    const question = 'what kind of roles are we hiring in new york in q2?'
    const context = await embedbase.dataset(datasetId).createContext(question)
    const prompt =
        `Based on the following context:\n${context}\nAnswer the user's question: ${question}`
    for await (const res of embedbase.generate(prompt)) {
        console.log(res)
    }
}
 
ask()
$ export EMBEDBASE_API_KEY="<find me here https://app.embedbase.xyz>"
$ npx tsx ask-your-notion.tsx 
Based
 on
 the
 given
 context
,
 there
 are
 two
 users
 with
 the
 location
 "
New
 York
"
 and
 their
 roles
 are
 "
Software
 Engineer
,
//...

For more information, check out the Embedbase SDKs documentation (opens in a new tab).