Send Email

Send AI-Generated Message

post

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 · emailRequired

Sender email address

Example: noreply@myapp.com
tostring · emailRequired

Recipient email address

Example: user@example.com
subjectstring · min: 2 · max: 256Required

Email subject line. Must be between 2-256 characters.

Example: Welcome to our platform!
promptstring · min: 10 · max: 2000Required

AI prompt describing the message to generate. Must be between 10-2000 characters.

Example: Create a personalized welcome email for a new premium subscriber
Responses
200
Message sent successfully
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