91
92export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
93 // Get API keys from environment
94 const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
95 const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
96
100 }
101
102 if (!apiKey) {
103 console.error("Anthropic API key is not configured.");
104 return;
105 }
116
117 // Initialize Anthropic client
118 const anthropic = new Anthropic({ apiKey });
119
120 // Initialize Telegram bot
156
157 // disabled title for now, it seemes unnecessary...
158 // await bot.api.sendMessage(chatId, `*${title}*`, { parse_mode: "Markdown" });
159
160 // Then send the main content
163
164 if (content.length <= MAX_LENGTH) {
165 await bot.api.sendMessage(chatId, content, { parse_mode: "Markdown" });
166 // Store the briefing in chat history
167 await storeChatMessage(
192 // Send each chunk as a separate message and store in chat history
193 for (const chunk of chunks) {
194 await bot.api.sendMessage(chatId, chunk, { parse_mode: "Markdown" });
195 // Store each chunk in chat history
196 await storeChatMessage(