Skip to content

JanssenBrm/memmattersync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

memmattersync

A Node script that allows you to easily sync Matter highlights to mem.ai. Based on your reading list on Matter, the script will fetch the highlights of the fully read articles. In a next step, it will create a mem for each article containing some metadata information and all of your highlights.

Remark: Only fully read articles are synced to mem. This is because of the current version of the mem library does not yet support updating existing mems. In order to prevent duplicate entries in mem, only the articles that have a 100% reading completion will be synced.

Prerequisites

  • As this is Node script, it is important to have your NodeJS environment set up.
  • You will also need an account on both Matter and mem.ai
  • In order to sync your articles from Matter you will need the Matter mobile app. This will allow you to grant access based on scanning a QR code.

Creating an API key for mem.ai

The last thing you'll need is an API key from mem. This is required for the script to be able to create mem in your account. Execute the following steps to retrieve an API key:

  1. Go https://mem.ai/ and login with your account
  2. In the sidebar, select Flows to open an overview of all the supported flows within mem.
  3. Search for the API tile and click the Configure button
  4. Click the Create API key button and create a new key. Make sure to copy the key as you'll need this in the next step
  5. Create a new file called apikey.txt in the src/mem folder and paste your key in this file

How to get started?

After confirming all the prerequisites are in place, you can start the sync process by running the following command:

npm run start

If this is the first time you are executing the sync, you'll need to grant access to your Matter feed. In this case the script will generate a file files/login.svg. This image contain a QR code that you'll need to scan with your Matter mobile app. This can be done by going to your profile and selecting Sign into Web option. Once you've scanned the QR code, the script will save your login and continue the sync. Next time you execute the script, it will automatically log you in through the token of previous run.

Important files

When the script is executed, it will create a files directory that will act as the working directory. In this folder, you will find the following files:

  • matter/tokens.json - This file contains the access and refresh tokens for the Matter API integration. Removing this file will retrigger the login procedure through a QR code. Remove this file if you want to sync a different account or if all tokens have expired.
  • mem/synced_articles.json - This is a list of all article ID that were already synced with mem. This prevents the script from creating duplicate mems. Removing this file will force a resync of all articles into new mems

About

Sync your Matter highlights to Mem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published