Edge Functions Overview
All edge functions run on Supabase project foxuipkuotwhitlxssyc. They handle influencer creation, splash screen management, and app integration.
Purpose
Provide a serverless API layer between the frontend websites and the Supabase database/storage, handling business logic like auth user creation, email sending, image processing, and HTML generation.
Functions
create-influencer
Creates a new influencer record and associated Supabase Auth user.
| Field | Value |
|---|---|
| Method | POST |
| Auth | None (called from admin site) |
| URL | https://foxuipkuotwhitlxssyc.supabase.co/functions/v1/create-influencer |
Request body:
{
"name": "John Doe",
"email": "john@example.com",
"groups": [],
"portal_url": "https://hypnoelp.com/influencers/",
"send_email": true
}
What it does:
- Generates a unique 7-character referral code
- Creates a Supabase Auth user with a random password
- Inserts a row into
influencerstable with the auth user ID - Sends invite email via Resend with a password setup link
Response:
{
"success": true,
"code": "IK7MP3X",
"existing": false,
"email_sent": true,
"invite_link": "https://hypnoelp.com/influencers/"
}
update-splash-screen
Handles splash screen image upload from the portal.
| Field | Value |
|---|---|
| Method | POST |
| Auth | JWT (Supabase Auth) |
| URL | https://foxuipkuotwhitlxssyc.supabase.co/functions/v1/update-splash-screen |
What it does:
- Receives compressed image from portal (client-side compression to ~100KB)
- Uploads image to
splash-screensstorage bucket - Sets
splash_screen_statustopending - Updates
splash_screen_urlwith the public URL
approve-splash-screen
Admin action to approve or reject a pending splash screen.
| Field | Value |
|---|---|
| Method | POST |
| Auth | None (called from admin site) |
| URL | https://foxuipkuotwhitlxssyc.supabase.co/functions/v1/approve-splash-screen |
Request body (approve):
{
"influencer_id": "uuid",
"action": "approve"
}
Request body (reject):
{
"influencer_id": "uuid",
"action": "reject",
"reason": "Image has rounded corners"
}
On approval:
- Fetches the image from storage URL
- Converts image to base64
- Generates self-contained HTML with the embedded image
- Stores HTML in
splash_screen_htmlcolumn - Sets status to
approved
On rejection:
- Sets status to
rejected - Stores reason in
splash_screen_rejected_reason - Influencer sees reason in portal and can re-upload
get-splash-screen
App-facing endpoint that returns the splash screen HTML.
| Field | Value |
|---|---|
| Method | GET |
| Auth | None (public) |
| URL | https://foxuipkuotwhitlxssyc.supabase.co/functions/v1/get-splash-screen?code=REFERRAL_CODE |
Response: Raw HTML string with embedded base64 image, ready to display in a WebView.
Returns 404 if the code doesn’t exist or the splash screen isn’t approved.
Handshakes
- Admin Website →
create-influencer: JSON POST, no auth - Admin Website →
approve-splash-screen: JSON POST, no auth - Portal →
update-splash-screen: JSON POST with Supabase JWT - HypnoELP App →
get-splash-screen: GET with query param, no auth - All functions → Supabase DB: Service role key (server-side)
create-influencer→ Resend API: Email delivery
Dependencies
- Supabase JS client (built into edge functions)
- Resend API (key stored in Supabase secrets as
RESEND_API_KEY)