curl --request POST \
--url https://api.social-api.ai/v1/automations \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"follow_gate": {
"button_title": "Get the link",
"keywords": [
"link"
],
"link_texts": [
"Here you go: https://example.com"
],
"not_following_texts": [
"Follow us first and tap again"
],
"opening_texts": [
"Tap below to get the link"
],
"retry_button_title": "I followed"
},
"name": "Send the link",
"once_per_person": true,
"post_ids": [
"<string>"
],
"steps": [
{
"actions": [
{
"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"
]
},
"type": "private_reply"
}
],
"buttons": [
{
"next_step": "check",
"title": "Open",
"type": "url",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"keyword": {
"keywords": [
"link",
"price"
],
"match": "contains"
},
"type": "keyword"
}
],
"key": "start"
}
],
"trigger": "comment"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'acc_01HZ9X3Q4R5M6N7P8V2K0W1J',
follow_gate: {
button_title: 'Get the link',
keywords: ['link'],
link_texts: ['Here you go: https://example.com'],
not_following_texts: ['Follow us first and tap again'],
opening_texts: ['Tap below to get the link'],
retry_button_title: 'I followed'
},
name: 'Send the link',
once_per_person: true,
post_ids: ['<string>'],
steps: [
{
actions: [
{
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']},
type: 'private_reply'
}
],
buttons: [{next_step: 'check', title: 'Open', type: 'url', url: 'https://example.com'}],
fallthrough_step: '<string>',
filters: [{keyword: {keywords: ['link', 'price'], match: 'contains'}, type: 'keyword'}],
key: 'start'
}
],
trigger: 'comment'
})
};
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",
"follow_gate": {
"button_title": "Get the link",
"keywords": ["link"],
"link_texts": ["Here you go: https://example.com"],
"not_following_texts": ["Follow us first and tap again"],
"opening_texts": ["Tap below to get the link"],
"retry_button_title": "I followed"
},
"name": "Send the link",
"once_per_person": True,
"post_ids": ["<string>"],
"steps": [
{
"actions": [
{
"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"] },
"type": "private_reply"
}
],
"buttons": [
{
"next_step": "check",
"title": "Open",
"type": "url",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"keyword": {
"keywords": ["link", "price"],
"match": "contains"
},
"type": "keyword"
}
],
"key": "start"
}
],
"trigger": "comment"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"created_at": "<string>",
"failed_count": 123,
"fired_count": 123,
"id": "aut_01J9Z8Y7X6W5V4T3S2R1Q0P9N8",
"name": "Send the link",
"once_per_person": true,
"post_ids": [
"<string>"
],
"sent_count": 123,
"status": "active",
"steps": [
{
"actions": [
{
"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"
]
},
"type": "private_reply"
}
],
"buttons": [
{
"next_step": "check",
"title": "Open",
"type": "url",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"keyword": {
"keywords": [
"link",
"price"
],
"match": "contains"
},
"type": "keyword"
}
],
"key": "start"
}
],
"trigger": "comment",
"updated_at": "<string>"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}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: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"follow_gate": {
"button_title": "Get the link",
"keywords": [
"link"
],
"link_texts": [
"Here you go: https://example.com"
],
"not_following_texts": [
"Follow us first and tap again"
],
"opening_texts": [
"Tap below to get the link"
],
"retry_button_title": "I followed"
},
"name": "Send the link",
"once_per_person": true,
"post_ids": [
"<string>"
],
"steps": [
{
"actions": [
{
"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"
]
},
"type": "private_reply"
}
],
"buttons": [
{
"next_step": "check",
"title": "Open",
"type": "url",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"keyword": {
"keywords": [
"link",
"price"
],
"match": "contains"
},
"type": "keyword"
}
],
"key": "start"
}
],
"trigger": "comment"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_id: 'acc_01HZ9X3Q4R5M6N7P8V2K0W1J',
follow_gate: {
button_title: 'Get the link',
keywords: ['link'],
link_texts: ['Here you go: https://example.com'],
not_following_texts: ['Follow us first and tap again'],
opening_texts: ['Tap below to get the link'],
retry_button_title: 'I followed'
},
name: 'Send the link',
once_per_person: true,
post_ids: ['<string>'],
steps: [
{
actions: [
{
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']},
type: 'private_reply'
}
],
buttons: [{next_step: 'check', title: 'Open', type: 'url', url: 'https://example.com'}],
fallthrough_step: '<string>',
filters: [{keyword: {keywords: ['link', 'price'], match: 'contains'}, type: 'keyword'}],
key: 'start'
}
],
trigger: 'comment'
})
};
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",
"follow_gate": {
"button_title": "Get the link",
"keywords": ["link"],
"link_texts": ["Here you go: https://example.com"],
"not_following_texts": ["Follow us first and tap again"],
"opening_texts": ["Tap below to get the link"],
"retry_button_title": "I followed"
},
"name": "Send the link",
"once_per_person": True,
"post_ids": ["<string>"],
"steps": [
{
"actions": [
{
"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"] },
"type": "private_reply"
}
],
"buttons": [
{
"next_step": "check",
"title": "Open",
"type": "url",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"keyword": {
"keywords": ["link", "price"],
"match": "contains"
},
"type": "keyword"
}
],
"key": "start"
}
],
"trigger": "comment"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"account_id": "acc_01HZ9X3Q4R5M6N7P8V2K0W1J",
"created_at": "<string>",
"failed_count": 123,
"fired_count": 123,
"id": "aut_01J9Z8Y7X6W5V4T3S2R1Q0P9N8",
"name": "Send the link",
"once_per_person": true,
"post_ids": [
"<string>"
],
"sent_count": 123,
"status": "active",
"steps": [
{
"actions": [
{
"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"
]
},
"type": "private_reply"
}
],
"buttons": [
{
"next_step": "check",
"title": "Open",
"type": "url",
"url": "https://example.com"
}
],
"fallthrough_step": "<string>",
"filters": [
{
"keyword": {
"keywords": [
"link",
"price"
],
"match": "contains"
},
"type": "keyword"
}
],
"key": "start"
}
],
"trigger": "comment",
"updated_at": "<string>"
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}Authorizations
Prefix your API key with "Bearer ". Example: Authorization: Bearer sapi_key_...
Body
Automation definition
"acc_01HZ9X3Q4R5M6N7P8V2K0W1J"
Builds the three-step Follow gate. Instagram, comment trigger only. Send instead of steps
Show child attributes
Show child attributes
1 to 100 characters
"Send the link"
Reach each person at most once. A run in which every action failed does not count. Defaults to false
Up to 100 platform post ids, each 1 to 100 characters, a comment must be on. Omitted means every post. Comment trigger only
Show child attributes
Show child attributes
comment, dm "comment"
Response
Created
"acc_01HZ9X3Q4R5M6N7P8V2K0W1J"
Actions that failed
Events the Automation ran against
"aut_01J9Z8Y7X6W5V4T3S2R1Q0P9N8"
"Send the link"
Reach each person at most once. A run in which every action failed does not count
Up to 100 platform post ids, each 1 to 100 characters, a comment must be on. Omitted means every post. Comment trigger only
Actions carried out successfully
active, paused "active"
Up to 10 Steps forming a graph. One must have the key "start"
Show child attributes
Show child attributes
The kind of inbound event that fires the Automation
comment, dm "comment"