9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO
13- Create a new Markdown file in a specified GitHub repository.
14
15 We'll use the email handler from Val Town, html-to-markdown for conversion, and the GitHub API via Octokit to create the file.
16 */
17
50 content: btoa(binString),
51 headers: {
52 "X-GitHub-Api-Version": "2022-11-28",
53 },
54 });
6- This script assumes you're using some kind of static site generator that can read from a GitHub repository. There are many to choose from in this space. I'm partial to [11ty](http://11ty.dev)
7- Gmail is doing some heavy-lifting for me here in terms of kindly converting my HTML email to Markdown behind the scenes. It's not a guarantee all email providers do this. If yours does not, you may have to investigate an HTML-to-Markdown conversion step.
8- We'll use the GitHub API via Octokit to create the file. You'll need to [create a token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#) and store it an an environmental variable in your Val Town settings.
9
10
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let arenaApiExample = (async () => {
4 const resp = await fetch(
5 "http://api.are.na/v2/channels/project-logs",
6 );
7 const json = await resp.json();
1# Are.na API
2
3Example of using the [are.na](https://dev.are.na/documentation/channels#Block43472) API to get the contents of an Are.na board - specifically my fun board that showcases websites with that "glossy black style."
4
5All you need is [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to make this happen!
131
132const boardToEndpoint = (board: string) => {
133 return board.replace(/\.json$/, ".api/run");
134};
135
1import { PuppeteerDeno } from "https://deno.land/x/puppeteer@16.2.0/src/deno/Puppeteer.ts";
2// 1st stable version is v13
3const BROWSERBASE_API_KEY = Deno.env.get("BROWSERBASE_API_KEY");
4const TIMEOUT = 30000; // 30 seconds timeout
5
16 let browser;
17 try {
18 if (!BROWSERBASE_API_KEY) {
19 throw new Error("BROWSERBASE_API_KEY is not set");
20 }
21
22 const puppeteer = new PuppeteerDeno({ productName: "chrome" });
23 const wsEndpoint = `wss://connect.browserbase.com?apiKey=${BROWSERBASE_API_KEY}&enableProxy=true`;
24
25 console.log("Attempting to connect to Browserbase...");
80 let errorMessage = error.message;
81 if (error.message.includes("400 Bad Request")) {
82 errorMessage = "Failed to connect to Browserbase. Please check your API key and account status.";
83 }
84 return new Response(JSON.stringify({ error: errorMessage }), {
86 if (!inputs.$key || inputs.$key != Deno.env.get("BB_SERVICE_KEY")) {
87 return {
88 $error: "Must provide an API key to access the service.",
89 };
90 }