Skip to content

Instantly share code, notes, and snippets.

@nickytonline
Created November 13, 2022 01:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickytonline/102bb45e625db6b9ae0157e293cfb0a3 to your computer and use it in GitHub Desktop.
Save nickytonline/102bb45e625db6b9ae0157e293cfb0a3 to your computer and use it in GitHub Desktop.
import "https://deno.land/x/dotenv/load.ts";
const response = await fetch("https://www.getrevue.co/api/v2/issues", {
headers: {
Authorization: `Token ${Deno.env.get("REVUE_API_KEY")}`,
},
});
const issues = await response.json();
await Deno.writeFile(
"./revue-newsletter-issues.json",
new Uint8Array(new TextEncoder().encode(JSON.stringify(issues, null, 2)))
);
@nickytonline
Copy link
Author

  1. Make sure you have a .env file with a REVUE_API_KEY key and value. To get one go to https://www.getrevue.co/app/integrations and request one. It should be at the bottom of the page.
  2. If you haven't already, install Deno https://deno.land/manual@v1.27.2/getting_started/installation
  3. Run deno run --allow-net --allow-env --allow-read --allow-write ./get-revue-newsletters.ts
  4. You should now have all your newsletters in JSON format in the file revue-newsletter-issues.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment