A Vendure plugin that integrates SMS notifications via seven.io service. Send automated SMS messages to customers on various events such as account creation.
- 🚀 Easy integration with Vendure e-commerce platform
- 📱 SMS notifications via seven.io REST API
- ⚡ Event-driven SMS triggers (currently supports customer creation)
- 🎨 Customizable message templates with variable substitution
- ⚙️ Configurable per-event enablement
-
Get a seven.io API Key
Sign up at seven.io and obtain your API key from the dashboard.
-
Install the Plugin
The plugin is included in your Vendure project. No additional installation required.
-
Configure Environment Variables (optional but recommended)
Create or update your
.env
file:SEVEN_API_KEY=your_seven_api_key_here
-
Add Plugin to Vendure Configuration
In your
vendure-config.ts
, import and configure the SevenPlugin:import { SevenPlugin } from './plugins/seven/seven.plugin'; export const config: VendureConfig = { // ... other configuration plugins: [ // ... other plugins SevenPlugin.init({ apiKey: process.env.SEVEN_API_KEY || 'your_api_key_here', events: { customerCreation: { enabled: true, text: 'Welcome {{firstName}} {{lastName}}! Your account has been created. Contact us if you need help.' }, orderCreation: { enabled: true, text: 'Dear {{firstName}} {{lastName}}, thanks for your order. We will notify as soon as the package leaves our warehouse.' } } }), ], };
interface PluginInitOptions {
apiKey: string; // Your seven.io API key
events: {
customerCreation: {
enabled: boolean; // Enable/disable SMS on customer creation
text: string; // SMS message template
}
}
}
Use template variables in your SMS messages:
{{firstName}}
- Customer's first name{{lastName}}
- Customer's last name{{phoneNumber}}
- Customer's phone number{{identifier}}
- Customer's email/identifier
Example:
Dear {{firstName}} {{lastName}}, welcome to our store! We've sent a confirmation to {{identifier}}.
Once configured, the plugin will automatically:
- Listen for Customer Events - Monitors when new customers are created
- Check Configuration - Verifies if SMS is enabled for the event
- Validate Phone Number - Ensures customer has a valid phone number
- Send SMS - Dispatches personalized SMS via seven.io API
When a new customer registers and provides a phone number, they'll automatically receive an SMS if:
customerCreation.enabled
istrue
- Customer has a valid
phoneNumber
- A message
text
is configured
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm run start
- Create a test customer with a valid phone number
- Check the console logs for SMS dispatch confirmation
- Verify SMS delivery on the provided phone number
The core service handling SMS operations:
class SmsService {
// Send SMS on customer creation
async customerCreation(customer: Customer): Promise<void>
// Internal method to dispatch SMS via seven.io
protected async dispatch({body}: {body: {text: string, to: string}}): Promise<any>
}
SMS not sending:
- Verify your seven.io API key is correct
- Check that
customerCreation.enabled
istrue
- Ensure customer has a valid phone number
- Check console logs for error messages
Invalid phone number format:
- Ensure phone numbers include country code
- Example:
+1234567890
(US format)
Template variables not working:
- Verify template syntax uses double curly braces:
{{variableName}}
- Check that customer object has the required fields
Enable debug logging by checking console output when customers are created. The service logs the API response from seven.io.
For issues related to:
- Seven.io API: Contact seven.io support
- Vendure Platform: Check Vendure documentation
- This Plugin: Review the code and configuration in your project