Automations API
The Automations API allows you to create, retrieve, update, and delete automations programmatically.
List All Automations
Retrieve all automations in your account.
Endpoint:
GET /automations
Example Request:
curl -X GET "https://api.lazyspond.com/v1/automations" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response:
{
"success": true,
"data": [
{
"id": "auto_123456789",
"keyword": "GUIDE",
"message": "Here's your free guide: https://example.com/guide",
"trigger_type": "story_reply",
"status": "active",
"created_at": "2024-03-20T10:00:00Z",
"triggers_count": 150
},
{
"id": "auto_987654321",
"keyword": "PROMO",
"message": "Use code SAVE20 for 20% off",
"trigger_type": "both",
"status": "active",
"created_at": "2024-03-21T14:30:00Z",
"triggers_count": 85
}
]
}
Get a Specific Automation
Retrieve details about a specific automation.
Endpoint:
GET /automations/{id}
Example Request:
curl -X GET "https://api.lazyspond.com/v1/automations/auto_123456789" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response:
{
"success": true,
"data": {
"id": "auto_123456789",
"keyword": "GUIDE",
"message": "Here's your free guide: https://example.com/guide",
"trigger_type": "story_reply",
"status": "active",
"created_at": "2024-03-20T10:00:00Z",
"updated_at": "2024-03-22T15:00:00Z",
"triggers_count": 150,
"variations": [
{
"id": "var_1",
"message": "Check out this resource: https://example.com/guide",
"triggers_count": 75
}
]
}
}
Create an Automation
Create a new automation.
Endpoint:
POST /automations
Request Body:
{
"keyword": "GUIDE",
"message": "Here's your free guide: https://example.com/guide",
"trigger_type": "story_reply"
}
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
keyword | string | Yes | Keyword to trigger automation |
message | string | Yes | Message to send |
trigger_type | string | Yes | "story_reply", "comment", or "both" |
Example Request:
curl -X POST "https://api.lazyspond.com/v1/automations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"keyword": "GUIDE",
"message": "Here'\''s your free guide: https://example.com/guide",
"trigger_type": "story_reply"
}'
Example Response:
{
"success": true,
"data": {
"id": "auto_123456789",
"keyword": "GUIDE",
"message": "Here's your free guide: https://example.com/guide",
"trigger_type": "story_reply",
"status": "active",
"created_at": "2024-03-22T16:00:00Z"
}
}
Update an Automation
Update an existing automation.
Endpoint:
PUT /automations/{id}
Request Body:
{
"message": "Updated message",
"trigger_type": "both"
}
Example Request:
curl -X PUT "https://api.lazyspond.com/v1/automations/auto_123456789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Here'\''s your updated guide: https://example.com/guide",
"trigger_type": "both"
}'
Example Response:
{
"success": true,
"data": {
"id": "auto_123456789",
"keyword": "GUIDE",
"message": "Here's your updated guide: https://example.com/guide",
"trigger_type": "both",
"status": "active",
"updated_at": "2024-03-22T16:30:00Z"
}
}
Delete an Automation
Delete an automation.
Endpoint:
DELETE /automations/{id}
Example Request:
curl -X DELETE "https://api.lazyspond.com/v1/automations/auto_123456789" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response:
{
"success": true,
"message": "Automation deleted successfully"
}
Pause/Resume an Automation
Pause or resume an automation.
Endpoint:
PUT /automations/{id}/status
Request Body:
{
"status": "paused"
}
Valid Statuses:
- active
- paused
Example Request:
curl -X PUT "https://api.lazyspond.com/v1/automations/auto_123456789/status" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "paused"
}'
Example Response:
{
"success": true,
"data": {
"id": "auto_123456789",
"status": "paused"
}
}
Add Variation
Add a variation to an automation.
Endpoint:
POST /automations/{id}/variations
Request Body:
{
"message": "Alternative message"
}
Example Request:
curl -X POST "https://api.lazyspond.com/v1/automations/auto_123456789/variations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Check out this resource: https://example.com/guide"
}'
Example Response:
{
"success": true,
"data": {
"id": "var_2",
"message": "Check out this resource: https://example.com/guide",
"triggers_count": 0
}
}
Get Automation Statistics
Get statistics about an automation.
Endpoint:
GET /automations/{id}/stats
Query Parameters:
- start_date (ISO 8601) — Start date for statistics
- end_date (ISO 8601) — End date for statistics
Example Request:
curl -X GET "https://api.lazyspond.com/v1/automations/auto_123456789/stats?start_date=2024-03-01&end_date=2024-03-31" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response:
{
"success": true,
"data": {
"id": "auto_123456789",
"keyword": "GUIDE",
"total_triggers": 150,
"triggers_this_month": 45,
"triggers_this_week": 12,
"average_triggers_per_day": 1.5,
"variations": [
{
"id": "main",
"triggers": 100
},
{
"id": "var_1",
"triggers": 50
}
]
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique automation ID |
keyword | string | Trigger keyword |
message | string | Automation message |
trigger_type | string | "story_reply", "comment", or "both" |
status | string | "active" or "paused" |
created_at | string | ISO 8601 timestamp |
updated_at | string | ISO 8601 timestamp |
triggers_count | integer | Total number of times triggered |
variations | array | Message variations |
Error Responses
Automation Not Found
{
"success": false,
"error": "Automation not found"
}
Invalid Keyword
{
"success": false,
"error": "Keyword must be at least 2 characters"
}
Automation Limit Exceeded
{
"success": false,
"error": "You have reached the maximum number of automations for your plan"
}
Code Examples
Python
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.lazyspond.com/v1"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
# Get all automations
response = requests.get(f"{BASE_URL}/automations", headers=headers)
automations = response.json()['data']
# Create new automation
response = requests.post(
f"{BASE_URL}/automations",
headers=headers,
json={
"keyword": "GUIDE",
"message": "Here's your free guide: https://example.com/guide",
"trigger_type": "story_reply"
}
)
new_automation = response.json()['data']
# Update automation
response = requests.put(
f"{BASE_URL}/automations/{new_automation['id']}",
headers=headers,
json={
"message": "Updated message",
"trigger_type": "both"
}
)
# Pause automation
response = requests.put(
f"{BASE_URL}/automations/{new_automation['id']}/status",
headers=headers,
json={"status": "paused"}
)
# Delete automation
response = requests.delete(
f"{BASE_URL}/automations/{new_automation['id']}",
headers=headers
)
JavaScript
const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://api.lazyspond.com/v1";
const headers = {
"Authorization": `Bearer ${API_KEY}`
};
// Get all automations
fetch(`${BASE_URL}/automations`, { headers })
.then(res => res.json())
.then(data => console.log(data.data));
// Create new automation
fetch(`${BASE_URL}/automations`, {
method: "POST",
headers: {
...headers,
"Content-Type": "application/json"
},
body: JSON.stringify({
keyword: "GUIDE",
message: "Here's your free guide: https://example.com/guide",
trigger_type: "story_reply"
})
})
.then(res => res.json())
.then(data => console.log(data.data));
// Update automation
fetch(`${BASE_URL}/automations/auto_123456789`, {
method: "PUT",
headers: {
...headers,
"Content-Type": "application/json"
},
body: JSON.stringify({
message: "Updated message",
trigger_type: "both"
})
})
.then(res => res.json())
.then(data => console.log(data.data));
Next Steps
- Manage leads: See Leads API
- Get account info: See Account API
- API basics: See API Getting Started