DocHub
Web form on hypnoelp.com/form where users create personalized hypnotherapy sessions

Course Creation Form

The custom course form is a multi-step web wizard where users describe their needs and receive AI-generated personalized hypnotherapy scripts.

Purpose

Allow HypnoELP users to create custom hypnotherapy sessions tailored to their specific challenges. Users answer questions about their issue, goals, and desired feelings, then the system generates three personalized scripts using different hypnotic techniques. The user picks one and it gets converted to audio.

Architecture

The form is a single-page app hosted on Hostinger at hypnoelp.com/form. It communicates with a Supabase edge function (submit-custom-course) which orchestrates the backend pipeline.

Component Location
Form frontend hypnoelp.com/form (Hostinger)
Edge function submit-custom-course on main HypnoELP Supabase
n8n workflows Digital Ocean (worker-1)

User Flow (6 Steps)

Step 1: Tell Us About Yourself

User fills in four fields:

  • Issue — What challenge they’re facing (20-500 chars)
  • Goal — What they want to achieve (20-500 chars)
  • Feel — How they want to feel after (10-500 chars)
  • Why — Why this matters to them (10-500 chars)

A health check runs after this step (calls Mistral via n8n) to validate the inputs are safe and appropriate for hypnotherapy. If inputs are flagged, the user gets suggestions to rewrite.

Step 2: Session Title

User gives their session a title (5-55 chars).

Step 3: Choose Techniques

User selects a hypnotic technique for each of three scripts:

Technique Description
Mental Rehearsal Visualize success in specific scenarios
Trigger Transformation Reframe responses to triggers
Lasting Suggestions Post-hypnotic behavioral anchors
Gentle Release Aversion-based release of old patterns
Future Self Forward-looking visualization
Deep Motivation Emotional leverage for change

Each technique includes a sample excerpt so users understand the style.

Step 4: Tips

Quick guidance on how to choose between the three generated scripts.

Step 5: Choose Your Script

Three AI-generated scripts are displayed. User reads each and selects the one that resonates most. Scripts are cleaned for display (removing [pause], [guided], and other TTS instruction tags).

Step 6: Choose Voice & Review

User selects male or female voice, reviews their selection, and confirms. Audio generation begins via ElevenLabs TTS.

Authentication

Two token types are supported:

  • JWT — Issued by the HypnoELP app after purchase (starts with eyJ)
  • UUID — Link token for regeneration requests (stored in custom_course_purchases table, expires after 24 hours)

Both are verified by the edge function before processing.

API Endpoints

All requests go through a single edge function:

POST https://kagtryxgjwavupzlmlzv.supabase.co/functions/v1/submit-custom-course

The step field determines the action:

Step Purpose
health_check Validate user inputs before generation
generate_scripts Generate 3 scripts with chosen techniques
generate_audio Convert selected script to audio
support_request Send support email via Resend

Handshakes

From To Data
Form Edge function JSON POST with user inputs + token
Edge function n8n health check {issue, goal, feel, why}
Edge function n8n script generation {issue, goal, feel, why, title, scripts, user_id}
Edge function n8n audio generation {text, voice, title, client_id}

Variables

Variable Location Purpose
API_ENDPOINT config.js Edge function URL
UPDATE_STATUS_URL config.js Purchase status update URL
SUPABASE_ANON_KEY config.js Supabase auth for frontend requests

Data Model

The form itself is stateless — all data is sent to the edge function per request. Purchase state is tracked in the custom_course_purchases table on the main HypnoELP Supabase.

Dependencies

  • Supabase (auth + edge function)
  • n8n (health check + script generation + audio workflows)
  • Hostinger (hosting)

Status

Production. Form is live at hypnoelp.com/form. All steps functional.