9
10 const content = {
11 headline: "👋 Welcome to the root API endpoint of this Hono app, running on val.town",
12 message: "Find more detail in the README.",
13 url: notionURL,
4// Initialize Notion client
5const notion = new Client({
6 auth: Deno.env.get("NOTION_API_KEY"),
7});
8
37 // the block exists, so you can do the reset
38
39 // reset via the API
40 // this way we keep the notion data and the blob data (our cache) in sync
41 // the API resets the blocks on notion pages, and also knows what to do with the blob
42 // (note the x-blob-key header)
43 if (content != "default" && diffInMinutes > .5) {
48 "x-asking-for": "default",
49 "x-blob-key": item.key,
50 "x-api-key": Deno.env.get("X_API_KEY"),
51 },
52 body: JSON.stringify({
12## Handling Notion Webhooks
13
14This is done in the webhookAPI file.
15
16## Resetting state
1# Routes Directory
2
3This directory contains all the route handlers for the webhookAPI application. Each file exports a Hono app that handles a specific route or group of related routes.
4
5## Structure
7// Initialize Notion client
8const notion = new Client({
9 auth: Deno.env.get("NOTION_API_KEY"),
10});
11
4// Initialize Notion client
5const notion = new Client({
6 auth: Deno.env.get("NOTION_API_KEY"),
7});
8
70 return faviconUrl;
71 } catch (error) {
72 console.error("Error scraping favicon:", error);
73 return null;
74 }
7// Initialize Notion client
8const notion = new Client({
9 auth: Deno.env.get("NOTION_API_KEY"),
10});
11
9// Initialize Notion client
10const notion = new Client({
11 auth: Deno.env.get("NOTION_API_KEY"),
12});
13
61 // unless there's already a blob key that matches
62 // to see if there's a match, loop through blobs rather than traversing the notion page
63 // though not ideal, it's faster than doing the API calls necessary to traverse the Notion page
64 const checkForBlob = async () => {
65 const items = await blob.list(slug.split(".")[0]);
7// Initialize Notion client
8const notion = new Client({
9 auth: Deno.env.get("NOTION_API_KEY"),
10});
11