Trending Vals
2
mewtru
valentine
HTTP
Hello!!! Feel free to mess around with this val and make it your own :). Just click on "Fork" in the top right. You can change the phrases that show up as you click no, you can change the firstImg and secondImg, maybe even add more images. And you can also change the colors and any of the text on the screen! Have fun with it and hopefully your crush says yes hehe.
9
4

stevekrouse
aqi
Cron
AQI Alerts Get email alerts when AQI is unhealthy near you. Set up Click Fork Change location (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast
AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
7
5
7
nbbaier
sqliteExplorerApp
HTTP
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v86) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [x] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
23
8
valdottown
templateRedditAlert
Cron
Reddit Keyword Alerts [TEMPLATE] Get notifications when specific keywords appear in Reddit posts. This template will help you: Search Reddit for specific keywords within a defined time range. Send notifications to your preferred platform (Discord, Slack, email, etc.) Reddit does not have an API that allows users to scrape data, so we are doing this with the Google Search API, Serp . Example This val tracks mentions of "Val Town" and related terms on Reddit, filtering results from the last 7 days and sending alerts to a Discord webhook.
Set Up 1. Fork this Val To start using this template, fork this val by clicking the fork button at the top-right corner of the page.
2. View Source Code The CODE box shows you the the full source code of this val, you may need to scroll down to see it.
3. Get a SerpApi Key This template requires a SerpApi key to search Reddit posts via Google search results. Get a SerpApi key : Sign up at SerpApi to create an account. Generate an API key from your account dashboard. Add the SerpApi key to your environment variables : Go to your Val Town environment variables . Add a new key: Key: SERP_API_KEY Value: Your SERP API key. Without this key, the val will not function correctly. 4. Customize Keyword In the CODE box below, update the terms or phrases you want to track:
const KEYWORDS = "\"node\" OR \"node.js\""; 5. Set Up Your Notification Method This template uses a Discord webhook for notifications. You can update this to your preferred platform: Create a Discord webhook following this guide .
Save your webhook URL in your Val Town environment variables: Key: mentionsDiscord Value: Your Discord webhook URL.
Notifications will be sent using this function: await discordWebhook({
url: Deno.env.get("mentionsDiscord"),
content,
}); To switch to another platform (e.g., Slack, email, or custom webhooks), replace the discordWebhook call with the appropriate integration ((e.g., @std/email , Slack , or anywhere else ) ๐ Congrats! You now have a val running that ensures you never miss another Reddit mention. ๐ NOTE: Usage Limits SerpApi: Free SerpApi accounts have monthly call limits.
2
10
12
ejfox
githubactivitysummarizer
HTTP
GitHub Activity Summarizer This val.town script fetches a user's recent GitHub activity and generates a summarized narrative overview using OpenAI's GPT model. Features Retrieves GitHub activity for a specified user from the past week Summarizes activity using OpenAI's GPT-3.5-turbo model Returns a concise, narrative summary of the user's GitHub contributions Usage Access the script via HTTP GET request: https://https://ejfox-githubactivitysummarizer.web.val.run/?username=<github_username> Replace <github_username> with the desired GitHub username like https://https://ejfox-githubactivitysummarizer.web.val.run/?username=ejfox
in the past week Note Ensure you have necessary permissions and comply with GitHub's and OpenAI's terms of service when using this script.
1
14
fiberplane
fiberplaneHonoStarter
HTTP
Example Hono app with a Fiberplane API explorer. For an example with OpenApiHono , see: https://www.val.town/x/fiberplane/fiberplaneHonoZodStarter Import @fiberplane/hono import {
createFiberplane,
createOpenAPISpec
} from "https://esm.sh/@fiberplane/hono@0.4.4"; Generate a simplified API spec (if you don't already have one) app.get("/openapi.json", async (c) => {
const spec = createOpenAPISpec(app, {
info: { title: "My Hono API", version: "1.0.0" },
});
return c.json(spec);
}); Mount the api explorer This will mount it at the root /* , but you can mount it to another route, like /fp/* if you
are using / for your main app. We recommend / if your Hono app is an API without a frontend. app.use(
"/*",
createFiberplane({
openapi: { url: "/openapi.json" },
}),
); Visit your Val's root route to play with the API explorer! How it Works createFiberplane mounts Fiberplane on your app at the specified path, which can be used to explore the api's routes and make requests.
Think of it like an embedded, lightweigh postman. If you don't have an API spec at the ready, then the createOpenAPISpec utility helps create a simple OpenAPI spec from all routes in the application.
( Note that this simple spec does not include information on expected query parameters, headers, or payloads! )
5
15
steel
steel_puppeteer_starter
Script
Steel + Puppeteer Starter This template shows you how to use Steel with Puppeteer
to run browser automations in the cloud on Val Town.
It includes session management, error handling,
and a basic example you can customize. This starter
templated was ported from
this one on Github . Quick start The script shows you how to: Create and manage a Steel browser session Connect Puppeteer to the session Navigate to a website (Hacker News in this example) Extract data from the page (top 5 stories) Handle errors and cleanup properly View your live session in Steel's session viewer To run it: Get your free Steel API key at https://app.steel.dev/settings/api-keys Add it to your Val Town Environment Variables as STEEL_API_KEY Click Fork on this val Click Run on this val Writing your automation Find this section in the script: // ============================================================
// Your Automations Go Here!
// ============================================================
// Example automation (you can delete this)
await page.goto('https://news.ycombinator.com');
// ... rest of example code You can replace the code here with whatever automation scripts you want to run. Configuration The template includes common Steel configurations you can enable: const session = await client.sessions.create({
useProxy: true, // Use Steel's proxy network
solveCaptcha: true, // Enable CAPTCHA solving
sessionTimeout: 1800000, // 30 minute timeout (default: 15 mins)
userAgent: 'custom-ua', // Custom User-Agent
}); Error handling The template includes error handling and cleanup: try {
// Your automation code
} finally {
// Cleanup runs even if there's an error
if (browser) await browser.close();
if (session) await client.sessions.release(session.id);
} Support Steel Documentation API Reference Discord Community
1
16

stevekrouse
discordWebhook
Script
Send a Discord message Send a message to a Discord channel from Val Town. It's useful for notifying your team or community when someone interesting happens, like a user signup, Stripe payment, mention on social media, etc. import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
await discordWebhook({
url: Deno.env.get("engDiscord"),
content: "Hi from val town!",
});
Example val: https://www.val.town/v/stevekrouse.discordWebhookEx Setup 1. Create a Discord Webhook Follow the instructions here: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks It really only takes 2 minutes. 2. Copy webhook URL Paste it into your secrets as discordWebhook . 3. Send a message! import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
await discordWebhook({
url: Deno.env.get("engDiscord"),
content: "Hi from val town!",
}); Example val: https://www.val.town/v/stevekrouse.discordWebhookEx
1
17
nbbaier
sqliteDump
Script
SQLite Dump Util A utility function that generates SQL statements to dump the data and schema of tables in a SQLite database. Usage This example specifically dumps the users table and logs the output: import { sqliteDump } from "https://esm.town/v/nbbaier/sqliteDump";
const dump = await sqliteDump(["users"]);
console.log(dump) You can optionally specify a callback to handle the result. The example below dumps the users table and emails it using std/email . import { email } from "https://esm.town/v/std/email";
import { sqliteDump } from "https://esm.town/v/nbbaier/sqliteDump";
await sqliteDump(["users"], async (res) => {
await email({ text: res });
}); Function Signature function sqliteDump(tables?: string[], callback?: ((result: string) => string | void | Promise<void>) | undefined): Promise<string | void> Parameters tables : (Optional) Array of table names to include in the dump. If not provided, all tables will be included. callback : (Optional) An (potentially async) callback function to process the dump result. The callback receives the dump string as its argument.
3
18
19

stevekrouse
company
Email
Val Town Company *@val.town Email Routing This val forwards emails to addresses that don't exist to all of us at Val Town. For example, this forwards feedback@val.town to all of us. We achieve this by forwarding emails to this email handler, and this email handler forwards them along. To accomplish this without Val Town would require setting up a Google Group. I prefer doing it in code. Over time we will have more complex routing here.
2
20

stevekrouse
newStripeSubscriber
HTTP
New Stripe Subscription Handler This val processes new Stripe subscribers to Val Town Pro. It sends our team
a Discord notifcation. It takes a couple of
steps if you'd like to set up something similar for your own Stripe account. Setup Fork this HTTP val Create a new webhook in Stripe Add your val's HTTP endpoint URL into the Stripe webhook Select customer.subscription.updated as the only event to listen to (more on this below) Add your stripe_sk_customer_readonly to your Val Town Env Variables Add your webhook's signing secret as STRIPE_WEBHOOK_SECRET to you Val Town Env Variables How the code is structured Verifies the signature to make sure it's really from Stripe Filters out only newly created subscriptions Sends off the Discord message & email Which Stripe event type to listen to Stripe sends webhooks for many different kinds of events. Relevant for us here are: customer.subscription.created (what we used to listen for) customer.subscription.updated (what we're currently listening for) The issue with customer.subscription.created is that it triggers too early,
before the user's payment actually goes through. This is a problem
because in early Nov 2024 we started getting credit card fraudsters
testing cards using our service. We started getting lots of notifications
for new subscriptions that never actually became active. Note: if anyone knows good ways to prevent that sort of behavior at
the root, please let me know by commenting on this val! In order to only get notified on a valid subscription, we now subscribe
to customer.subscription.updated . This event happens on any subscription change,
including renewals and cancellations, so now we have to filter those events
to only get new subscriptions, ie where: event.data.previous_attributes.status === 'incomplete' && event.data.object.status === 'active'
2
21
22
pinjasaur
unsplashSourceReimplementation
HTTP
Re-implements Unsplash Source which was a service hosted at source.unsplash.com that served random photos from Unsplash. To use this, you'll want to fork it, provide your own Unsplash API key, and configure the allowed domains. Read more: https://paul.af/reimplementing-unsplash-source
0
24
valdottown
templateTwitterAlert
Cron
Twitter/๐ Keyword Alerts [TEMPLATE] Get custom notifications when you, your company, or anything you care about is mentioned on Twitter/X, even if they don't tag you directly. This template will help you: Search for specific mentions on Twitter/X using customizable keywords. Deliver notifications wherever you'd like (email, Discord, Slack, Telegram, etc). Example This val tracks mentions of "Val Town" and related terms, excluding noise like retweets and irrelevant accounts. Notifications are sent to a Discord webhook but can be easily reconfigured for other platforms.
To see exactly how we use this template at Val Town: https://www.val.town/v/stevekrouse/twitterAlert Set Up 1. Fork this Val To use this template, fork this val on the top right corner of this page.
2. View Source Code The CODE box shows you the the full source code of this val, you may need to scroll down to see it.
3. Customize Query Define what you want to search for by modifying query : const query = "\"val.town\" OR \"val.run\" OR \"val town\" -_ValTown_ -is:retweet -from:valenzuelacity -from:val__run"; Refer to Twitter's search operators to fine-tune your query. 4. Test API call Set isProd = false in the code if you are testing, to ensure there are enough tweets to display.
Toggle it back to true when you're ready to run this cron job in production and actuall send notifications. 5. Choose Notification Method This template uses a Discord webhook for notifications, but
you can update this to your preferred platform by replacing the discordWebhook call
with a call to Slack , @std/email , etc. Create a Discord webhook following this guide . Save your Discord Webhook URL in your Val Town environment variables : Key: mentionsDiscord Value: Your Discord webhook URL.
Notifications will be sent using this function: await discordWebhook({
url: Deno.env.get("mentionsDiscord"),
content,
}); ๐ Congrats! You now have a val running that ensures you never miss another Twitter/X mention. ๐ NOTE: Usage Limits This val uses the SocialData API for Twitter data: Proxies via Val Town's SocialDataProxy : Limited to 10 cents per day for Val Town Pro users . This API is only for Pro users. Need more calls? Sign up for your own SocialData API token and configure the socialDataSearch function.
0
25
26
27
rowdypow
neighborsolutions
HTTP
Neighbor Solutions At Neighbor Solutions , we are empowering communities to transform the lives of those in need. Contact Neighbor Solutions Visit our website Email us! Find us on LinkedIn While this is on rowdypow's ValTown, this code is owned and operated by Neighbor Solutions.
2
28
g
serveUtils
Script
Serve Utils This val exports various utility functions, mainly the serve(commentFunction, contentType?) .
It enables easy serving of different files, while allowing the use of all string characters: // this is possible
const arr = ["Hello", 'world', `!`]; Townie Prompt This can be used as a replacement system prompt for Townie.
Townie will: Write client-side applications with vanilla JavaScript Serve them as different assets, ie. index.html , style.css and main.js Use modern module syntax, including importing modules directly from esm.sh on the client side Not reuse the same script for the server and client logic IMPORTANT: Due tue val.town README restrictions,
the custom prompt can now be found
here .
0