Skip to content

Quick Start with Template

Duplicate the pre-configured Notion template to get a database with the correct property structure and sample data.

Duplicate Notion Template

TIP

After duplicating, edit the data and run huh pull.


Notion Database Setup

Creating a New Database

  1. Create a new page in Notion.
  2. Type /database and select Database - Full page.
  3. Name the database (e.g., Error Content).

Property Structure

Set up the following properties in the database:

Property NameProperty TypeRequiredDescription
trackIdTitleYesUnique error identifier (e.g., ERR_LOGIN_001)
typeSelectYesTOAST, MODAL, PAGE, or custom type
messageRich textYesError message. Supports template variables
titleRich textOptionalError title (used for modal, page)
imageURLOptionalError image URL
severitySelectOptionalINFO, WARNING, ERROR, CRITICAL, or custom severity
actionLabelRich textOptionalAction button text
actionTypeSelectOptionalREDIRECT, RETRY, BACK, DISMISS, or custom action
actionTargetURLOptionalURL to navigate to for REDIRECT

TIP

In Notion, trackId is the default Title property. Rename the default "Name" property to trackId.

TIP

Setting type, severity, and actionType as Select types lets you predefine options to prevent input mistakes. Custom types can also be added as options. Even if entered in lowercase, the CLI will automatically convert them to uppercase.

Example Data

trackIdtypemessagetitleseverityactionLabelactionTypeactionTarget
ERR_LOGIN_001TOASTLogin failed. Please try again.WARNINGRetryRETRY
ERR_PAYMENT_001MODALAn error occurred during payment processing.Payment ErrorERRORContact SupportREDIRECT/support
ERR_NOT_FOUNDPAGEThe page you requested could not be found.Page Not FoundINFOGo HomeREDIRECT/
ERR_NETWORKTOASTPlease check your network connection.WARNINGTry AgainRETRY

Creating an Integration and Getting a Token

  1. Go to Notion Integrations.
  2. Click New integration.
  3. Enter an integration name (e.g., huh-cli).
  4. Select the relevant workspace.
  5. Under Capabilities, ensure Read content is checked.
  6. Click Submit.
  7. Copy the Internal Integration Secret (starts with ntn_ or secret_).

Connecting the Integration to the Database

After creating the integration, you need to connect it to the database:

  1. Open the database page in Notion.
  2. Click the ... menu in the top right.
  3. Under Connections > Connect to, select the integration you created.
  4. Click Confirm.

WARNING

If the integration is not connected, API calls will return a 404 error.

Finding the Database ID

  1. Open the database page in Notion.
  2. Find it in the browser URL:
    https://www.notion.so/workspace/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX?v=...
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     Database ID (32-character hex, no hyphens)
  3. Or extract it from the URL copied via Share > Copy link.

TIP

The Database ID can include hyphens or not. The API handles both formats automatically.

Configuration

bash

.huh.config.json Example

json
{
  "source": {
    "type": "notion",
    "databaseId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "output": "./src/huh.json"
}

To specify the token directly in the config:

json
{
  "source": {
    "type": "notion",
    "databaseId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "token": "ntn_XXXXXXXXXXXXXXXXXXXX"
  },
  "output": "./src/huh.json"
}

WARNING

If you include the token directly in the config file, add .huh.config.json to your .gitignore.

Fetching Data

bash

If successful, a JSON file will be generated at the output path.

Released under the MIT License.