curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "Spring promo (updated)",
"active": true,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring"
}
]
}' \
-X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";
fetch(`https://api.ayrshare.com/api/automations/${id}`, {
method: "PUT",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Spring promo (updated)",
active: true,
actions: [
{
type: "send_dm",
message: "Hey {{recipient_username}}! New link: https://example.com/spring",
},
],
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
"Authorization": "Bearer API_KEY",
"Content-Type": "application/json",
}
automation_id = "auto_9xKp2Lm4nQ"
payload = {
"name": "Spring promo (updated)",
"active": True,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring",
}
],
}
r = requests.put(
f"https://api.ayrshare.com/api/automations/{automation_id}",
json=payload,
headers=headers,
)
print(r.json())
$id = "auto_9xKp2Lm4nQ";
$data = [
"name" => "Spring promo (updated)",
"active" => true,
"actions" => [
[
"type" => "send_dm",
"message" => "Hey {{recipient_username}}! New link: https://example.com/spring",
],
],
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY",
"Content-Type: application/json",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"status": "success",
"id": "auto_9xKp2Lm4nQ"
}
{
"action": "request",
"status": "error",
"code": 473,
"message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction",
"details": {
"formErrors": ["Unrecognized key: \"platform\""],
"fieldErrors": {}
}
}
{
"action": "automation",
"status": "error",
"code": 469,
"message": "Automation not found"
}
{
"action": "automation",
"status": "error",
"code": 470,
"message": "Active automation limit reached for your plan tier"
}
Automations
Оновлення автоматизації
Оновлення існуючої автоматизації
PUT
/
automations
/
:id
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "Spring promo (updated)",
"active": true,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring"
}
]
}' \
-X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";
fetch(`https://api.ayrshare.com/api/automations/${id}`, {
method: "PUT",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Spring promo (updated)",
active: true,
actions: [
{
type: "send_dm",
message: "Hey {{recipient_username}}! New link: https://example.com/spring",
},
],
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
"Authorization": "Bearer API_KEY",
"Content-Type": "application/json",
}
automation_id = "auto_9xKp2Lm4nQ"
payload = {
"name": "Spring promo (updated)",
"active": True,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring",
}
],
}
r = requests.put(
f"https://api.ayrshare.com/api/automations/{automation_id}",
json=payload,
headers=headers,
)
print(r.json())
$id = "auto_9xKp2Lm4nQ";
$data = [
"name" => "Spring promo (updated)",
"active" => true,
"actions" => [
[
"type" => "send_dm",
"message" => "Hey {{recipient_username}}! New link: https://example.com/spring",
],
],
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY",
"Content-Type: application/json",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"status": "success",
"id": "auto_9xKp2Lm4nQ"
}
{
"action": "request",
"status": "error",
"code": 473,
"message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction",
"details": {
"formErrors": ["Unrecognized key: \"platform\""],
"fieldErrors": {}
}
}
{
"action": "automation",
"status": "error",
"code": 469,
"message": "Automation not found"
}
{
"action": "automation",
"status": "error",
"code": 470,
"message": "Active automation limit reached for your plan tier"
}
Beta. Повний опис функціональності див. в Огляді Automations.
platform, accountId) відхиляється як помилка валідації.
Надсилання triggers або actions замінює наявні дочірні елементи атомарно: стара множина видаляється, а нова записується в межах однієї транзакції Firestore. Щоб змінити лише один тригер, надішліть повний новий масив.
Повторна активація раніше неактивної автоматизації (active: true) виконує повторну перевірку ліміту активних. Якщо ліміт уже досягнуто, оновлення завершується помилкою з кодом 470, і жодні зміни не вносяться.
Параметри заголовка
Параметри шляху
ID автоматизації, повернений з
POST /automations.Параметри тіла
Нова назва.
Новий опис.
Увімкнути або вимкнути автоматизацію. Зміна з
false на true виконує повторну перевірку ліміту активних автоматизацій.Повна заміна набору тригерів (1–50). Той самий формат, що й в ендпоінті створення.
Повна заміна набору дій (1–50). Той самий формат, що й в ендпоінті створення.
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "Spring promo (updated)",
"active": true,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring"
}
]
}' \
-X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";
fetch(`https://api.ayrshare.com/api/automations/${id}`, {
method: "PUT",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Spring promo (updated)",
active: true,
actions: [
{
type: "send_dm",
message: "Hey {{recipient_username}}! New link: https://example.com/spring",
},
],
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
"Authorization": "Bearer API_KEY",
"Content-Type": "application/json",
}
automation_id = "auto_9xKp2Lm4nQ"
payload = {
"name": "Spring promo (updated)",
"active": True,
"actions": [
{
"type": "send_dm",
"message": "Hey {{recipient_username}}! New link: https://example.com/spring",
}
],
}
r = requests.put(
f"https://api.ayrshare.com/api/automations/{automation_id}",
json=payload,
headers=headers,
)
print(r.json())
$id = "auto_9xKp2Lm4nQ";
$data = [
"name" => "Spring promo (updated)",
"active" => true,
"actions" => [
[
"type" => "send_dm",
"message" => "Hey {{recipient_username}}! New link: https://example.com/spring",
],
],
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY",
"Content-Type: application/json",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"status": "success",
"id": "auto_9xKp2Lm4nQ"
}
{
"action": "request",
"status": "error",
"code": 473,
"message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction",
"details": {
"formErrors": ["Unrecognized key: \"platform\""],
"fieldErrors": {}
}
}
{
"action": "automation",
"status": "error",
"code": 469,
"message": "Automation not found"
}
{
"action": "automation",
"status": "error",
"code": 470,
"message": "Active automation limit reached for your plan tier"
}
⌘I
