curl --request POST \
--url https://api.social-api.ai/v1/automations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"name": "Send the link",
"trigger": "comment",
"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: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'acc_01HZ9X3Q4R5M6N7P8V2K0W1J',
name: 'Send the link',
trigger: 'comment',
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', 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"
payload = {
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"name": "Send the link",
"trigger": "comment",
"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.post(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"
}{
"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"
}Create an Automation
Creates an Automation on an Instagram or Facebook account. When a comment or DM on the account matches its filters, its actions are carried out within seconds, with no code on your side. Each action costs what the same API call costs: reply_comment and send_dm cost 1 credit, private_reply and hide_comment are free. The first step’s actions depend on the trigger: a comment trigger allows hide_comment, reply_comment and private_reply; a dm trigger allows send_dm. Steps after start run when the person taps one of your postback buttons, and may only send DMs. An account holds at most 50 Automations. Comments and messages sent by the account itself never trigger it; on Facebook that is the Page, so a Page admin commenting from their personal profile does trigger it. A dm Automation answers the same person at most 5 times an hour. Besides automations:write, a scoped key needs the scope each action’s own API call needs: inbox:write for hide_comment, reply_comment and private_reply, dms:send for send_dm. Send follow_gate instead of steps to build a Follow gate: the commenter gets a private reply with a button, and a tap sends the link if they follow the account, otherwise a follow-first message with a button to try again. Instagram only.
curl --request POST \
--url https://api.social-api.ai/v1/automations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"name": "Send the link",
"trigger": "comment",
"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: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'acc_01HZ9X3Q4R5M6N7P8V2K0W1J',
name: 'Send the link',
trigger: 'comment',
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', 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"
payload = {
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"name": "Send the link",
"trigger": "comment",
"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.post(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"
}{
"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
Automation definition
Response
Created