# SMS Twilio Extension for PaymenterA comprehensive SMS extension for Paymenter that allows you to send SMS messages to your customers using the Twilio API. Features advanced template system, retry functionality, and complete SMS management.## ✨ Features- <b>📱 SMS Sending</b>: Send individual SMS messages to customers
- <span style="color:rgb(0, 0, 0)"><b>📋 SMS Templates</b>: Create and manage reusable message templates with variables</span>
- <span style="color:rgb(0, 0, 0)"><b>🔄 Retry Failed Messages</b>: Retry failed SMS messages with one click</span>
- <span style="color:rgb(0, 0, 0)"><b>📊 SMS Logging</b>: Complete audit trail of all SMS activities</span>
- <span style="color:rgb(0, 0, 0)"><b>👥 Auto SMS</b>: Sends Automated SMS When an invoice is created or marked as paid</span>
- <span style="color:rgb(0, 0, 0)"><b>⚡ Real-time Character Count</b>: Live character counting for SMS messages</span>
- <span style="color:rgb(0, 0, 0)"><b>🎯 Template Variables</b>: Dynamic content replacement (e.g., {name}, {amount})</span>
- <span style="color:rgb(0, 0, 0)"><b>🛡️ Rate Limiting</b>: Built-in protection against abuse</span>
- <span style="color:rgb(0, 0, 0)"><b>🔧 Clean Integration</b>: Follows Paymenter's Extension architecture</span>
- <span style="color:rgb(0, 0, 0)"><b>📈 Delivery Tracking</b>: Track SMS delivery status via Twilio</span>
## Installation<i>### Step 1: Copy Extension Files</i>Copy the entire
SmsTwilio folder to your Paymenter extensions directory:
# Copy to Paymenter extensions directory
[CODE=bash]cp -r SmsTwilio/ /path/to/paymenter/extensions/Others/[/CODE]
<i>### Step 2: Install Dependencies</i>[CODE=bash]cd /path/to/paymenter
composer require twilio/sdk[/CODE]
### Step 3: Enable Extension1. Go to your Paymenter admin panel
2. Navigate to Extensions
3. Find "SMS Twilio" in the list
4. Click "Enable"
<i>### Step 4: Configure Settings</i>1. Go to Extensions → SMS Twilio → Settings
2. Enter your Twilio credentials:
-
Twilio Account SID: Your Twilio Account SID
-
Twilio Auth Token: Your Twilio Auth Token
-
Twilio Phone Number: Your Twilio phone number (e.g., +1234567890)
-
Twilio Messaging Service SID: (Optional) Your Messaging Service SID for better delivery
<i>### Step 5: Access SMS Interface</i>1. Go to Admin Panel → Communication → Send SMS
2. Start sending SMS messages to your customers
<b>## 📱 Usage</b>### Sending Individual SMS[COLOR=rgb(0, 0, 0)]1. Go to Admin Panel → Communication → Send SMS
2. Click "Send SMS" button
3. Select a user from the dropdown
4. Enter phone number (if different from user's phone)
5. Choose a template or write a custom message
6. Fill in template variables (if using a template)
7. Click "Create" to send[/COLOR]
### Creating SMS Templates[COLOR=rgb(0, 0, 0)]1. Go to Admin Panel → Communication → SMS Templates
2. Click "Create Template"
3. Fill in template details:
-
Template Name: e.g., "Welcome Message"
-
Subject: Brief description
-
Message Content: Use variables like {name}, {amount}, {date}
-
Variables: Define available variables
4. Save the template
### Using Template Variables
Templates support dynamic variables:[/COLOR]
- <span style="color:rgb(0, 0, 0)"><b>{name}</b>: Customer name</span>
- <span style="color:rgb(0, 0, 0)"><b>{email}</b>: Customer email</span>
- <span style="color:rgb(0, 0, 0)"><b>{amount}</b>: Payment amount</span>
- <span style="color:rgb(0, 0, 0)"><b>{date}</b>: Current date</span>
- <span style="color:rgb(0, 0, 0)"><b>{company}</b>: Your company name</span>
- <span style="color:rgb(0, 0, 0)"><b>{order_id}</b>: Order number</span>
- <span style="color:rgb(0, 0, 0)"><b>{invoice_id}</b>: Invoice number</span>
[COLOR=rgb(0, 0, 0)]Example template:
Welcome {name}! Your order #{order_id} for {amount} has been confirmed. Thank you for choosing {company}![/COLOR]
Retrying Failed Messages[COLOR=rgb(0, 0, 0)]1. Go to Admin Panel → Communication → Send SMS
2. Find failed messages (marked with red status)
3. Click the "Retry" button next to the failed message
4. The system will attempt to resend the SMS[/COLOR][/COLOR]
## ConfigurationThe extension uses Paymenter's built-in configuration system. All settings are managed through the Extensions interface in your admin panel.🗄️ DatabaseThe extension creates two tables:
- <span style="color:rgb(0, 0, 0)"><b>
ext_sms_logs</b>: Stores SMS activity logs and delivery status</span>
- <span style="color:rgb(0, 0, 0)"><b>
ext_sms_templates</b>: Stores reusable SMS templates with variables</span>
## 🔧 Requirements
- <span style="color:rgb(0, 0, 0)">PHP 8.1+</span>
- <span style="color:rgb(0, 0, 0)">Paymenter 1.3+</span>
- <span style="color:rgb(0, 0, 0)">Twilio Account with SMS capabilities</span>
- <span style="color:rgb(0, 0, 0)">Twilio SDK (installed via Composer)</span>
[COLOR=rgb(0, 0, 0)]## 🚀 Advanced Features
### Template Variables System[/COLOR]
- <span style="color:rgb(0, 0, 0)">Create dynamic templates with placeholders</span>
- <span style="color:rgb(0, 0, 0)">Replace variables with actual data when sending</span>
- <span style="color:rgb(0, 0, 0)">Support for JSON format variable input</span>
- <span style="color:rgb(0, 0, 0)">Real-time character counting with live updates</span>
- <span style="color:rgb(0, 0, 0)">Automatic variable replacement in messages</span>
### Retry Mechanism
- <span style="color:rgb(0, 0, 0)">One-click retry for failed messages</span>
- <span style="color:rgb(0, 0, 0)">Automatic error logging</span>
- <span style="color:rgb(0, 0, 0)">Status tracking (pending, sent, failed)</span>
### Delivery Tracking
- <span style="color:rgb(0, 0, 0)">Track SMS delivery status via Twilio</span>
- <span style="color:rgb(0, 0, 0)">Store Twilio Message SID for reference</span>
- <span style="color:rgb(0, 0, 0)">Error message logging for failed deliveries</span>
### User Experience Improvements
- <span style="color:rgb(0, 0, 0)"><b>Intuitive Interface</b>: "Send SMS" instead of "Create SMS"</span>
- <span style="color:rgb(0, 0, 0)"><b>Auto-redirect</b>: Automatically returns to SMS list after sending</span>
- <span style="color:rgb(0, 0, 0)"><b>Hidden Status Field</b>: Status is managed automatically behind the scenes</span>
- <span style="color:rgb(0, 0, 0)"><b>Real-time Feedback</b>: Live character counting and instant notifications</span>
- <span style="color:rgb(0, 0, 0)"><b>Clean Form</b>: No unnecessary fields cluttering the interface</span>
[COLOR=rgb(0, 0, 0)]## 🛠️ Troubleshooting
### Common Issues
1.
SMS not sending:
- Check Twilio credentials in extension settings
- Verify phone number format (+1234567890)
- Check Twilio account balance
2.
Template variables not working:
- Ensure JSON format is correct:
{"name": "John", "amount": "$99"} - Check variable names match template placeholders
3.
Character count not updating:
- Refresh the page
- Check browser console for JavaScript errors
4.
"Sent from your Twilio trial account" message:
- This is automatically added by Twilio for trial accounts
- Upgrade to a paid Twilio account to remove this message
- Add payment method in Twilio Console → Billing
### Debug Information
Access debug information at:
/admin/sms/debug## [/COLOR]
📞[COLOR=rgb(0, 0, 0)]Support
For support with this extension:
1. Check the SMS logs for error messages
2. Verify your Twilio account status and balance
3. Ensure your Twilio credentials are correct
4. Check Paymenter logs for any errors
5. Use the debug route for configuration verification
Contact me via discord
https://discord.com/users/777176916431470652## 📄 License
This extension is licensed under the MIT License.[/COLOR][/CODE][/COLOR]