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).
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).
25 // you need to declare these two environment variables:
26
27 // api key to access Counterscale Analytics Engine (see Counterscale README)
28 const apiKey = process.env.counterscaleCfApiKey;
29 // cf account id
30 const accountId = process.env.counterscaleCfAccountId;
31
32 const url = `https://api.cloudflare.com/client/v4/accounts/${accountId}/analytics_engine/sql`;
33
34 // query counts grouped by site over last 7 days
45 let result = await fetch(url, {
46 headers: {
47 "Authorization": `Bearer ${apiKey}`,
48 "Content-Type": "application/json",
49 },
1import Anthropic from "npm:@anthropic-ai/sdk";
2const anthropic = new Anthropic({
3 // apiKey: 'my_api_key', // defaults to process.env["ANTHROPIC_API_KEY"]
4});
5
10 trace as otelTrace,
11 Tracer,
12} from "npm:@opentelemetry/api";
13import { ReadableSpan } from "npm:@opentelemetry/sdk-trace-base";
14import {
11
12
13If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
14
15
7// Make an authenticated request to another user's val
8// Example usage: https://www.val.town/v/stevekrouse.authRequestEx
9export const runValAPIAuth = async ({ val, args, handle, privateKey, keys }: {
10 val: string;
11 args: any;
13Change the `query` variable for what you want to get notified for.
14
15You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
16
17## 3. Notification