Send a Slack notification every time your keywords are mentioned on Twitter, Hacker News, or Reddit.
SLACK_WEBHOOK_URL
, BROWSERBASE_API_KEY
, and TWITTER_BEARER_TOKEN
, input all of these as Val Town Environment Variables.
redditSearch
script, we start by importing Puppeteer and creating a Browserbase session with proxies enabled (enableProxy=true
). Be sure to get your BROWSERBASE_API_KEY
from your Browserbase settings.
title
, date_published
, and url
.
convertRelativeDatetoString
, to convert dates to a uniform date format. We import this at the top of our redditSearch script.
hackerNewsSearch
, and use the Twitter API to create twitterSearch
.
See all three scripts here:
Reddit → redditSearch
Hacker News → hackerNewsSearch
Twitter → twitterSearch
slackScout
cron job that calls redditSearch
, hackerNewsSearch
, and twitterSearch
that runs every hour. To create the cron file, go to Val Town → New → Cron Val.
In our new slackScout file, let’s import our HTTP scripts.
createTable
: creates the new SQLite table
isURLInTable
: for each new website returned, checks if the website is already in our table
addWebsiteToTable
: if isURLInTable
is False
, we add the new website to our table
slackScout
here.