# 🎉 WhatsApp Message Generator - Usage Guide

## ✅ Your App is Ready!

Your WhatsApp Message Generator is now connected to your deployed API and ready to use!

**API URL:** `https://script.google.com/macros/s/AKfycbwOQ867NuHepyHJ2Nqgu4OuLN_zflz5RYADSPRJC4lgl-4qZODL3m-taqE5-GoKwsZm/exec`

## 🚀 How to Use

### Step 1: Open the App
Open `app.html` in your browser.

### Step 2: Fill Out the Form

**Required Fields:**
- **University** - Enter the university name (e.g., "Harvard University")
- **Success Coach Name** - Enter the coach name (e.g., "Dr. Smith")
- **Student Name** - Enter the student's name
- **Category** - Select from dropdown (automatically loaded)
- **Subcategory** - Select from dropdown (filtered by category)

**Optional Fields:**
- **Phone Number** - Add to open WhatsApp directly
- **Additional Details** - Fill based on template:
  - Field 1: For dates, percentages, amounts, etc.
  - Field 2: For subjects, events, reasons, etc.

### Step 3: Generate Message

Click **"Generate Message"** button.

### Step 4: Get Your WhatsApp Message

- View the personalized message
- Click **📋 Copy Message** to copy to clipboard
- Click **💬 Open WhatsApp** to send directly (if phone added)

## 📋 Available Categories & Subcategories

Your templates include:

1. **Student Learning Efforts** → Assignments
2. **Student Performance** → Test Scores
3. **Student Health** → Sick Leave
4. **Student Attendance** → Absences
5. **Campus Happenings - Academic events** → Workshops
6. **Campus Happenings - Non-Academic events** → Fests
7. **Campus Happenings - Extra curricular events** → Sports
8. **Placement Opportunities** → Job Fairs
9. **Student Behaviour - Extremes** → Misconduct
10. **Student Leaves** → Planned Leaves
11. **Emergency Contact Numbers & Escalations** → Updated Contact Details
12. **Student Achievements** → Academic
13. **Fee Reminders** → Payment Due Dates
14. **Greetings** → Birthdays
15. **Referral Opportunities** → New Student Referrals

## 🎯 Example Usage

### Example 1: Assignment Update

**Fill form:**
- University: ** ** ** **

**Result:**

```
Assignment Update: Harvard University × NIAT

Dear Parent,

Your child/ward John Doe has submitted 85% of this week's assignments.
Pending assignments: Math Homework, English Essay.

Warm regards,
Dr. Smith
```

### Example 2: Test Scores

**Fill form:**
- University: Stanford University
- Coach: Dr. Jane Wilson
- Student: Mary Johnson
- Category: Student Performance
- Subcategory: Test Scores
- Additional 1: 92/100
- Additional 2: Mathematics
- Additional 3: Topics in Calculus

**Result:**

```
Test Update: Stanford University × NIAT

Dear Parent,

Mary Johnson scored 92/100 in Mathematics held on N/A.
They've shown good effort — we'll keep helping them strengthen Topics in Calculus.

Warm regards,
Dr. Jane Wilson
```

## 🔍 Understanding Placeholders

Your templates use these placeholders (automatically replaced):

| Placeholder | Replaced With |
|-------------|---------------|
| `[University]` | University field |
| `[Student Name]` | Student Name field |
| `[SC Name]` | Success Coach Name field |
| `[X%]` | Additional Field 1 |
| `[X/100]` | Additional Field 1 |
| `[Date]` | Additional Field 1 |
| `[Amount]` | Additional Field 1 |
| `[Subject/Test]` | Additional Field 2 |
| `[Event]` | Additional Field 2 |
| `[Reason]` | Additional Field 2 |
| `[Topics]` | Additional Field 2 |
| `[List]` | Additional Field 2 |
| And more... | See template for details |

## 💡 Tips

### General Guidelines:
1. **Check the template** - Each template tells you what fields to fill
2. **Use Additional Fields** - Fill only what's needed for that template
3. **Keep it concise** - WhatsApp messages should be short
4. **Use phone number** - Makes it easier to send directly

### Template-Specific Tips:

**For Test Scores:**
- Additional 1: Score (e.g., "92/100")
- Additional 2: Subject (e.g., "Mathematics")

**For Dates:**
- Additional 1: Date (e.g., "Dec 15, 2024")

**For Fees:**
- Additional 1: Amount (e.g., "$500")
- Additional 2: Due Date (e.g., "Dec 31, 2024")

## 🔧 Troubleshooting

### Categories not loading?
- Refresh the page
- Check internet connection
- API might be loading - wait a moment

### Message looks wrong?
- Check which placeholders the template uses
- Make sure you filled the right additional fields
- Verify data in your Google Sheets

### WhatsApp not opening?
- Verify phone number format (+1234567890)
- Make sure WhatsApp is installed
- Phone number must include country code

### Copy not working?
- Try manual copy (Ctrl+C / Cmd+C)
- Check browser permissions
- Modern browser required

## 📱 WhatsApp Integration

### Copy Message
- Click the **📋** button
- Message copied to clipboard
- Paste anywhere you need

### Open WhatsApp
- Enter phone number in form
- Click **💬** button
- WhatsApp opens with message ready
- Just tap send!

## ✨ Features

✅ **Dynamic Templates** - Loaded from Google Sheets  
✅ **15+ Categories** - Covering all student scenarios  
✅ **Auto-Matching** - Finds right template automatically  
✅ **Personalization** - All placeholders filled automatically  
✅ **WhatsApp Ready** - Send directly from the app  
✅ **Mobile Friendly** - Works on all devices  
✅ **Easy Updates** - Edit templates in Google Sheets  

## 📞 Support

- **API Issues:** Check Google Apps Script execution logs
- **Template Questions:** Review your Google Sheets structure
- **General Help:** See troubleshooting section above

## 🎓 Next Steps

1. **Test it** - Try generating a few messages
2. **Customize** - Edit templates in Google Sheets as needed
3. **Share** - Give users access to the app
4. **Update** - Add more templates as needed

---

**Ready to start?** Open `app.html` and generate your first WhatsApp message! 🚀
