Send a LinkedIn message to a lead using their ID. The lead’s LinkedIn URL is looked up automatically from the database. Supports template variables like {{firstName}} and {{lastName}}.
Request
The lead ID to send the message to
The LinkedIn sender account ID to use. Get available senders from the List Senders endpoint.
The message content to send (max 8000 characters). Supports template variables:
{{firstName}} - Lead’s first name
{{lastName}} - Lead’s last name
Response
Whether the message was sent successfully
Unique identifier for the sent message
The LinkedIn URL of the lead
The lead ID the message was sent to
ISO 8601 timestamp when the message was sent
curl -X POST https://api.sendpilot.ai/v1/inbox/send/lead/lead_abc123 \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"senderId": "sender_def456",
"message": "Hi {{firstName}}! Thanks for connecting. I wanted to follow up on our conversation..."
}'
const leadId = 'lead_abc123';
const response = await fetch(`https://api.sendpilot.ai/v1/inbox/send/lead/${leadId}`, {
method: 'POST',
headers: {
'X-API-Key': process.env.SENDPILOT_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
senderId: 'sender_def456',
message: 'Hi {{firstName}}! Thanks for connecting...'
})
});
const result = await response.json();
import requests
lead_id = 'lead_abc123'
response = requests.post(
f'https://api.sendpilot.ai/v1/inbox/send/lead/{lead_id}',
headers={
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'senderId': 'sender_def456',
'message': 'Hi {{firstName}}! Thanks for connecting...'
}
)
result = response.json()
{
"success": true,
"messageId": "msg_xyz789",
"recipientLinkedinUrl": "https://www.linkedin.com/in/john-doe",
"leadId": "lead_abc123",
"status": "sent",
"timestamp": "2024-02-24T15:30:00.000Z"
}
{
"statusCode": 400,
"error": "Bad Request",
"code": "MISSING_LINKEDIN_URL",
"message": "Lead 'lead_abc123' does not have a LinkedIn URL"
}
{
"statusCode": 404,
"error": "Not Found",
"code": "LEAD_NOT_FOUND",
"message": "Lead with ID 'lead_abc123' not found in this workspace"
}
{
"statusCode": 429,
"error": "Too Many Requests",
"code": "DAILY_LIMIT_EXCEEDED",
"message": "LinkedIn sender 'sender_def456' has reached its daily message limit."
}
The lead must be a 1st-degree connection of the sender. Attempting to message a non-connected lead will result in an error.
Use template variables like {{firstName}} to personalize your messages. The variables are automatically replaced with the lead’s actual data.
API key for authentication
The lead ID to send the message to
The LinkedIn sender account ID to use
The message content to send. Supports template variables:
{{firstName}} (lead's first name), {{lastName}} (lead's last name).
Maximum string length: 8000
Message sent successfully
timestamp
string<date-time>
required