This is a Next.js project bootstrapped with create-next-app
.
OneSignal makes engaging customers simple and is the fastest, most reliable service to send push notifications, in-app messages, SMS, and emails.
This repo contains the companion API to the Onesignal + Supabase Sample Integration guide.
This project exists solely so the sample integration works in both local and production environments. While the event-handler implemented in this project can be implemented Supabase, it may negatively impact your dev experience due to a constraint with Supabase hosted on Docker: it can only serve one edge function at a time. Hosting a seperate API is a simple work-around for the limitation.
- This API recieves successful Stripe webhook events
- If the event matched the correct intent, an Order record is inserted into the database
- A Supabase Database Webhook, defined in the project calls a Supabase Edge Function when the record is inserted, calls a Supabase Edge Function which sends a request to the OneSignal API to create a push notificaiton.
This enables us to Insert Order record before sending a message to the user. We may want to do this for a host of reason such as wanting to wait for shipping to process before alerting to wanting to make sure the payment is received before moving the customer to the next stage of their journey. Supabase Database Webhooks enable us to react to state changes from our source of truth: the database.
First, make a copy of .env.example
and set each variable
Then, run the development server:
npm run dev
# or
yarn dev
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
For additional resources, please join the OneSignal Developer Community.
Get in touch with us or learn more about OneSignal through the channels below.
- Follow us on Twitter to never miss any updates from the OneSignal team, ecosystem & community
- Join us on Discord to be a part of the OneSignal Developers community, showcase your work and connect with other OneSignal developers
- Read the OneSignal Blog for the latest announcements, tutorials, in-depth articles & more.
- Subscribe to us on YouTube for walkthroughs, courses, talks, workshops & more.
- Follow us on Twitch for live streams, office hours, support & more.
Give a ⭐️ if this project helped you, and watch this repo to stay up to date.