Skip to Content
sesameSend

Automations

Create and manage Automations

Retrieve a list of automations

GET /automations

Query parameters

NameTypeRequiredDescription
status"enabled" | "disabled"noFilter automations by status.
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/automations" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "string",
      "name": "string",
      "status": "enabled",
      "created_at": "2023-10-06 23:47:56.678+00",
      "updated_at": "2023-10-06 23:47:56.678+00"
    }
  ]
}

Create an automation

POST /automations

Body

FieldTypeRequiredDescription
namestringyesThe name of the automation.
status"enabled" | "disabled"noThe initial status of the automation. Defaults to disabled.
stepsobject[]yesThe steps that compose the automation workflow. Must include at least one trigger step.
steps[].keystringyesA unique key for this step within the automation graph.
steps[].type"trigger" | "send_email" | "delay" | "wait_for_event" | "condition" | "contact_update" | "contact_delete" | "add_to_segment"yesThe type of automation step.
steps[].configobjectyesConfiguration for the step. Shape depends on type: - trigger: { event_name: string } - send_email: { template: { id: string, variables?: object }, subject?: string, from?: string, reply_to?: string } - delay: { duration: string } — a human-readable duration (e.g. "30 minutes") - wait_for_event: { event_name: string, timeout?: string, filter_rule?: object } — timeout is a human-readable duration (e.g. "1 hour") - condition: A rule tree with type (rule, and, or), field, operator, and value - contact_update: { first_name?: string|object, last_name?: string|object, unsubscribed?: boolean|object, properties?: object } - contact_delete: {} - add_to_segment: { segment_id: string }
connectionsobject[]yesThe connections between steps in the automation graph.
connections[].fromstringyesThe key of the source step.
connections[].tostringyesThe key of the target step.
connections[].type"default" | "condition_met" | "condition_not_met" | "timeout" | "event_received"noThe type of connection. Defaults to default.

Example

curl -X POST "$SESAMESEND_URL/automations" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "steps": [
    {
      "key": "string",
      "type": "trigger",
      "config": {}
    }
  ],
  "connections": [
    {
      "from": "string",
      "to": "string"
    }
  ]
}'

Responses

StatusDescription
201OK
{
  "object": "automation",
  "id": "string"
}

Retrieve a single automation

GET /automations/{automation_id}

Path parameters

NameTypeRequiredDescription
automation_idstringyesThe ID of the automation.

Example

curl -X GET "$SESAMESEND_URL/automations/<automation_id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "automation",
  "id": "string",
  "name": "string",
  "status": "enabled",
  "created_at": "2023-10-06 23:47:56.678+00",
  "updated_at": "2023-10-06 23:47:56.678+00",
  "steps": [
    {
      "key": "string",
      "type": "trigger",
      "config": {}
    }
  ],
  "connections": [
    {
      "from": "string",
      "to": "string",
      "type": "default"
    }
  ]
}

Update an automation

PATCH /automations/{automation_id}

Path parameters

NameTypeRequiredDescription
automation_idstringyesThe ID of the automation.

Body

FieldTypeRequiredDescription
namestringnoThe name of the automation.
status"enabled" | "disabled"noThe status of the automation.
stepsobject[]noThe steps that compose the automation workflow. Must be provided together with connections.
steps[].keystringyesA unique key for this step within the automation graph.
steps[].type"trigger" | "send_email" | "delay" | "wait_for_event" | "condition" | "contact_update" | "contact_delete" | "add_to_segment"yesThe type of automation step.
steps[].configobjectyesConfiguration for the step. Shape depends on type: - trigger: { event_name: string } - send_email: { template: { id: string, variables?: object }, subject?: string, from?: string, reply_to?: string } - delay: { duration: string } — a human-readable duration (e.g. "30 minutes") - wait_for_event: { event_name: string, timeout?: string, filter_rule?: object } — timeout is a human-readable duration (e.g. "1 hour") - condition: A rule tree with type (rule, and, or), field, operator, and value - contact_update: { first_name?: string|object, last_name?: string|object, unsubscribed?: boolean|object, properties?: object } - contact_delete: {} - add_to_segment: { segment_id: string }
connectionsobject[]noThe connections between steps in the automation graph. Must be provided together with steps.
connections[].fromstringyesThe key of the source step.
connections[].tostringyesThe key of the target step.
connections[].type"default" | "condition_met" | "condition_not_met" | "timeout" | "event_received"noThe type of connection. Defaults to default.

Example

curl -X PATCH "$SESAMESEND_URL/automations/<automation_id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Responses

StatusDescription
200OK
{
  "object": "automation",
  "id": "string"
}

Delete an automation

DELETE /automations/{automation_id}

Path parameters

NameTypeRequiredDescription
automation_idstringyesThe ID of the automation.

Example

curl -X DELETE "$SESAMESEND_URL/automations/<automation_id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "automation",
  "id": "string",
  "deleted": true
}

Duplicate an automation

POST /automations/{automation_id}/duplicate

Path parameters

NameTypeRequiredDescription
automation_idstringyesThe ID of the automation.

Example

curl -X POST "$SESAMESEND_URL/automations/<automation_id>/duplicate" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
201OK
{
  "object": "automation",
  "id": "string"
}

Stop an automation

POST /automations/{automation_id}/stop

Path parameters

NameTypeRequiredDescription
automation_idstringyesThe ID of the automation.

Example

curl -X POST "$SESAMESEND_URL/automations/<automation_id>/stop" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "automation",
  "id": "string",
  "status": "disabled"
}

Retrieve a list of automation runs

GET /automations/{automation_id}/runs

Path parameters

NameTypeRequiredDescription
automation_idstringyesThe ID of the automation.

Query parameters

NameTypeRequiredDescription
statusstringnoFilter runs by status. Comma-separated list of: running, completed, failed, cancelled.
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/automations/<automation_id>/runs" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "string",
      "status": "running",
      "started_at": "2023-10-06 23:47:56.678+00",
      "completed_at": "2023-10-06 23:47:56.678+00",
      "created_at": "2023-10-06 23:47:56.678+00"
    }
  ]
}

Retrieve a single automation run

GET /automations/{automation_id}/runs/{run_id}

Path parameters

NameTypeRequiredDescription
automation_idstringyesThe ID of the automation.
run_idstringyesThe ID of the automation run.

Example

curl -X GET "$SESAMESEND_URL/automations/<automation_id>/runs/<run_id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "automation_run",
  "id": "string",
  "status": "running",
  "started_at": "2023-10-06 23:47:56.678+00",
  "completed_at": "2023-10-06 23:47:56.678+00",
  "created_at": "2023-10-06 23:47:56.678+00",
  "steps": [
    {
      "key": "string",
      "type": "trigger",
      "status": "string",
      "started_at": "2023-10-06 23:47:56.678+00",
      "completed_at": "2023-10-06 23:47:56.678+00",
      "output": null,
      "error": null,
      "created_at": "2023-10-06 23:47:56.678+00"
    }
  ]
}