Loading...
Loading...
Loading...
Learn how to integrate EffiMail into your applications with these practical API examples and code snippets.
Get started with these fundamental API usage examples
Basic example of generating an email using the EffiMail API with recipient information and context.
// Generate an email with EffiMail API
const response = await fetch('/api/generate-email', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
type: 'sales_outreach',
recipient: '[email protected]',
context: 'Product demo request'
})
});
const email = await response.json();
Efficiently generate multiple personalized emails in a single API call for batch processing.
// Generate multiple emails in batch
const recipients = [
{ email: '[email protected]', name: 'John' },
{ email: '[email protected]', name: 'Jane' }
];
const batchResponse = await fetch('/api/batch-generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
template: 'follow_up',
recipients: recipients,
variables: { product: 'EffiMail Pro' }
})
});
Create and save custom email templates with dynamic variables for reuse across your application.
// Create and save a custom template
const templateResponse = await fetch('/api/templates', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
name: 'custom_welcome',
subject: 'Welcome to {{company_name}}!',
content: 'Hi {{first_name}}, welcome to our platform...',
variables: ['company_name', 'first_name']
})
});
const template = await templateResponse.json();
Monitor and analyze email performance with detailed metrics and insights through the analytics API.
// Track email performance
const analyticsResponse = await fetch('/api/analytics', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
params: {
email_id: 'email_12345',
metrics: ['open_rate', 'click_rate', 'response_rate']
}
});
const metrics = await analyticsResponse.json();
console.log('Email performance:', metrics);
API implementation examples in various programming languages
Basic example of generating an email using the EffiMail API with recipient information and context.
import requests
import json
class EffiMailAPI:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = 'https://api.effimail.com/v1'
self.headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
def generate_email(self, email_type, context, recipient):
endpoint = f'{self.base_url}/generate'
payload = {
'type': email_type,
'context': context,
...
Efficiently generate multiple personalized emails in a single API call for batch processing.
const axios = require('axios');
class EffiMailAPI {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseURL = 'https://api.effimail.com/v1';
this.headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
}
async generateEmail(emailType, context, recipient) {
try {
const response = await axios.post(`${this.baseURL}/generate`, {
type: emailType,
co...
Create and save custom email templates with dynamic variables for reuse across your application.
<?php
class EffiMailAPI {
private $apiKey;
private $baseURL;
private $headers;
public function __construct($apiKey) {
$this->apiKey = $apiKey;
$this->baseURL = 'https://api.effimail.com/v1';
$this->headers = [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
];
}
public function generateEmail($emailType, $context, $recipient) {
$url = $this->baseURL . '/generate';
$data = [
...
Monitor and analyze email performance with detailed metrics and insights through the analytics API.
# Basic email generation
curl -X POST 'https://api.effimail.com/v1/generate' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"type": "sales_outreach",
"context": "Product demo invitation",
"recipient": "[email protected]",
"tone": "professional",
"language": "en"
}'
# Batch email generation
curl -X POST 'https://api.effimail.com/v1/batch' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
...
Complete guide for integrating EffiMail API into your applications