A powerful Google Apps Script that enables sending SMS messages directly from Google Sheets using the MRAM API. Features individual send buttons for each row, real-time status tracking, and automatic retry functionality.
- Individual SMS Buttons: Click-to-send button for each row in Column F
- Real-time Status Updates: Live status tracking in Column E
- Smart Retry System: Automatically retry failed messages
- SMS ID Extraction: Clean extraction of SMS IDs from API responses
- Delivery Status Tracking: Check delivery status for sent messages
- Balance Monitoring: Check remaining SMS balance
- Visual Feedback: Color-coded status indicators
- Error Handling: Robust error handling with detailed feedback
Column | Purpose | Example |
---|---|---|
A | Phone Number | +8801712345678 |
B | Message | Hello! This is a test message. |
C | SMS ID | bw-rdC3000708689add11452c1 |
D | Delivery Status | DELIVERED |
E | Status | ✅ Sent |
F | Send Button | 📤 SEND |
- Open Google Sheets
- Create a new spreadsheet
- Go to Extensions → Apps Script
- Delete the default code and paste the code from
sms-script.gs
- Save the project (Ctrl+S)
Update these lines in the script with your MRAM credentials:
var API_KEY = "YOUR_API_KEY"; // Replace with your MRAM API Key
var SENDER_ID = "YOUR_SENDER_ID"; // Replace with your approved Sender ID
- In Apps Script, click Triggers (⏰ icon)
- Click + Add Trigger
- Configure:
- Function:
onSelectionChange
- Event source: From spreadsheet
- Event type: On change
- Function:
- Click Save
- Go back to your Google Sheet
- Click 📩 SMS Menu → Setup Buttons
- Your sheet is now ready!
- Fill Data: Add phone numbers in Column A and messages in Column B
- Click Send: Click the blue 📤 SEND button in Column F for any row
- Monitor Status: Watch Column E for real-time status updates
Button | Status | Description |
---|---|---|
🔵 📤 SEND | Ready | Click to send SMS |
🟠 ⏳ SENDING... | Processing | SMS being sent |
🟢 ✅ SENT | Success | SMS sent successfully |
🔴 🔄 RETRY | Failed | Click to retry sending |
Access these features from 📩 SMS Menu:
- Send All SMS: Send all unsent messages at once
- Check Delivery Status: Check delivery status for sent messages
- Check Balance: View remaining SMS balance
- Setup Buttons: Initialize/reset button layout
- Send SMS for Selected Row: Send SMS for currently selected row
The script automatically extracts SMS IDs from responses like:
SMS SUBMITTED: ID - bw-rdC3000708689add11452c1
↓ Extracts ↓
bw-rdC3000708689add11452c1
Failed messages will show detailed error information and keep the SMS ID cell empty for easy retry.
Use Send All SMS to process multiple rows automatically, skipping already sent messages.
This script integrates with the MRAM SMS API endpoints:
- Send SMS:
https://sms.mram.com.bd/smsapi
- Check Delivery:
https://sms.mram.com.bd/miscapi/{API_KEY}/getDLRRep/{SMS_ID}
- Check Balance:
https://sms.mram.com.bd/miscapi/{API_KEY}/getBalance
- Never commit API keys to public repositories
- Use environment variables for sensitive data in production
- Regularly rotate API keys
- Monitor API usage to prevent abuse
Issue: Button doesn't work when clicked
- Solution: Ensure the
onSelectionChange
trigger is properly set up
Issue: "❌ Failed" status but no error details
- Solution: Check your API credentials and internet connection
Issue: SMS ID not extracted properly
- Solution: Verify the API response format matches the extraction pattern
Issue: Can't retry failed messages
- Solution: The script automatically allows retry for failed messages
To enable detailed logging:
- In Apps Script, go to View → Logs
- Add
console.log()
statements in the script for debugging
For issues related to:
- MRAM API: Contact MRAM support
- Google Apps Script: Check Google Apps Script documentation
- This Script: Create an issue in this repository
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Initial release with basic SMS sending functionality
- Individual row send buttons
- Status tracking and retry functionality
- MRAM API integration
- Delivery status checking
- Balance monitoring
If this project helped you, please give it a ⭐ star!
Made with ❤️ for the Google Sheets community