4 // Note: `body.event` has information about the event like the sender and the message text
5 const text = await f(body);
6 const result = await fetchJSON("https://slack.com/api/chat.postMessage", {
7 headers: { "Authorization": `Bearer ${config.slackToken}` },
8 method: "POST",
1import { paths } from "https://esm.town/v/pomdtr/openapi_schema";
2import createClient2 from "npm:openapi-fetch";
3
4export default function createClient(options?: {
7}) {
8 return createClient2<paths>({
9 baseUrl: options?.baseUrl ?? "https://api.val.town",
10 headers: options?.token ? { Authorization: `Bearer ${options.token}` } : {},
11 });
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
59 return c.redirect(`/?response=${encodeURIComponent(generatedResponse)}`);
60 } catch (error) {
61 console.error('OpenAI API error:', error);
62 return c.redirect('/?response=Error%20occurred.');
63 }
9 const payload = await c.req.json();
10 console.log('evaling using:', Deno.env.get('valtown'))
11 const response = await fetchJSON('https://api.val.town/v1/eval', {
12 method: 'POST',
13 body: JSON.stringify(payload),
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
1# Typed Client for the Val Town API
2
3Automatically generated using [open-api-typescript](https://www.npmjs.com/package/openapi-typescript) and [openapi-fetch](https://www.npmjs.com/package/openapi-fetch).
1simple wrapper for [Alchemy's blockchain APIs](https://docs.alchemy.com/reference/alchemy-gettokenbalances), for fetching blockchain data. Ethereum, Solana, etc
2
3uses my personal ALCHEMY_API_KEY, I forget if you can use it too or not! get your own if it doesn't work
4
5used by some of my other vals:
1fetch token balances from an Ethereum wallet. uses Alchemy. don't abuse my API key or I'll turn this off
2
3Use it like: https://jamiedubs-ethereumtokenbalances.web.val.run/?address=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
25
26async function telegramRequest(path, body, authorization?: string) {
27 const response = await fetch("https://stevekrouse-telegramValTownAPI.web.val.run/" + path, {
28 method: "POST",
29 body: JSON.stringify(body),