POST /automations
The workflow and version 1 of its graph, in one call.
Body
| Field | Type | Description |
|---|---|---|
name* | string | A name for the dashboard. |
status | string | enabled or disabled. Defaults to disabled, so nothing enrols yet. |
steps* | object[] | The steps of the workflow, at most 150. Each is { key, type, config } with a key unique within the graph. Exactly one step must be a trigger. |
connections* | object[] | The edges between steps: { from, to, type }, where from and to are step keys and type is default, condition_met or condition_not_met. Omitting type means default. |
curl -X POST "https://api.rasket.com/automations" \
-H "Authorization: Bearer $RASKET_API_KEY" \
-H "User-Agent: acme-billing/1.0" \
-H "Content-Type: application/json" \
-d '{
"name": "Trial nudge",
"status": "disabled",
"steps": [
{
"key": "start",
"type": "trigger",
"config": {
"event_name": "trial.started"
}
},
{
"key": "welcome",
"type": "send_email",
"config": {
"template": {
"id": "0199d2f1-4c4e-7a20-9c31-6f2b8a0e5e05",
"variables": {
"plan": "pro"
}
}
}
},
{
"key": "wait",
"type": "delay",
"config": {
"duration": "3 days"
}
},
{
"key": "check",
"type": "condition",
"config": {
"type": "rule",
"field": "properties.activated",
"operator": "eq",
"value": true
}
},
{
"key": "tag",
"type": "contact_update",
"config": {
"properties": {
"lifecycle": "activated"
}
}
},
{
"key": "onboard",
"type": "add_to_segment",
"config": {
"segment_id": "0199d2f1-4c4e-7a20-9c31-6f2b8a0e5e04"
}
}
],
"connections": [
{
"from": "start",
"to": "welcome"
},
{
"from": "welcome",
"to": "wait"
},
{
"from": "wait",
"to": "check"
},
{
"from": "check",
"to": "tag",
"type": "condition_met"
},
{
"from": "check",
"to": "onboard",
"type": "condition_not_met"
}
]
}'const response = await fetch("https://api.rasket.com/automations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RASKET_API_KEY}`,
"User-Agent": "acme-billing/1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Trial nudge",
status: "disabled",
steps: [
{
key: "start",
type: "trigger",
config: {
event_name: "trial.started"
}
},
{
key: "welcome",
type: "send_email",
config: {
template: {
id: "0199d2f1-4c4e-7a20-9c31-6f2b8a0e5e05",
variables: {
plan: "pro"
}
}
}
},
{
key: "wait",
type: "delay",
config: {
duration: "3 days"
}
},
{
key: "check",
type: "condition",
config: {
type: "rule",
field: "properties.activated",
operator: "eq",
value: true
}
},
{
key: "tag",
type: "contact_update",
config: {
properties: {
lifecycle: "activated"
}
}
},
{
key: "onboard",
type: "add_to_segment",
config: {
segment_id: "0199d2f1-4c4e-7a20-9c31-6f2b8a0e5e04"
}
}
],
connections: [
{
from: "start",
to: "welcome"
},
{
from: "welcome",
to: "wait"
},
{
from: "wait",
to: "check"
},
{
from: "check",
to: "tag",
type: "condition_met"
},
{
from: "check",
to: "onboard",
type: "condition_not_met"
}
]
}),
});
const { id } = await response.json();import os
import requests
response = requests.post(
"https://api.rasket.com/automations",
headers={
"Authorization": f"Bearer {os.environ['RASKET_API_KEY']}",
"User-Agent": "acme-billing/1.0",
},
json={
"name": "Trial nudge",
"status": "disabled",
"steps": [
{
"key": "start",
"type": "trigger",
"config": {
"event_name": "trial.started"
}
},
{
"key": "welcome",
"type": "send_email",
"config": {
"template": {
"id": "0199d2f1-4c4e-7a20-9c31-6f2b8a0e5e05",
"variables": {
"plan": "pro"
}
}
}
},
{
"key": "wait",
"type": "delay",
"config": {
"duration": "3 days"
}
},
{
"key": "check",
"type": "condition",
"config": {
"type": "rule",
"field": "properties.activated",
"operator": "eq",
"value": True
}
},
{
"key": "tag",
"type": "contact_update",
"config": {
"properties": {
"lifecycle": "activated"
}
}
},
{
"key": "onboard",
"type": "add_to_segment",
"config": {
"segment_id": "0199d2f1-4c4e-7a20-9c31-6f2b8a0e5e04"
}
}
],
"connections": [
{
"from": "start",
"to": "welcome"
},
{
"from": "welcome",
"to": "wait"
},
{
"from": "wait",
"to": "check"
},
{
"from": "check",
"to": "tag",
"type": "condition_met"
},
{
"from": "check",
"to": "onboard",
"type": "condition_not_met"
}
]
},
)
id = response.json()["id"]Response 201
{
"object": "automation",
"id": "0199d2f1-4c4e-7a20-9c31-6f2b8a0e5e01"
}- The whole graph is validated at once. A failure is
422 validation_errorwith one entry inerrors[]per offending step key, not the first problem found. - Every template, segment, topic, contact property and custom event the graph names must already exist in your team.
wait_for_eventandcontact_deleteare parsed and refused in this release: a graph naming either is422 validation_error.