curl --request POST \
--url https://api.1club.ai/v1/platform/automations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"steps": [
{
"clientId": "<string>",
"position": 1,
"config": {},
"parentClientId": "<string>"
}
],
"description": "<string>",
"triggerConfig": {},
"entryCondition": {},
"exitWhenConditionFails": true,
"goal": {
"events": [
{
"config": {}
}
],
"windowDays": 1
},
"exitEvents": [
{
"config": {}
}
],
"defaultChannels": []
}
'import requests
url = "https://api.1club.ai/v1/platform/automations"
payload = {
"name": "<string>",
"steps": [
{
"clientId": "<string>",
"position": 1,
"config": {},
"parentClientId": "<string>"
}
],
"description": "<string>",
"triggerConfig": {},
"entryCondition": {},
"exitWhenConditionFails": True,
"goal": {
"events": [{ "config": {} }],
"windowDays": 1
},
"exitEvents": [{ "config": {} }],
"defaultChannels": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
steps: [{clientId: '<string>', position: 1, config: {}, parentClientId: '<string>'}],
description: '<string>',
triggerConfig: {},
entryCondition: {},
exitWhenConditionFails: true,
goal: {events: [{config: {}}], windowDays: 1},
exitEvents: [{config: {}}],
defaultChannels: []
})
};
fetch('https://api.1club.ai/v1/platform/automations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.1club.ai/v1/platform/automations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'steps' => [
[
'clientId' => '<string>',
'position' => 1,
'config' => [
],
'parentClientId' => '<string>'
]
],
'description' => '<string>',
'triggerConfig' => [
],
'entryCondition' => [
],
'exitWhenConditionFails' => true,
'goal' => [
'events' => [
[
'config' => [
]
]
],
'windowDays' => 1
],
'exitEvents' => [
[
'config' => [
]
]
],
'defaultChannels' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.1club.ai/v1/platform/automations"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"clientId\": \"<string>\",\n \"position\": 1,\n \"config\": {},\n \"parentClientId\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"triggerConfig\": {},\n \"entryCondition\": {},\n \"exitWhenConditionFails\": true,\n \"goal\": {\n \"events\": [\n {\n \"config\": {}\n }\n ],\n \"windowDays\": 1\n },\n \"exitEvents\": [\n {\n \"config\": {}\n }\n ],\n \"defaultChannels\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.1club.ai/v1/platform/automations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"clientId\": \"<string>\",\n \"position\": 1,\n \"config\": {},\n \"parentClientId\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"triggerConfig\": {},\n \"entryCondition\": {},\n \"exitWhenConditionFails\": true,\n \"goal\": {\n \"events\": [\n {\n \"config\": {}\n }\n ],\n \"windowDays\": 1\n },\n \"exitEvents\": [\n {\n \"config\": {}\n }\n ],\n \"defaultChannels\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.1club.ai/v1/platform/automations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"clientId\": \"<string>\",\n \"position\": 1,\n \"config\": {},\n \"parentClientId\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"triggerConfig\": {},\n \"entryCondition\": {},\n \"exitWhenConditionFails\": true,\n \"goal\": {\n \"events\": [\n {\n \"config\": {}\n }\n ],\n \"windowDays\": 1\n },\n \"exitEvents\": [\n {\n \"config\": {}\n }\n ],\n \"defaultChannels\": []\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"description": "<string>",
"category": "SYSTEM",
"systemKey": "<string>",
"triggerType": "<string>",
"triggerConfig": {},
"isActive": true,
"lastTriggeredAt": "2023-11-07T05:31:56Z",
"entryCondition": {},
"goal": {},
"exitEvents": [
{}
],
"steps": [
{
"id": 123,
"stepType": "<string>",
"position": 123,
"parentStepId": 123,
"branchKey": "<string>",
"config": {}
}
]
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Create an automation
Adds a custom automation: a triggerType (with triggerConfig to narrow it) and its steps. It is always created off, whatever is sent: a member of staff reads it in the automation builder and switches it on there, since from then on it messages members by itself.
The steps form the chain a run follows. Each has a clientId of your choosing and names the step before it in parentClientId: exactly one step has none and comes first, and every step has at most one next step. Only a condition has two, one on each branch, marked branchKey yes or no. A tree the run could not follow to every step is refused with a 400 naming the step.
Each step’s config must carry what its type needs (see PlatformAutomationCreate): a message’s content is written inline as Editor.js blocks, never a template reference. A step may not read what the trigger lacks: membership_ends_within and a wait from membership_end need a membership trigger, booking_attended and a wait from booking_start or booking_end a booking trigger or the yes branch of a has_booking condition before it. triggerType is one the automation builder offers, and a goal or stop event is something the contact does, never a date coming round.
Read an existing automation for worked examples of each step’s config, and list the variables a message may use under its trigger first. Needs the Grow plan. Supports the Idempotency-Key header.
curl --request POST \
--url https://api.1club.ai/v1/platform/automations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"steps": [
{
"clientId": "<string>",
"position": 1,
"config": {},
"parentClientId": "<string>"
}
],
"description": "<string>",
"triggerConfig": {},
"entryCondition": {},
"exitWhenConditionFails": true,
"goal": {
"events": [
{
"config": {}
}
],
"windowDays": 1
},
"exitEvents": [
{
"config": {}
}
],
"defaultChannels": []
}
'import requests
url = "https://api.1club.ai/v1/platform/automations"
payload = {
"name": "<string>",
"steps": [
{
"clientId": "<string>",
"position": 1,
"config": {},
"parentClientId": "<string>"
}
],
"description": "<string>",
"triggerConfig": {},
"entryCondition": {},
"exitWhenConditionFails": True,
"goal": {
"events": [{ "config": {} }],
"windowDays": 1
},
"exitEvents": [{ "config": {} }],
"defaultChannels": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
steps: [{clientId: '<string>', position: 1, config: {}, parentClientId: '<string>'}],
description: '<string>',
triggerConfig: {},
entryCondition: {},
exitWhenConditionFails: true,
goal: {events: [{config: {}}], windowDays: 1},
exitEvents: [{config: {}}],
defaultChannels: []
})
};
fetch('https://api.1club.ai/v1/platform/automations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.1club.ai/v1/platform/automations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'steps' => [
[
'clientId' => '<string>',
'position' => 1,
'config' => [
],
'parentClientId' => '<string>'
]
],
'description' => '<string>',
'triggerConfig' => [
],
'entryCondition' => [
],
'exitWhenConditionFails' => true,
'goal' => [
'events' => [
[
'config' => [
]
]
],
'windowDays' => 1
],
'exitEvents' => [
[
'config' => [
]
]
],
'defaultChannels' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.1club.ai/v1/platform/automations"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"clientId\": \"<string>\",\n \"position\": 1,\n \"config\": {},\n \"parentClientId\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"triggerConfig\": {},\n \"entryCondition\": {},\n \"exitWhenConditionFails\": true,\n \"goal\": {\n \"events\": [\n {\n \"config\": {}\n }\n ],\n \"windowDays\": 1\n },\n \"exitEvents\": [\n {\n \"config\": {}\n }\n ],\n \"defaultChannels\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.1club.ai/v1/platform/automations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"clientId\": \"<string>\",\n \"position\": 1,\n \"config\": {},\n \"parentClientId\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"triggerConfig\": {},\n \"entryCondition\": {},\n \"exitWhenConditionFails\": true,\n \"goal\": {\n \"events\": [\n {\n \"config\": {}\n }\n ],\n \"windowDays\": 1\n },\n \"exitEvents\": [\n {\n \"config\": {}\n }\n ],\n \"defaultChannels\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.1club.ai/v1/platform/automations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"steps\": [\n {\n \"clientId\": \"<string>\",\n \"position\": 1,\n \"config\": {},\n \"parentClientId\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"triggerConfig\": {},\n \"entryCondition\": {},\n \"exitWhenConditionFails\": true,\n \"goal\": {\n \"events\": [\n {\n \"config\": {}\n }\n ],\n \"windowDays\": 1\n },\n \"exitEvents\": [\n {\n \"config\": {}\n }\n ],\n \"defaultChannels\": []\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"description": "<string>",
"category": "SYSTEM",
"systemKey": "<string>",
"triggerType": "<string>",
"triggerConfig": {},
"isActive": true,
"lastTriggeredAt": "2023-11-07T05:31:56Z",
"entryCondition": {},
"goal": {},
"exitEvents": [
{}
],
"steps": [
{
"id": 123,
"stepType": "<string>",
"position": 123,
"parentStepId": 123,
"branchKey": "<string>",
"config": {}
}
]
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Authorizations
Headers
Body
What starts a run, e.g. booking.created or contact.type_changed: the triggers the automation builder offers
booking.created, booking.updated, booking.cancelled, booking.no_show, booking.checked_in, checkin.failed, booking.completed, visit.completed, booking.upcoming, payment.succeeded, payment.failed, saved_payment_method.attached, membership.created, membership.cancelled, membership.expiring, membership.renewal_upcoming, membership.paused, membership.resumed, membership.expired, message.received, review.submitted, contact.created, organization_user.activated, contact.type_changed, contact.pipeline_stage_changed, contact.birthday, progression.changed, assessment.recorded, tag.added, tag.removed Response
Automation created, off
An automation: something that happens on its own when its trigger fires.
Was this page helpful?