• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
jrmann100

jrmann100

push

Send push notifications from your vals!
Public
Like
3
push
Home
Code
7
README.md
getVapidDetails.tsx
H
main.tsx
pushFrontend.js
pushSendNotification.tsx
subscription.tsx
tryPush.tsx
Branches
1
Pull requests
Remixes
5
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
8/22/2025
README.md

πŸ”” push

Send push notifications from val.town to your device!

demo

Setup

  • πŸ”€ Remix this val
  • Open HTTP Endpoint (optionally set a custom subdomain)
  • Create an API key with Users: Read-only permission
  • Paste your API key into the password field
  • Subscribe and allow push notification permissions
  • You should receive a πŸ‘‹ notification!

Usage

Calling push notifications in another val:

Create val
import { sendNotification } from "https://esm.town/v/YOUR_PUSH_REMIX_HERE/pushSendNotification.tsx"; console.log( await sendNotification("Example notification", { data: { url: "https://example.com" }, }), );

Sending a push notification from outside of Val Town using an API call:

Create val
fetch("https://YOUR_ENDPOINT_HERE/push", { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer YOUR_API_TOKEN_HERE", }, body: JSON.stringify([ "Example notification", { data: { url: "https://example.com" } }, ]), });

Sending a push notification from outside of Val Town using cURL:

curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_TOKEN_HERE" \ -d '["Example notification",{"data":{"url":"https://example.com"}}]' \ "https://YOUR_ENDPOINT_HERE/push"

Caveats

  • The service currently only supports sending notifications to one device at a time, but could be extended to work with multiple devices/users.
  • For instant configuration, the service stores (a) crypto keys used to encrypt notifications and (b) the device currently subscribed to notifications in blob storage. It is the user's responsibility to secure these blobs from being exposed by other vals.
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.