Coder Social home page Coder Social logo

notion-fetch's Introduction

日本語のREADME

notion-fetch

What is this?

This is a sample code to fetch (query) the database and get the page information contained in it by quering the API of Notion. It also includes sample code to write the retrieved page information to Pixe.la and Slack.

It is intended to be used to record the frequency of page creation in Notion in Pixe.la. It is designed to be run in the AWS Lambda environment, but it can also be run on your own machine (Mac).

Usage

Preparation

To use the Notion API, prepare the Notion access token, the target database ID, and the user ID if you want to filter pages by user ID, and set them in lines 6, 7, and 8 of the source code.

If you want to export to Pixe.la, prepare the URL of the target graph and access token of Pixe.la, and set them in lines 10 and 11 of the source code.

If you want to export to Slack, prepare the Slack webhook URL and target channel, and set them in lines 13 and 14.

Actual usage

If you want to use it with AWS Lambda, comment out or uncomment the lambda_handler function from line 85. In the version on git, Notion is accessed and the result is printed, so comment it out and enable line 90 or 91 instead.

If you want to use it on the command line, edit the lines from line 98 as you see fit.

Code description

In Notion Database query, you can set filter and sort conditions. In this code, we filter by user ID and update date (updated today), and sort in reverse order (from lines 29 to 54).

The results obtained are set to the return value of notion_fetch(), but pixela_pixelpost_today() and send_message() only use the number of items respectively. The return value of notion_fetch() is a dict type that contains various kinds of property information (e.g., page title), so it can be extracted and used.

notion-fetch's People

Contributors

kikuzo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.