DocHub
All Supabase edge functions powering the Partner Portal

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:

  1. Generates a unique 7-character referral code
  2. Creates a Supabase Auth user with a random password
  3. Inserts a row into influencers table with the auth user ID
  4. 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:

  1. Receives compressed image from portal (client-side compression to ~100KB)
  2. Uploads image to splash-screens storage bucket
  3. Sets splash_screen_status to pending
  4. Updates splash_screen_url with 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:

  1. Fetches the image from storage URL
  2. Converts image to base64
  3. Generates self-contained HTML with the embedded image
  4. Stores HTML in splash_screen_html column
  5. Sets status to approved

On rejection:

  1. Sets status to rejected
  2. Stores reason in splash_screen_rejected_reason
  3. 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)