Skip to content
Go to Micro

Replace a triggered automation (idempotent full write of the whole tree)

triggered_automations.update(strautomation_id, TriggeredAutomationUpdateParams**kwargs) -> TriggeredAutomation
PUT/v2/prism/{teamId}/{automationObjectType}/triggered_automations/{automationId}

Replace a triggered automation (idempotent full write of the whole tree)

ParametersExpand Collapse
team_id: Optional[str]
formatuuid
automation_object_type: Literal["message", "action", "event", 6 more]

Object types that support triggered automations. Must match the triggered-automation whitelist in @micro/database migrate-sql (TRIGGERED_AUTOMATION_OBJECTS).

One of the following:
"message"
"action"
"event"
"document"
"identity"
"linkedin_message"
"deal"
"organization"
"contact"
automation_id: str
formatuuid
kind: Literal["update", "lifecycle"]
One of the following:
"update"
"lifecycle"
name: str
id: Optional[str]
formatuuid
actions: Optional[Iterable[Action]]

Actions to run when the automation fires; each item has a type plus type-specific fields.

type: Literal["agent", "webhook", "wait", 2 more]
One of the following:
"agent"
"webhook"
"wait"
"email"
"linkedin"
agent_id: Optional[str]

Required when type is agent. The agent to run.

formatuuid
cron_expression: Optional[str]

wait: cron schedule for the resume time. Exactly one of delay_seconds or cron_expression.

delay_seconds: Optional[int]

wait: relative delay in seconds. Exactly one of delay_seconds or cron_expression.

recipient_email_prop_def_id: Optional[str]

Required when type is email. The property (on the recipient view object) holding the recipient email address.

formatuuid
recipient_provider_prop_def_id: Optional[str]

Required when type is linkedin. The property (on the recipient view object) holding the recipient LinkedIn provider id.

formatuuid
recipient_view_id: Optional[str]

Required when type is email or linkedin. The saved prism view resolved at send time to the recipient audience (its filter re-runs each step, so responders drop out of later drip sends).

formatuuid
recipient_view_object_type: Optional[str]

Required when type is email or linkedin. Must be contact — the recipient audience is a contact view (contacts carry the direct email / linkedin provider property).

send_as_user_id: Optional[str]

Required when type is email or linkedin. The user (external id) the message is sent as.

subject: Optional[str]

Required when type is email. The subject line; rendered as a Liquid template per recipient.

template_id: Optional[str]

Required when type is email or linkedin. The email-template document whose body is rendered (Liquid) per recipient.

formatuuid
timezone: Optional[str]

wait: IANA timezone for evaluating cron_expression (optional).

webhook_id: Optional[str]

Required when type is webhook. The id of the webhook the event is dispatched to (async) when the automation fires.

formatuuid
changeset: Optional[Changeset]

A changeset filter group (update automations only): a combinator plus an array of transition clauses matching what is changing. Dot-paths (nested reference filters) are NOT permitted — direct properties only.

combinator: Optional[Literal["AND", "OR"]]
One of the following:
"AND"
"OR"
filter: Optional[Iterable[Dict[str, object]]]

Each entry is a transition clause { slug: { from?: { comparator: value }, to?: { comparator: value } } }. from matches the prior value, to the new value; an empty body { slug: {} } matches any change to that property.

created_at: Optional[str]
enabled: Optional[bool]
list_id: Optional[str]
formatuuid
on_create: Optional[bool]

Lifecycle automations only.

on_delete: Optional[bool]

Lifecycle automations only.

state: Optional[State]

A filter group: a combinator plus an array of slug-based clauses. Dot-paths (e.g. organization.location) express nested reference filters.

combinator: Optional[Literal["AND", "OR"]]
One of the following:
"AND"
"OR"
filter: Optional[Iterable[Dict[str, object]]]

Each entry is { slug: { comparator: value } }

team_id: Optional[str]
formatuuid
updated_at: Optional[str]
user_id: Optional[str]
idempotency_key: Optional[str]
minLength1
maxLength255
ReturnsExpand Collapse
class TriggeredAutomation:

A triggered automation. kind selects the shape: update fires on object updates and requires a changeset (from/to transition) filter plus an optional state precondition; lifecycle fires on create and/or delete (on_create/on_delete) and requires a state filter (no changeset). state permits dot-paths (nested reference filters); changeset is direct properties only. Object type is taken from the path.

kind: Literal["update", "lifecycle"]
One of the following:
"update"
"lifecycle"
name: str
id: Optional[str]
formatuuid
actions: Optional[List[Action]]

Actions to run when the automation fires; each item has a type plus type-specific fields.

type: Literal["agent", "webhook", "wait", 2 more]
One of the following:
"agent"
"webhook"
"wait"
"email"
"linkedin"
agent_id: Optional[str]

Required when type is agent. The agent to run.

