@vinnyum/newsletter-sync
v1.0.5
Published
Weekly automated newsletter to PDF converter and Google NotebookLM source synchronizer
Maintainers
Readme
@vinnyum/newsletter-sync
Automated, weekly CLI tool to download newsletters from Zoho Mail (via Composio), convert them into PDF files using Puppeteer, and upload them as sources directly into a Google NotebookLM notebook.
Includes support for failure alerts sent directly to your email if a sync fails.
Installation
Within the vinnyum-tools monorepo root:
npm installTo run it locally or link the bin:
npm linkCLI Usage
npx newsletter-sync [options]Options
| Flag | Description |
| --- | --- |
| -c, --config <file> | Path to a JSON configuration file |
| --apiKey <key> | Composio API Key (overrides env COMPOSIO_API_KEY) |
| --zohoAccountId <id> | Zoho Mail Account ID |
| --zohoFolderId <id> | Zoho Mail Folder ID (e.g. your newsletter folder) |
| --senderFilter <email> | Filter string to identify the newsletter sender |
| --notebookId <id> | Google NotebookLM ID |
| --alertEmail <email> | Destination email address for critical failures |
| --fromEmail <email> | From email address for Zoho Mail alert emails |
| --processed <path> | Path to save the processed IDs tracking list (default: ./processed_emails.json) |
| --log <path> | Path to save the execution logs (default: ./cron.log) |
| --supabaseUrl <url> | Supabase Project URL (overrides env SUPABASE_URL) |
| --supabaseKey <key> | Supabase Key (overrides env SUPABASE_KEY) |
Setup Example (Local Execution)
1. Create a config.json file
{
"composioApiKey": "your-composio-api-key",
"zohoAccountId": "your-zoho-account-id",
"zohoFolderId": "your-zoho-folder-id",
"senderFilter": "[email protected]",
"notebookId": "your-notebook-id-uuid",
"alertEmail": "[email protected]",
"fromEmail": "[email protected]",
"processedPath": "./processed_emails.json",
"logPath": "./cron.log"
}2. Run the command with config
npx newsletter-sync --config ./config.jsonSetup for Cloud Execution (GitHub Actions + Supabase)
To run this tool in the cloud weekly, we use a combination of GitHub Actions and a Supabase database to track processed email IDs.
1. Setup Supabase Table
In your Supabase SQL Editor, run the following DDL query to create the tracking table:
create table processed_emails (
message_id text primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null
);2. Export NotebookLM Cookies
The nlm CLI needs your Google Account session. To get the cookies in JSON format:
- Log in to notebooklm.google.com in Chrome.
- Use a Chrome extension like EditThisCookie or Get cookies.txt as JSON to copy all active cookies as a JSON array.
3. Add Secrets in GitHub Repository
Go to your GitHub repository Settings ➜ Secrets and Variables ➜ Actions, and add the following repository secrets:
COMPOSIO_API_KEY: Your Composio API Key.SUPABASE_URL: Your Supabase Project URL.SUPABASE_KEY: Your Supabase Project Anon/Service Key.NLM_COOKIES_JSON: The JSON array of cookies copied in step 2.SYNC_CONFIG_JSON: A JSON config representing your Zoho and NotebookLM IDs:{ "zohoAccountId": "your-zoho-account-id", "zohoFolderId": "your-zoho-folder-id", "senderFilter": "[email protected]", "notebookId": "your-notebook-id-uuid", "alertEmail": "[email protected]", "fromEmail": "[email protected]" }
Once configured, the GitHub Action workflow will run automatically every Monday at 9:00 AM UTC. You can also trigger it manually from the Actions tab in your repository.
