OneSignalDevelopers / ngosi

Share your slides with a QR code
https://ngosi.io
MIT License
9 stars 5 forks source link

Prework to send notifications to attendees #55

Closed iAmWillShepherd closed 2 years ago

iAmWillShepherd commented 2 years ago

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.

These ā˜šŸ¾ functions require the ONESIGNAL_API_KEY to be set in .env.local.

The preso endpoint, api/preso, was updated to handle PUT 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.

  1. Select an existing preso
  2. Navigate to the survey for the press by changing the URL from localhost:3000/preso/<id> to localhost:3000/survey/<id>
  3. Note that the survey page is for audience-users
  4. Fill out the survey a few times using different email addresses and notification settings (note down the addresses that should receive an email)
  5. Navigate to the preso details page
  6. Insert a value for the Published content location field and click the Save button
  7. Check the email address you noted down for emails

Resources

References

vercel[bot] commented 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

iAmWillShepherd commented 2 years ago

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.