formatuuid
cron_expression: Optional[str]

wait: cron schedule for the resume time. Exactly one of delay_seconds or cron_expression.

delay_seconds: Optional[int]

wait: relative delay in seconds. Exactly one of delay_seconds or cron_expression.

recipient_email_prop_def_id: Optional[str]

Required when type is email. The property (on the recipient view object) holding the recipient email address.

formatuuid
recipient_provider_prop_def_id: Optional[str]

Required when type is linkedin. The property (on the recipient view object) holding the recipient LinkedIn provider id.

formatuuid
recipient_view_id: Optional[str]

Required when type is email or linkedin. The saved prism view resolved at send time to the recipient audience (its filter re-runs each step, so responders drop out of later drip sends).

formatuuid
recipient_view_object_type: Optional[str]

Required when type is email or linkedin. Must be contact — the recipient audience is a contact view (contacts carry the direct email / linkedin provider property).

send_as_user_id: Optional[str]

Required when type is email or linkedin. The user (external id) the message is sent as.

subject: Optional[str]

Required when type is email. The subject line; rendered as a Liquid template per recipient.

template_id: Optional[str]

Required when type is email or linkedin. The email-template document whose body is rendered (Liquid) per recipient.

formatuuid
timezone: Optional[str]

wait: IANA timezone for evaluating cron_expression (optional).

webhook_id: Optional[str]

Required when type is webhook. The id of the webhook the event is dispatched to (async) when the automation fires.

formatuuid
changeset: Optional[Changeset]

A changeset filter group (update automations only): a combinator plus an array of transition clauses matching what is changing. Dot-paths (nested reference filters) are NOT permitted — direct properties only.

combinator: Optional[Literal["AND", "OR"]]
One of the following:
"AND"
"OR"
filter: Optional[List[Dict[str, object]]]

Each entry is a transition clause { slug: { from?: { comparator: value }, to?: { comparator: value } } }. from matches the prior value, to the new value; an empty body { slug: {} } matches any change to that property.

created_at: Optional[str]
enabled: Optional[bool]
list_id: Optional[str]
formatuuid
on_create: Optional[bool]

Lifecycle automations only.

on_delete: Optional[bool]

Lifecycle automations only.

state: Optional[State]

A filter group: a combinator plus an array of slug-based clauses. Dot-paths (e.g. organization.location) express nested reference filters.

combinator: Optional[Literal["AND", "OR"]]
One of the following:
"AND"
"OR"
filter: Optional[List[Dict[str, object]]]

Each entry is { slug: { comparator: value } }

team_id: Optional[str]
formatuuid
updated_at: Optional[str]
user_id: Optional[str]

Replace a triggered automation (idempotent full write of the whole tree)

import os
from micro_so import Micro

client = Micro(
    api_key=os.environ.get("MICRO_API_KEY"),  # This is the default and can be omitted
)
triggered_automation = client.triggered_automations.update(
    automation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    automation_object_type="message",
    kind="update",
    name="name",
)
print(triggered_automation.id)
{
  "kind": "update",
  "name": "name",
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "actions": [
    {
      "type": "agent",
      "agent_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "cron_expression": "cron_expression",
      "delay_seconds": 0,
      "recipient_email_prop_def_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "recipient_provider_prop_def_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "recipient_view_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "recipient_view_object_type": "recipient_view_object_type",
      "send_as_user_id": "send_as_user_id",
      "subject": "subject",
      "template_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "timezone": "timezone",
      "webhook_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    }
  ],
  "changeset": {
    "combinator": "AND",
    "filter": [
      {
        "foo": "bar"
      }
    ]
  },
  "created_at": "created_at",
  "enabled": true,
  "list_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "on_create": true,
  "on_delete": true,
  "state": {
    "combinator": "AND",
    "filter": [
      {
        "foo": "bar"
      }
    ]
  },
  "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "updated_at": "updated_at",
  "user_id": "user_id"
}
Returns Examples
{
  "kind": "update",
  "name": "name",
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "actions": [
    {
      "type": "agent",
      "agent_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "cron_expression": "cron_expression",
      "delay_seconds": 0,
      "recipient_email_prop_def_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "recipient_provider_prop_def_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "recipient_view_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "recipient_view_object_type": "recipient_view_object_type",
      "send_as_user_id": "send_as_user_id",
      "subject": "subject",
      "template_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "timezone": "timezone",
      "webhook_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    }
  ],
  "changeset": {
    "combinator": "AND",
    "filter": [
      {
        "foo": "bar"
      }
    ]
  },
  "created_at": "created_at",
  "enabled": true,
  "list_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "on_create": true,
  "on_delete": true,
  "state": {
    "combinator": "AND",
    "filter": [
      {
        "foo": "bar"
      }
    ]
  },
  "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "updated_at": "updated_at",
  "user_id": "user_id"
}