Likes
63
stevekrouse
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
2
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.
1