Public Account Services
The Public Account Services submodule handles public account creation workflows, verification processes, and request management for white-label operations and public-facing account creation.
API Endpoints Overview
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/accounts/email | Submit public account email request |
POST | /v1/accounts/public-profile | Create public account profile |
GET | /v1/accounts/public-account-requests | Get public account requests |
GET | /v1/accounts/public-account-requests/:token | Get public account request by token |
PUT | /v1/accounts/public-account-requests/:id/status | Update public account request status |
POST | /v1/accounts/resend-public-verification-email/:id | Resend public verification email |
GET | /v1/accounts/verify-public-invite | Verify public invitation token |
MongoDB Collections Used
Primary Collections
account-public-requests- Public account creation requests and status_accounts- Parent accounts with public account settingscrm.contacts- Business contacts for public account creation_users- Users associated with public accounts
Public Account Workflows
Public Account Request Flow
graph TD
A[Public Email Submission] --> B[Validate Parent Account]
B --> C[Check Account Public Settings]
C --> D[Create Public Request Record]
D --> E[Generate Verification Token]
E --> F[Send Verification Email]
F --> G[User Email Verification]
G --> H[Request Approval Queue]
H --> I[Admin Approval Process]
I --> J[Account Creation]
Public Account Creation Flow
graph TD
A[Verified Public Request] --> B[Validate Request Token]
B --> C[Create Business Contact]
C --> D[Generate Sub-Account]
D --> E[Create Owner User]
E --> F[Setup Default Configuration]
F --> G[Send Welcome Email]
G --> H[Account Activation]
Public Request Management Flow
graph TD
A[Admin Review] --> B[Request Validation]
B --> C{Approve Request?}
C -->|Approve| D[Auto-Create Account]
C -->|Reject| E[Send Rejection Email]
D --> F[Process Account Setup]
E --> G[Update Request Status]
F --> H[Notify Requester]
G --> H
Service Methods & Functionality
Public Request Services
postEmail() - Public account email submission
- Processes public account email submission requests for white-label operations
- Validates parent account settings and public account permissions
- Checks for existing requests to prevent duplicates
- Creates public account request records with verification tokens
- Sends verification emails with account-specific branding
- Returns request status and verification requirements
resendPublicVerificationEmail() - Verification email resending
- Resends verification emails for pending public account requests
- Validates account permissions and request ownership
- Generates new verification tokens if needed
- Sends customized verification emails with branding
- Updates request status and tracking information
- Returns resend confirmation and status updates
Public Account Creation Services
verifyPublicInvite() - Public invitation verification
- Validates public invitation tokens and redirects to appropriate signup flows
- Handles token expiration and validation errors with proper redirects
- Manages public account invitation acceptance workflows
- Coordinates with account creation processes for verified invitations
- Returns redirect URLs for signup completion or error handling
postPublicProfile() - Public account profile creation
- Creates public account profiles through token-based verification
- Handles business contact creation and account setup for public requests
- Validates tokens and processes account creation workflows
- Manages user creation and permission assignment for public accounts
- Integrates with parent account settings and configurations
- Returns created account information and setup status
Public Request Management Services
getPublicAccountRequests() - Request listing and management
- Retrieves public account creation requests with pagination support
- Filters requests by status, date, and other criteria
- Provides comprehensive request information for admin review
- Supports search and sorting capabilities for request management
- Returns paginated request data with status and metadata
getPublicAccountRequestByToken() - Individual request retrieval
- Gets specific public account requests by verification token
- Validates token authenticity and retrieval permissions
- Provides detailed request information for processing
- Handles token-based request access and validation
- Returns complete request details and status information
putPublicAccountRequestStatus() - Request status management
- Updates public account request approval status and processing state
- Handles request approval and rejection workflows
- Manages status transitions with proper validation and authorization
- Triggers account creation processes for approved requests
- Sends notification emails based on status changes
- Returns updated request status and processing confirmation
Technical Implementation Details
Public Account Security
- Token-based Verification: Secure token generation for public account verification
- Parent Account Validation: Strict validation of parent account public settings
- Permission Management: Controlled access to public account creation features
- Request Validation: Comprehensive validation of public account requests
White-label Integration
- Branded Communications: Customizable emails and communications with parent account branding
- Domain Integration: Support for custom domain public account creation
- Settings Inheritance: Automatic inheritance of parent account settings and configurations
- Custom Workflows: Configurable approval workflows for different parent accounts
Request Processing
- Queue Management: Efficient processing of public account requests through queue systems
- Status Tracking: Comprehensive status tracking and management for requests
- Notification System: Automated notifications for request status changes
- Batch Processing: Support for bulk request processing and management
Business Logic Implementation
Public Request Workflow
- Request Validation: Validate email format and parent account settings
- Duplicate Prevention: Check for existing requests and prevent duplicates
- Token Generation: Create secure verification tokens with expiration
- Email Delivery: Send branded verification emails to requesters
- Status Management: Track request status through approval workflow
- Admin Notification: Notify administrators of new requests for review
- Processing Queue: Queue requests for batch processing and management
Account Creation Workflow
- Token Verification: Validate public account tokens and permissions
- Business Setup: Create business contacts and establish relationships
- Account Generation: Create sub-accounts with proper parent relationships
- User Creation: Set up owner users with appropriate permissions
- Configuration Setup: Apply default configurations and settings
- Notification Delivery: Send welcome emails and setup instructions
- Status Updates: Update request status and complete account activation
Key Features
Comprehensive Public Account System
- White-label Support: Full white-label account creation capabilities
- Token Security: Secure token-based verification and account creation
- Request Management: Complete request lifecycle management and tracking
- Status Monitoring: Real-time status tracking and notification system
Advanced Request Processing
- Approval Workflows: Configurable approval workflows for different parent accounts
- Batch Processing: Efficient bulk request processing and management
- Duplicate Prevention: Comprehensive validation to prevent duplicate requests
- Queue Integration: Background processing for scalable request handling
Integration Capabilities
- Parent Account Integration: Seamless integration with parent account settings
- Email Customization: Branded email communications with custom templates
- Domain Support: Support for custom domain public account creation
- Notification System: Automated notification system for status changes
Security & Validation
- Access Control: Controlled access to public account creation features
- Token Security: Secure token generation and validation with expiration
- Request Validation: Comprehensive validation of public account requests
- Permission Management: Role-based permission system for public account operations