Closed iAmWillShepherd closed 2 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
š Inspect: https://vercel.com/onesignaldevs/ngosi/2AY3edVK9SUQMEsrQzDnTMamY8q6
ā
Preview: https://ngosi-git-let-em-know-you-changed-onesignaldevs.vercel.app
After fighting with supabase's realtime, I've decided to abandon it and go in a different direction. I'm going to query the database for the preso record and perform a diff to check if the column I care about has changed. Iff the value is different will you send an email.
Fixes #56
Solution
~I'm utilizing Supabase's Realtime feature to subscribe to events on the
Survey
table events.~I added the plumbing needed to send notification emails to a presenter's audience using OneSignal.
setEmailDevice
- creates the device record in OneSignal required to send emails to a user.updateTags
- submit data tags to OneSignal to be injected into an email.sendEmail
- sends an email to the given email.These āš¾ functions require the
ONESIGNAL_API_KEY
to be set in.env.local
.The preso endpoint,
api/preso
, was updated to handlePUT
requests to enable presenters to update their audience with the video to their published talk. Submitting a request to this endpoint will result in an email being sent to each attendee.Testing
These steps assume you already have a preso created and an app configured for email on OneSignal.
localhost:3000/preso/<id>
tolocalhost:3000/survey/<id>
Resources
References