Email API
Send templated emails with VoiceStamp integrations and dynamic content
📧 19 Available Templates: Including VoiceStamp Share (#100), Verification Code (#2), Welcome Email (#1), and more.→ View all templates
Email System Features
The Email API enables you to:
- Send templated emails with dynamic variables
- Share VoiceStamps via email with custom messages
- Use short codes for personalized content
- Track email delivery and engagement
- Manage templates with the admin interface
Base URL
https://voicestamp.vps.webdock.cloud/api/v1/emailSend Email
Send an email using a predefined template with dynamic variables.
POST /api/v1/email/send
Request Body
{
"template_id": "9",
"recipient_email": "user@example.com",
"recipient_name": "John Doe",
"variables": {
"sender_name": "Your Name",
"voicestamp_url": "https://voicestamp.app/listen/vst_123",
"message": "Check out this voice recording!",
"custom_note": "Added from mobile app"
}
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| template_id | string | No* | ID of the email template (use either template_id or template_name) |
| template_name | string | No* | Name of the email template (use either template_id or template_name) |
| recipient_email | string | Yes | Email address of the recipient |
| recipient_name | string | No | Display name of the recipient |
| variables | object | No | Key-value pairs for template variables |
* Either template_id or template_name must be provided
Template Management
Get All Templates
GET /api/v1/email/templatesRetrieve a list of all active email templates.
Get Single Template
GET /api/v1/email/templates/{id}Get details of a specific email template by ID.
Create Template
POST /api/v1/email/templates{
"name": "Welcome Email",
"subject": "Welcome to VoiceStamp, {{first_name}}!",
"html_content": "<h1>Welcome {{first_name}}!</h1><p>Thank you for joining VoiceStamp.</p>",
"plain_content": "Welcome {{first_name}}! Thank you for joining VoiceStamp.",
"short_codes_used": ["first_name", "email"],
"category": "onboarding"
}Update Template
PUT /api/v1/email/templates/{id}Update any field of an existing template. All fields are optional.
Delete Template
DELETE /api/v1/email/templates/{id}Soft delete a template (sets is_active to false).
Get Short Codes
Retrieve all available short codes for use in email templates.
GET /api/v1/email/short-codesReturns a list of all short codes organized by category that can be used in email templates.
Common Template Variables
Standard variables available in VoiceStamp email templates.
| Variable | Description | Example |
|---|---|---|
| sender_name | Name of the person sending the VoiceStamp | John Smith |
| recipient_name | Name of the person receiving the email | Sarah Johnson |
| voicestamp_url | Direct link to listen to the VoiceStamp | https://voicestamp.app/listen/vst_123 |
| message | Custom message from the sender | Check out this voice note! |
| share_code | Unique code for accessing shared content | ABC123 |
Example: Share VoiceStamp via Email
Complete example of sharing a voice recording via email.
// JavaScript Example
const shareVoiceStamp = async (voiceStampId, recipientEmail) => {
// First, get the VoiceStamp details
const vstResponse = await fetch(`/api/v1/voicestamps/${voiceStampId}`, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
}
});
const voiceStamp = await vstResponse.json();
// Then send the email
const emailResponse = await fetch('/api/v1/email/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template_id: '9',
recipient_email: recipientEmail,
recipient_name: 'Friend',
variables: {
sender_name: 'Your Name',
voicestamp_url: voiceStamp.data.public_url,
message: 'I recorded this voice note for you!',
share_code: voiceStamp.data.share_code
}
})
});
return emailResponse.json();
};