Sync your Matter highlights to mem.ai

Bram Janssen
3 min readSep 3, 2022

--

Since the start of the pandemic, I've delved into the topics of personal productivity and knowledge management. One of the most important things I’ve learned is to really take care of the information we are consuming and how to handle this almost constant flow of information. Two of the most prominent tools that helped me a lot with this processing information are Matter (https://hq.getmatter.app/) and Mem (https://get.mem.ai/).

Matter is a read-it-later app. It is very easy to send almost any digital content to the app, allowing you to collect everything that resonates with you, such as documents, videos, and online articles,… In the app, you get a feed of all the content you’ve sent to the app in a unified user interface. While reading in the Matter app, you can add your own highlights and notes and save them for later. Some alternatives to Matter are Pocket, and Instapaper, … I’ve chosen to go with Matter as it provides a lot of useful features in their free tier.

Mem calls itself the self-organizing workspace. Using an AI system, you can create your own personal knowledge base. Although Mem is still considered quite a new kid on the block, it is very astonishing what it can already do and how easy it is to use. I use it as my daily driver to organize and reflect on all the information that crosses my path. It is the place where I build my second brain.

The only thing that I was still missing was a way to quickly get my highlights and notes from Matter ingested into my second brain on Mem.

Syncing using NodeJS

To solve the missing link, I’ve created a NodeJS script that allows me to sync my highlights from Matter to Mem with just a single command. The resulting script is available in the following GitHub repo:

https://github.com/JanssenBrm/memmattersync

The script uses the API provided by Matter to retrieve the highlights for all your read articles. In the next step, the script uses the NodeJS library, provided by Mem, to create new mem for each of the articles. Next to some useful metadata, each mem will also contain a listing of the highlights you´ve made in the article.

Prerequisites

In order to execute the script, the following prerequisites need to be in place:

  • As this is a NodeJs 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 by 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 mems in your account. Following these steps to retrieve an API key:

  1. Go https://mem.ai/ and log in with your account.
  2. In the sidebar, select Flows.
  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 need this in the next step.
  5. Create a new file called apikey.txt in the src/mem folder and paste your key into this file.

Execute the script

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

// Install all dependencies of the script (run only once)
npm install
// Execute the script for syncing your highlights
npm run start

The first time you execute the sync, you need to grant access to your Matter feed. In this case, the script will generate an image file located at files/login.svg. This image contain a QR code that you 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. The next time you execute the script, it will automatically log you in without the need to scan the code again.

Now watch the magic happen and feel the excitement of your second brain growing in front of your eyes!

--

--

Bram Janssen

An IT architect with a very big interest in technology. In my spare time I am indulging myself into the world of viti- and viniculture