Skip to main content

POST /api/custom-plan

Submit a custom website plan request with user-selected features. This endpoint saves the request to MongoDB and sends an email notification with all details including the selected features breakdown.

Request Body

name
string
required
The full name of the person requesting the custom plan
email
string
required
The email address for contact
phone
string
required
The phone number for contact
companyName
string
The company name (optional)
selectedFeatures
array
required
An array of feature objects that the user has selected. Each feature object should contain:
  • name (string): Feature name
  • price (number): Feature price
  • description (string, optional): Feature description
additionalNotes
string
Any additional notes or requirements (optional)
websiteType
string
The type of website being requested. Defaults to “Custom” if not provided
totalPrice
number
required
The total price calculated from all selected features

Response

message
string
Success message confirming the request submission
error
string
Error message if the request fails (only present on error)

Example Request

cURL
curl -X POST http://localhost:3001/api/custom-plan \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "[email protected]",
    "phone": "+1234567890",
    "companyName": "Tech Solutions Inc",
    "selectedFeatures": [
      {
        "name": "Responsive Design",
        "price": 5000,
        "description": "Mobile-first responsive design"
      },
      {
        "name": "E-commerce Integration",
        "price": 8000,
        "description": "Full shopping cart functionality"
      },
      {
        "name": "SEO Optimization",
        "price": 3000,
        "description": "On-page and technical SEO"
      }
    ],
    "additionalNotes": "Need this completed within 3 months",
    "websiteType": "E-commerce",
    "totalPrice": 16000
  }'
JavaScript
const response = await fetch('http://localhost:3001/api/custom-plan', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Jane Smith',
    email: '[email protected]',
    phone: '+1234567890',
    companyName: 'Tech Solutions Inc',
    selectedFeatures: [
      {
        name: 'Responsive Design',
        price: 5000,
        description: 'Mobile-first responsive design'
      },
      {
        name: 'E-commerce Integration',
        price: 8000,
        description: 'Full shopping cart functionality'
      },
      {
        name: 'SEO Optimization',
        price: 3000,
        description: 'On-page and technical SEO'
      }
    ],
    additionalNotes: 'Need this completed within 3 months',
    websiteType: 'E-commerce',
    totalPrice: 16000
  })
});

const data = await response.json();
console.log(data);

Success Response

{
  "message": "Custom plan request submitted successfully"
}

Error Response

{
  "error": "Failed to process custom plan request"
}

Email Notification

When a custom plan request is submitted, an email is sent to the configured recipient containing:
  • Subject: “New Custom Plan Request from [name]”
  • Name: The submitted name
  • Email: The submitted email address
  • Phone: The submitted phone number
  • Company: The company name (or “Not provided” if empty)
  • Website Type: The type of website (or “Custom” if not specified)
  • Total Price: Formatted as R[amount] with thousands separator
  • Selected Features: A formatted list showing:
    • Feature name and price
    • Feature description (if provided)
  • Additional Notes: Any additional notes (if provided)

Data Storage

The custom plan request is saved to MongoDB with the following schema:
{
  name: String (required),
  email: String (required),
  phone: String (required),
  companyName: String (optional),
  websiteType: String (required),
  features: Array of objects with {id, name, price, category},
  totalPrice: Number (required),
  date: Date (auto-generated)
}

Notes

  • The websiteType field defaults to “Custom” if not provided in the request
  • The selectedFeatures array can contain any number of feature objects
  • Prices are displayed in South African Rand (R) in email notifications
  • The request is saved to MongoDB before sending the email notification

Build docs developers (and LLMs) love