Update an Automation
curl --request PATCH \
--url https://api.social-api.ai/v1/automations/{automation_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"once_per_person": true,
"post_ids": [
"<string>"
],
"steps": [
{
"actions": [
{
"type": "private_reply"
}
],
"key": "start",
"buttons": [
{
"title": "Open",
"type": "url",
"next_step": "check",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"type": "keyword"
}
]
}
]
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
once_per_person: true,
post_ids: ['<string>'],
steps: [
{
actions: [{type: 'private_reply'}],
key: 'start',
buttons: [{title: 'Open', type: 'url', next_step: 'check', url: 'https://example.com'}],
fallthrough_step: '<string>',
filters: [{type: 'keyword'}]
}
]
})
};
fetch('https://api.social-api.ai/v1/automations/{automation_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.social-api.ai/v1/automations/{automation_id}"
payload = {
"name": "<string>",
"once_per_person": True,
"post_ids": ["<string>"],
"steps": [
{
"actions": [{ "type": "private_reply" }],
"key": "start",
"buttons": [
{
"title": "Open",
"type": "url",
"next_step": "check",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [{ "type": "keyword" }]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"created_at": "2023-11-07T05:31:56Z",
"failed_count": 123,
"fired_count": 123,
"id": "aut_01J9Z8Y7X6W5V4T3S2R1Q0P9N8",
"name": "Send the link",
"once_per_person": true,
"sent_count": 123,
"status": "active",
"steps": [
{
"actions": [
{
"type": "private_reply",
"private_reply": {
"texts": [
"Here is the link: https://example.com"
]
},
"reply_comment": {
"texts": [
"Here is the link: https://example.com"
]
},
"send_dm": {
"texts": [
"Here is the link: https://example.com"
]
}
}
],
"key": "start",
"buttons": [
{
"title": "Open",
"type": "url",
"next_step": "check",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"type": "keyword",
"keyword": {
"keywords": [
"link",
"price"
],
"match": "contains"
}
}
]
}
],
"trigger": "comment",
"updated_at": "2023-11-07T05:31:56Z",
"post_ids": [
"<string>"
]
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}Automations
Update an Automation
Updates the fields you send and keeps the rest. Set status to paused to stop the Automation and to active to resume it. steps replaces the whole list. Changed steps or post_ids must meet the same rules as creation. Renaming or pausing needs only automations:write; resuming, or changing steps, post_ids or once_per_person, also needs each action’s own scope.
PATCH
/
automations
/
{automation_id}
Update an Automation
curl --request PATCH \
--url https://api.social-api.ai/v1/automations/{automation_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"once_per_person": true,
"post_ids": [
"<string>"
],
"steps": [
{
"actions": [
{
"type": "private_reply"
}
],
"key": "start",
"buttons": [
{
"title": "Open",
"type": "url",
"next_step": "check",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"type": "keyword"
}
]
}
]
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
once_per_person: true,
post_ids: ['<string>'],
steps: [
{
actions: [{type: 'private_reply'}],
key: 'start',
buttons: [{title: 'Open', type: 'url', next_step: 'check', url: 'https://example.com'}],
fallthrough_step: '<string>',
filters: [{type: 'keyword'}]
}
]
})
};
fetch('https://api.social-api.ai/v1/automations/{automation_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.social-api.ai/v1/automations/{automation_id}"
payload = {
"name": "<string>",
"once_per_person": True,
"post_ids": ["<string>"],
"steps": [
{
"actions": [{ "type": "private_reply" }],
"key": "start",
"buttons": [
{
"title": "Open",
"type": "url",
"next_step": "check",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [{ "type": "keyword" }]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"created_at": "2023-11-07T05:31:56Z",
"failed_count": 123,
"fired_count": 123,
"id": "aut_01J9Z8Y7X6W5V4T3S2R1Q0P9N8",
"name": "Send the link",
"once_per_person": true,
"sent_count": 123,
"status": "active",
"steps": [
{
"actions": [
{
"type": "private_reply",
"private_reply": {
"texts": [
"Here is the link: https://example.com"
]
},
"reply_comment": {
"texts": [
"Here is the link: https://example.com"
]
},
"send_dm": {
"texts": [
"Here is the link: https://example.com"
]
}
}
],
"key": "start",
"buttons": [
{
"title": "Open",
"type": "url",
"next_step": "check",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"type": "keyword",
"keyword": {
"keywords": [
"link",
"price"
],
"match": "contains"
}
}
]
}
],
"trigger": "comment",
"updated_at": "2023-11-07T05:31:56Z",
"post_ids": [
"<string>"
]
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
},
"request_id": "01HZ9X3Q4R5M6N7P8V2K0W1J"
}Authorizations
Body
application/json
Fields to change
Response
OK