Join Discord

Enter your email to get updates
What is Membrane?
Membrane is a hosted TypeScript runtime specifically designed to build personal automation tools and interact with APIs more easily.
FEATURES
EXAMPLES
example-google-sheets-hn-jobs
Tracks Hacker News Jobs, based on keywords, and saves them to a Google Sheet.
Set up a cron-job that invokes watchJobs every hour
Use the Hacker News Driver to fetch the top jobs.
You can easily append new data using the Google Sheets Driver.
import { nodes, root, state } from "membrane";

export async function configure({ keywords }) {
  state.keywords = keywords;

  root.watchJobs.$cron(`0 0 * * * *`)
}

export async function watchJobs() {
  const topStories = await nodes.stories.items.$query(`{ title url time }`);

  const keywordArray = state.keywords
    .split(",")
    .map((keyword) => keyword.toLowerCase());

  const matchedStories = topStories.filter((story) => {
    if (!story.url) return false;
    const title = story.title?.toLowerCase();
    return keywordArray.some((keyword) => title?.includes(keyword));
  });

  const data = matchedStories.map((story) => {
    const date = new Date(story.time! * 1000).toLocaleDateString("en-US");
    return [story.title, date, story.url];
  });

  await nodes.sheet.append({ values: data });
}
Install From VS Code
Dev Blog