Endpoint
POST
/backend/messages/sendBody Parameters
string
required
Recipient lead ID
string
required
Message content
string
default:"text"
Message type:
textRequest Example
curl -X POST "https://api.leavo.ai/backend/messages/send" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"lead_id": "lead-uuid",
"content": "Hello! How can I help you today?",
"type": "text"
}'
const response = await fetch('https://api.leavo.ai/backend/messages/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
lead_id: 'lead-uuid',
content: 'Hello! How can I help you today?',
type: 'text'
})
});
import requests
response = requests.post(
'https://api.leavo.ai/backend/messages/send',
headers={
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
},
json={
'lead_id': 'lead-uuid',
'content': 'Hello! How can I help you today?',
'type': 'text'
}
)
Response
{
"success": true,
"data": {
"id": "message-uuid",
"lead_id": "lead-uuid",
"content": "Hello! How can I help you today?",
"type": "text",
"role": "assistant",
"status": "pending",
"timestamp": "2024-01-15T10:30:00Z"
}
}
Possible Errors
| Code | Description |
|---|---|
NOT_FOUND | Lead not found |
INVALID_PHONE | Lead has no valid phone |
CHANNEL_ERROR | Error connecting to messaging channel |