Email & SMS
Send Email
Sends an email to the specified lead using the caller’s outgoing email configuration.
Notes:
- leadId, subject and content are required.
- toEmail selects a specific email on the lead; when it is not present on the lead, the lead’s primary email is used.
- Caller must have manage permission on the lead.
POST
/
v1.0
/
message
/
email
/
send
Send Email
curl --request POST \
--url https://api.lofty.com/v1.0/message/email/send \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"subject": "Welcome to our service",
"content": "Hello, this is a test email",
"leadId": 563172647619608,
"toEmail": "recipient@example.com"
}
'import requests
url = "https://api.lofty.com/v1.0/message/email/send"
payload = {
"subject": "Welcome to our service",
"content": "Hello, this is a test email",
"leadId": 563172647619608,
"toEmail": "recipient@example.com"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
subject: 'Welcome to our service',
content: 'Hello, this is a test email',
leadId: 563172647619608,
toEmail: 'recipient@example.com'
})
};
fetch('https://api.lofty.com/v1.0/message/email/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lofty.com/v1.0/message/email/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subject' => 'Welcome to our service',
'content' => 'Hello, this is a test email',
'leadId' => 563172647619608,
'toEmail' => 'recipient@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lofty.com/v1.0/message/email/send"
payload := strings.NewReader("{\n \"subject\": \"Welcome to our service\",\n \"content\": \"Hello, this is a test email\",\n \"leadId\": 563172647619608,\n \"toEmail\": \"recipient@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lofty.com/v1.0/message/email/send")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"subject\": \"Welcome to our service\",\n \"content\": \"Hello, this is a test email\",\n \"leadId\": 563172647619608,\n \"toEmail\": \"recipient@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lofty.com/v1.0/message/email/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"subject\": \"Welcome to our service\",\n \"content\": \"Hello, this is a test email\",\n \"leadId\": 563172647619608,\n \"toEmail\": \"recipient@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"messageId": "<string>",
"toEmail": "<string>",
"subject": "<string>"
}"<string>""<string>""<string>"Body
application/json
Email send request payload.
Email subject
Example:
"Welcome to our service"
Email content
Example:
"Hello, this is a test email"
Lead ID. When toEmail is not provided or no matching email is found for the lead, the system will use the primary email address of this lead. At least one of toEmail or leadId must be provided.
Example:
563172647619608
Recipient email address.
Example:
"recipient@example.com"
⌘I
Send Email
curl --request POST \
--url https://api.lofty.com/v1.0/message/email/send \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"subject": "Welcome to our service",
"content": "Hello, this is a test email",
"leadId": 563172647619608,
"toEmail": "recipient@example.com"
}
'import requests
url = "https://api.lofty.com/v1.0/message/email/send"
payload = {
"subject": "Welcome to our service",
"content": "Hello, this is a test email",
"leadId": 563172647619608,
"toEmail": "recipient@example.com"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
subject: 'Welcome to our service',
content: 'Hello, this is a test email',
leadId: 563172647619608,
toEmail: 'recipient@example.com'
})
};
fetch('https://api.lofty.com/v1.0/message/email/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lofty.com/v1.0/message/email/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subject' => 'Welcome to our service',
'content' => 'Hello, this is a test email',
'leadId' => 563172647619608,
'toEmail' => 'recipient@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lofty.com/v1.0/message/email/send"
payload := strings.NewReader("{\n \"subject\": \"Welcome to our service\",\n \"content\": \"Hello, this is a test email\",\n \"leadId\": 563172647619608,\n \"toEmail\": \"recipient@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lofty.com/v1.0/message/email/send")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"subject\": \"Welcome to our service\",\n \"content\": \"Hello, this is a test email\",\n \"leadId\": 563172647619608,\n \"toEmail\": \"recipient@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lofty.com/v1.0/message/email/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"subject\": \"Welcome to our service\",\n \"content\": \"Hello, this is a test email\",\n \"leadId\": 563172647619608,\n \"toEmail\": \"recipient@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"messageId": "<string>",
"toEmail": "<string>",
"subject": "<string>"
}"<string>""<string>""<string>"