18- *scraper* Goes to bytes.dev and scrapes latest published newsletter
19- *inserter* Insert it to SQLite if this newsletter already not exists
20- *notifier* Uses Pushover API to send ios mobile notifications
21
22### Pushover notifications
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
1// Login into the Notehub API with a programmatic access client ID and client secret
2// Returns the api token to be used for subsequent requests
3const authenticate = async (): Promise<string> => {
4 const body = new URLSearchParams();
23 const token = await authenticate();
24 const res = await fetch(
25 `https://api.notefile.net/v1/projects/${projectUID}/devices/${deviceUID}/notes/${fileName}`,
26 {
27 method: "POST",
34 );
35 if (res.ok) return true;
36 throw new Error("Failed to push note to Notehub API");
37 } catch (e) {
38 console.log(e);
1Migrated from folder: webmention/microformat/key_value_api
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
1# Notehub
2
3A set of helper functions for interacting with the Notehub API
4
5Requires `NOTEHUB_CLIENT_ID` and `NOTEHUB_CLIENT_SECRET` [environment variables](https://www.val.town/settings/environment-variables) to be configured.
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,
113. 🤣🤣🤣🤣
12
13## API
14
15This val uses the [icanhazdadjoke API](https://icanhazdadjoke.com/api). You can find [more docs here](https://github.com/15Dkatz/official_joke_api), such as how to [filter by type](https://github.com/15Dkatz/official_joke_api?tab=readme-ov-file#grab-jokes-by-type).
17}) =>
18 fetchJSON(
19 `https://api.telegram.org/bot${botToken}/sendMessage`,
20 {
21 method: "POST",
25
26export async function telegramSendAudioMessage(chatId: string, audioData: Uint8Array, botToken: string): Promise<void> {
27 const url = `https://api.telegram.org/bot${botToken}/sendAudio`;
28
29 // Assuming FormData is available or correctly polyfilled
34
35 try {
36 // Replace axios with Deno's fetch API, adapted for your setup
37 const response = await fetch(url, {
38 method: "POST",