Home / All Integrations / Notion

free

Connect Notion to your chatbot

Add data to a Notion database


Notion is a super versatile, all-in-one workspace that helps you keep track of things, get organized, and share information across teams, even if your team is all spread around the world. Whether you're building a project roadmap, creating an internal directory for your company, or creating next season's editorial calendar, Notion's got you covered.

With the CSML Studio integration for Notion, you can automatically sync data collected by your chatbot to a Notion database so that they're easy to share, modify, and collaborate on.

Setup

To setup this App, you need to create a Notion account, a database (table) on Notion, an integration, and to share your database with this integration. You can follow this simple guide (steps 1-2) to perform these actions!

Then, retrieve your Notion API key and the ID of your Notion database that you would like to connect with in your chatbot, and install this app.

Make sure that you share your database with the integration! Otherwise it will not be able to access it.

Usage

The Notion CSML Studio app lets you add and query items on your database.

Adding items to your Notion database

To add items to your database, you will need the database ID as well as the properties you want to add.
This page gives you more information about how to build the properties parameter: https://developers.notion.com/docs/working-with-databases#adding-pages-to-a-database. You can also check the full reference of properties here: https://developers.notion.com/reference/page#all-property-values.

Example

do properties = {
  "My Title": {
    "type": "title",
    "title": [{ "type": "text", "text": { "content": "Example title" } }]
  },
  "My Tags": {
    "type": "multi_select",
    "multi_select": [{ "name": "tag1" }, { "name": "tag2" }]
  },
  "My Value": {
    "type": "number",
    "number": 1.49
  }
}

do App("notion", action="addItem", database_id="abc1234", properties=properties)

Querying your Notion database

To query your Notion database, you can pass in several optional parameters. You can find the reference here: https://developers.notion.com/reference/post-database-query. All of filter, sorts, start_cursor and page_size parameters are supported.

Example

```cpp
do filter = {
"or": [
{
"property": "In stock",
"checkbox": {
"equals": true
}
},
{
"property": "Cost of next trip",
"number": {
"greater_than_or_equal_to": 2
}
}
]
}
do sorts = [
{
"property": "Last ordered",
"direction": "ascending"
}
]

do response = App("notion", action="query", database_id="abc1234", filter=filter, sorts=sorts)

Discover similar integrations:
Airtable
Amazon Dynamodb
Firebase
MongoDB
MySQL
PostgreSQL

Join the Community
on Slack Slack

Come and learn all about CSML with other chatbot enthusiasts on the CSML Community Slack! 🤗