🔐Creating env variables

Steps to create the environment variables needed for the functioning of the contact form and the backend edge function.

Introduction

The contact page on the website is connected to an edge function that requires three env variables - NOTION_API_KEY, NOTION_DB_ID, NOTION_USER_ID to store the contact enquiries and notify you about the enquiries.

Follow the steps below to create the env variables and then paste them in your deployment settings as described in the deployment documentation.

Creating a Notion Account

  1. Create your account by clicking on Get Notion free.


Creating NOTION_API_KEY env variable

  1. Navigate to https://developers.notion.com/ and login with your notion account.

  2. Click “View my integrations”.

  3. Click “New integration”

  4. Give the integration a name of your choice.

  5. Click submit.

  6. Click “Capabilities”

  7. Click “Read user information without email addresses”

  8. Click “Save changes”

  9. Go back to “Secrets”

  10. Click on “Show” and then “Copy”

  11. This secret is your NOTION_API_KEY value. Paste it in your deployment environment variables.


Creating NOTION_DB_ID env variable

  1. Go to https://notion.so and login with your Notion account.

  2. Create a new page, with a table.

  3. Create a new data source by entering the name and clicking on new database in the next page as shown below.

  4. Change the heading of the 'Name' column to 'Subject'. This is the title column for the new pages.

  5. Delete the Tags column.

The final table should look similar to the below table.

  1. Click on more and then Add Connections → select the integration you created → Confirm. This step is mandatory to allow the integration to fill the data in the table.

  2. Then open the table in a new view.

  3. Copy the URL of the opened table. It should look as follows:

    https://www.notion.so/username/87e015e43e7f4c9ebb6fb9612f644556?v=<VIEWID>

  4. The ID after username/ and before ?v= is the NOTION_DB_ID. Paste it in your deployment environment variables.


Creating NOTION_USER_ID env variable

  1. Paste https://api.notion.com/v1/users in the URL field.

  2. Go to Authorization tab and paste your NOTION_API_KEY in the Token field.

  3. Click on the Headers tab and paste Notion-Version: 2022-06-28.

  4. Click Send.

  5. Copy the ID of the user that matches with your name, not the integration name. Verify that the type is person and not bot.

  1. This copied ID is your NOTION_USER_ID.

Last updated