Email & SMS
Send SMS
Sends an SMS to the specified lead from the caller’s virtual number.
Notes:
- leadId and content are required.
- phoneNumber + phoneCode select a specific phone on the lead; when omitted, the lead’s primary phone is used.
- Caller must have manage permission on the lead and must have an active virtual number.
POST
/
v1.0
/
message
/
sms
/
send
Send SMS
curl --request POST \
--url https://api.lofty.com/v1.0/message/sms/send \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"content": "Hello, this is a test message",
"leadId": 563172647619608,
"phoneNumber": "5865865860",
"phoneCode": "1"
}
'import requests
url = "https://api.lofty.com/v1.0/message/sms/send"
payload = {
"content": "Hello, this is a test message",
"leadId": 563172647619608,
"phoneNumber": "5865865860",
"phoneCode": "1"
}
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({
content: 'Hello, this is a test message',
leadId: 563172647619608,
phoneNumber: '5865865860',
phoneCode: '1'
})
};
fetch('https://api.lofty.com/v1.0/message/sms/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/sms/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([
'content' => 'Hello, this is a test message',
'leadId' => 563172647619608,
'phoneNumber' => '5865865860',
'phoneCode' => '1'
]),
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/sms/send"
payload := strings.NewReader("{\n \"content\": \"Hello, this is a test message\",\n \"leadId\": 563172647619608,\n \"phoneNumber\": \"5865865860\",\n \"phoneCode\": \"1\"\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/sms/send")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"content\": \"Hello, this is a test message\",\n \"leadId\": 563172647619608,\n \"phoneNumber\": \"5865865860\",\n \"phoneCode\": \"1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lofty.com/v1.0/message/sms/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 \"content\": \"Hello, this is a test message\",\n \"leadId\": 563172647619608,\n \"phoneNumber\": \"5865865860\",\n \"phoneCode\": \"1\"\n}"
response = http.request(request)
puts response.read_body{
"messageId": "<string>",
"phoneNumber": "<string>",
"phoneCode": "<string>"
}"<string>""<string>""<string>"Body
application/json
SMS request payload.
SMS content
Example:
"Hello, this is a test message"
Lead ID. When phoneNumber and phoneCode are not provided or no matching phone is found for the lead, the system will use the primary phone number of this lead.
Example:
563172647619608
Recipient phone number
Example:
"5865865860"
Recipient phone code
Example:
"1"
⌘I
Send SMS
curl --request POST \
--url https://api.lofty.com/v1.0/message/sms/send \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"content": "Hello, this is a test message",
"leadId": 563172647619608,
"phoneNumber": "5865865860",
"phoneCode": "1"
}
'import requests
url = "https://api.lofty.com/v1.0/message/sms/send"
payload = {
"content": "Hello, this is a test message",
"leadId": 563172647619608,
"phoneNumber": "5865865860",
"phoneCode": "1"
}
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({
content: 'Hello, this is a test message',
leadId: 563172647619608,
phoneNumber: '5865865860',
phoneCode: '1'
})
};
fetch('https://api.lofty.com/v1.0/message/sms/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/sms/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([
'content' => 'Hello, this is a test message',
'leadId' => 563172647619608,
'phoneNumber' => '5865865860',
'phoneCode' => '1'
]),
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/sms/send"
payload := strings.NewReader("{\n \"content\": \"Hello, this is a test message\",\n \"leadId\": 563172647619608,\n \"phoneNumber\": \"5865865860\",\n \"phoneCode\": \"1\"\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/sms/send")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"content\": \"Hello, this is a test message\",\n \"leadId\": 563172647619608,\n \"phoneNumber\": \"5865865860\",\n \"phoneCode\": \"1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lofty.com/v1.0/message/sms/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 \"content\": \"Hello, this is a test message\",\n \"leadId\": 563172647619608,\n \"phoneNumber\": \"5865865860\",\n \"phoneCode\": \"1\"\n}"
response = http.request(request)
puts response.read_body{
"messageId": "<string>",
"phoneNumber": "<string>",
"phoneCode": "<string>"
}"<string>""<string>""<string>"