curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>"
}
'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization"
payload = { "message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'})
};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<p>Hi {{firstName}}, a quick follow-up on my last email.</p>\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"leadId": "lea_Example6F7g8H9i0J",
"stepId": "stp_Example1K2l3M4n5O",
"variant": "A",
"emailTemplateId": "etp_Example6P7q8R9s0T",
"content": {
"subject": "",
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>",
"cc": [
"jane@example.com"
]
}
}{
"error": "Validation error",
"code": "VALIDATION_ERROR"
}"The authentication you supplied is incorrect"{
"error": "Lead not found in this campaign",
"code": "REVIEW_DRAFT_LEAD_NOT_FOUND"
}{
"error": "The lead already reached this step: its message can no longer be personalized",
"code": "REVIEW_DRAFT_STEP_ALREADY_REACHED"
}{
"error": "This A/B variant is not available on the step (no variant B, or the other variant won)",
"code": "REVIEW_DRAFT_VARIANT_UNAVAILABLE"
}Personalize Step for Lead
Personalizes the message of one campaign step for a single lead.
curl --request PUT \
--url https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>"
}
'import requests
url = "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization"
payload = { "message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'})
};
fetch('https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<p>Hi {{firstName}}, a quick follow-up on my last email.</p>\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/campaigns/{campaignId}/leads/{leadIdOrEmail}/steps/{stepId}/personalization",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<p>Hi {{firstName}}, a quick follow-up on my last email.</p>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"leadId": "lea_Example6F7g8H9i0J",
"stepId": "stp_Example1K2l3M4n5O",
"variant": "A",
"emailTemplateId": "etp_Example6P7q8R9s0T",
"content": {
"subject": "",
"message": "<p>Hi {{firstName}}, a quick follow-up on my last email.</p>",
"cc": [
"jane@example.com"
]
}
}{
"error": "Validation error",
"code": "VALIDATION_ERROR"
}"The authentication you supplied is incorrect"{
"error": "Lead not found in this campaign",
"code": "REVIEW_DRAFT_LEAD_NOT_FOUND"
}{
"error": "The lead already reached this step: its message can no longer be personalized",
"code": "REVIEW_DRAFT_STEP_ALREADY_REACHED"
}{
"error": "This A/B variant is not available on the step (no variant B, or the other variant won)",
"code": "REVIEW_DRAFT_VARIANT_UNAVAILABLE"
}variant puts the lead on that version as is.
- A/B tests: a personalized step is no longer A/B tested for that lead. It
pins the lead to the variant it is written on (before the campaign starts,
it also decides which sequence variant the lead follows). Switching
variantreplaces the lead’s personalization of the other variant. - Email threads: on a follow-up email, a non-empty
subjectstarts a new thread. Leavesubjectout to stay in the thread. - Cc:
cc: []removes the step’s cc for this lead. - LinkedIn, SMS and WhatsApp: messages are plain text; HTML you send is converted to text.
- Supported steps: email, LinkedIn message, LinkedIn invitation, SMS and
WhatsApp message. Voice notes and conditions answer
422, and so do steps in a wait-until fallback or in a branch several conditions lead to. - Reached steps: once the lead reached the step (sent, skipped or ignored),
the request answers
409.
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Path Parameters
The unique identifier of the campaign
The unique identifier or email of the lead
The unique identifier of the step, from GET /campaigns/{campaignId}/sequences
Body
A/B variant to write on. Defaults to the variant the lead is already on: the winner once one is picked, else the variant already personalized, else the variant of the lead's scheduled task, else A.
A, B Email steps only. On a follow-up email, a non-empty subject starts a new thread; omit it to stay in the thread.
The message body. HTML on email steps; plain text on LinkedIn, SMS and WhatsApp steps (HTML is converted to text). Cannot be blank, except on a LinkedIn invitation.
Email steps only. An empty array removes the cc for this lead.
Email steps only. Send this lead a plain-text email.
LinkedIn invitation and LinkedIn message steps only. The connection-request note, 300 characters at most on an invitation.
1LinkedIn message steps only. The note sent from a premium account.
1 - 300Response
The step is personalized for the lead. content is the full personalized content, the fields you did not send included.
A lead's personalized version of one campaign step. It pins the lead to the A/B variant it is written on.
The lead the step is personalized for
The personalized step
The A/B variant the lead is pinned to
A, B The step content the personalization overrides (variant A or B of the step)
The full personalized content. Only the fields of the step type are present.
Show child attributes
Show child attributes
Was this page helpful?