7// Initialize Notion client
8const notion = new Client({
9auth: Deno.env.get("NOTION_API_KEY"),
10});
11
7// Initialize Notion client
8const notion = new Client({
9auth: Deno.env.get("NOTION_API_KEY"),
10});
11
ValTownForNotion1auth.ts2 matches
1export default async (c, next) => {
2const secret = c.req.header("x-api-key");
3if (secret !== Deno.env.get("X_API_KEY")) {
4return c.text("Unauthorized", 401);
5}
ValTownForNotionroot.ts1 match
910const content = {
11headline: "👋 Welcome to the root API endpoint of this Hono app, running on val.town",
12message: "Find more detail in the README.",
13url: notionURL,
ValTownForNotionwebhookAPI0 matches
1import { Hono } from "npm:hono@3";
2// import { cors } from "npm:hono@3/cors";
34// Import route modules
5import auth from "./routes/auth.ts";
ValTownForNotionREADME.md1 match
1# Routes Directory
23This 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.
45## Structure
7// Initialize Notion client
8const notion = new Client({
9auth: Deno.env.get("NOTION_API_KEY"),
10});
11
7// Initialize Notion client
8const notion = new Client({
9auth: Deno.env.get("NOTION_API_KEY"),
10});
11
stevensDemosendDailyBrief.ts8 matches
9798export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
99// Get API keys from environment
100const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
101const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
102106}
107108if (!apiKey) {
109console.error("Anthropic API key is not configured.");
110return;
111}
122123// Initialize Anthropic client
124const anthropic = new Anthropic({ apiKey });
125126// Initialize Telegram bot
162163// disabled title for now, it seemes unnecessary...
164// await bot.api.sendMessage(chatId, `*${title}*`, { parse_mode: "Markdown" });
165166// Then send the main content
169170if (content.length <= MAX_LENGTH) {
171await bot.api.sendMessage(chatId, content, { parse_mode: "Markdown" });
172// Store the briefing in chat history
173await storeChatMessage(
198// Send each chunk as a separate message and store in chat history
199for (const chunk of chunks) {
200await bot.api.sendMessage(chatId, chunk, { parse_mode: "Markdown" });
201// Store each chunk in chat history
202await storeChatMessage(
stevensDemoREADME.md1 match
53You'll need to set up some environment variables to make it run.
5455- `ANTHROPIC_API_KEY` for LLM calls
56- You'll need to follow [these instructions](https://docs.val.town/integrations/telegram/) to make a telegram bot, and set `TELEGRAM_TOKEN`. You'll also need to get a `TELEGRAM_CHAT_ID` in order to have the bot remember chat contents.
57- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALENDAR_CALENDAR_ID`. See [these instuctions](https://www.val.town/v/stevekrouse/pipedream) for details.