Send Email
Send a personalized message generated by AI using your prompt and data.
SDK Examples
Node.js
const ContactedAI = require('contacted');
const contacted = new ContactedAI({ apiKey: 'your-api-key' });
const result = await contacted.send({
from: 'sender@example.com',
to: 'receiver@example.com',
subject: 'Welcome to our platform!',
prompt: 'Generate a welcome email for a new user',
data: {
name: 'John Doe',
plan: 'premium'
}
});
Python
from contacted import ContactedAI
contacted = ContactedAI(api_key='your-api-key')
result = contacted.send(
from_email='sender@example.com',
to_email='receiver@example.com',
subject='Welcome to our platform!',
prompt='Generate a welcome email for a new user',
data={
'name': 'John Doe',
'plan': 'premium'
}
)
Authorizations
Body
fromstring · emailRequiredExample:
Sender email address
noreply@myapp.com
tostring · emailRequiredExample:
Recipient email address
user@example.com
subjectstring · min: 2 · max: 256RequiredExample:
Email subject line. Must be between 2-256 characters.
Welcome to our platform!
promptstring · min: 10 · max: 2000RequiredExample:
AI prompt describing the message to generate. Must be between 10-2000 characters.
Create a personalized welcome email for a new premium subscriber
Responses
200
Message sent successfully
application/json
400
Bad Request - Validation Error
application/json
401
Unauthorized - Invalid API Key
application/json
429
Rate Limited
application/json
500
Internal Server Error
application/json
post
POST /send HTTP/1.1
Host: api.contacted.io
Authorization: Bearer API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 273
{
"from": "noreply@myapp.com",
"to": "user@example.com",
"subject": "Welcome to Premium - Get Started!",
"prompt": "Create a warm welcome email for a new premium subscriber",
"data": {
"name": "Sarah Johnson",
"plan": "premium",
"trial_days": "14",
"login_url": "https://app.mycompany.com"
}
}
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued",
"message": "Message queued for delivery",
"created_at": "2024-01-15T10:30:00Z"
}
Last updated