sendNotification
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
This val can be used in other vals to send notifications to a segment using OneSignal's REST API
This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to Netlify for free. OneSignal has easy to follow docs so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then install the PWA on your platform of choice and you're off to the races!
-
Save your
ONESIGNAL_TOKEN
andSEGMENT_APPID
from OneSignal to your Val Town environment variables -
Import into another val!
import sendNotification from "https://esm.town/v/gwoods22/sendNotification";