smartchat

Update automation

Changes name, trigger, steps or rules of an automation. Send only what changes; a list of steps replaces the whole list (keep the step ids). On an active automation this needs automations:run.

PATCH /v1/automations/{automation_id}

Permissionautomations:write (all permissions) Activating an automation, or changing a running one, also needs automations:run.
RiskWrite (no outside effect)
Idempotency-KeyOptional (how it works)
Safe to repeatSafe by nature. With the same Idempotency-Key the first answer comes back.
Rate limit classwrite (120 requests per minute per key)
ConfirmationNone
MCP toolsave_automation
Since version2026-10-25

#What it does

  • Changes data in your account. It does not send messages to contacts.
  • May start automations of the account, and an automation may send messages. The call itself sends nothing.
  • Setting it active lets messages go to contacts later. The call itself sends nothing.
  • Safe to repeat. With the same Idempotency-Key the first answer comes back.

#Request

Header

NameRequiredDescription
AuthorizationyesBearer <key>
Idempotency-KeynoA unique value for this operation, for example a UUID (1 to 255 visible ASCII characters).

Path parameters

NameTypeDescription
automation_idstringAutomation ID.

Body (JSON)

NameTypeRequiredDescription
namestringnoNew name. length 1 to 60
triggerobjectnoWhat starts the automation. See get_automation_catalog for the fields of each trigger type.
trigger.typestringyesKind of trigger. one of: signup, keyword, message_received, message_sent, link_clicked, tag_added, tag_removed, contact_created, contact_updated, status_changed, note_added, date, inactivity, purchase, inbound_webhook, api_call
trigger.keywordstringnokeyword: the word to react to. up to 40 characters
trigger.tagstringnotag_added: the tag. up to 60 characters
trigger.linkstringnolink_clicked: part of the link address (empty means any link). up to 200 characters
trigger.daysintegernoinactivity: days without activity. 1 to 365
trigger.run_atstringnodate: when to start, ISO 8601. up to 40 characters; format date-time
trigger.providerstringnopurchase: shopify or generic. one of: shopify, generic
trigger.filtersarray of objectnoinbound_webhook: only events where the field at 'path' equals 'equals' start the automation. up to 5 items
trigger.filters[].pathstringyesPath of the field in the event, for example values.status. up to 120 characters
trigger.filters[].equalsstringyesRequired value. up to 200 characters
trigger.alsoarray of objectnoFurther triggers: any of them starts the automation (OR). up to 5 items
trigger.also[].typestringyesKind of trigger. one of: signup, message_received, message_sent, link_clicked, tag_added, tag_removed, contact_created, contact_updated, status_changed, note_added
trigger.also[].tagstringnotag_added: the tag. up to 60 characters
trigger.also[].linkstringnolink_clicked: part of the link. up to 200 characters
stepsarray of objectnoThe flow after the trigger, in the order of execution. up to 30 items
steps[].typestringyesKind of step. See get_automation_catalog for the fields of each kind. one of: send_message, wait, add_tag, remove_tag, start_followup, send_webhook, condition, order_filter, split, app_action, contact_match
steps[].idstringnoID of the step. Keep it when you change a list of steps; new steps get one from the server. up to 64 characters
steps[].textstringnosend_message: the message text. Variables like {{name}} are allowed. up to 4096 characters
steps[].titlestringnosend_message: name of the message (3 to 40 characters, unique in the automation). up to 40 characters
steps[].buttonobjectnosend_message: one button.
steps[].button.typestringyesquick_reply sends a reply back (up to 25 characters), url opens a link (up to 40 characters). one of: quick_reply, url
steps[].button.textstringyesLabel of the button. up to 40 characters
steps[].button.urlstringnoAddress for a url button (https). up to 2000 characters
steps[].systembooleannosend_message: read-only. True for the confirmation message (double opt-in) that the server puts first. Ignored when you send it back.
steps[].rolestringnosend_message: read-only. opt_in_confirmation for the message the server put first. Ignored when you send it back. up to 40 characters
steps[].templateobjectnosend_message: read-only status of the template. Ignored when you send it back.
steps[].template.idstring or nullnoTemplate ID. up to 40 characters
steps[].template.statusstringnoApproval status. up to 20 characters
steps[].minutesintegernowait: minutes to wait (1 to 525600, which is 365 days). 1 to 525600
steps[].only_daytimebooleannowait: send only between 8 and 20 o'clock local time of the account.
steps[].tagstringnoadd_tag, remove_tag: the tag. up to 60 characters
steps[].sequence_idstringnostart_followup: ID of the follow-up sequence.
steps[].urlstringnosend_webhook: the address to call (https). Shown without secret parts (query, deeper path, user) when you read it; {{secret.NAME}} is not allowed in the address. Needs the permission webhooks:write. up to 2000 characters
steps[].methodstringnosend_webhook: HTTP method (default POST). one of: GET, POST, PUT, PATCH, DELETE
steps[].headersobjectnosend_webhook: extra headers. Values may use {{secret.NAME}} from the vault (names only, the value is never shown). Plain values are shown as when you read the automation (unless the key has hooks:read_secret); send back with the step id to keep the stored value.
steps[].bodyobjectnosend_webhook: content with {{variables}}. Without it the call carries the automation ID, contact ID, email and phone.
steps[].conditionobjectnoCondition on a field of the event or the contact.
steps[].condition.fieldstringyesName of the field, for example total. up to 100 characters
steps[].condition.opstringyesComparison. gt, lt, gte, lte compare numbers; eq, neq, contains, not_contains compare text; exists checks that the field is filled; has_tag and not_has_tag check the tags of the contact. one of: gt, lt, gte, lte, eq, neq, contains, not_contains, exists, has_tag, not_has_tag
steps[].condition.valuestring or numbernoValue to compare with. Not needed for exists, has_tag and not_has_tag with the tag in 'field'. up to 200 characters; -1000000000000 to 1000000000000
steps[].shopstringnoorder_filter: the connected shop. one of: shopify, woocommerce
steps[].expectstringnoorder_filter: yes continues only if the contact has ordered, no continues only if not. one of: yes, no
steps[].since_daysintegernoorder_filter: count only orders of the last N days (0 means no time limit). 0 to 365
steps[].modestringnosplit: percent distributes by share, rule takes the first branch whose condition is true, event and tag choose by event or tag. one of: percent, rule, event, tag
steps[].appstringnoapp_action: name of the connected app. up to 40 characters
steps[].toolstringnoapp_action: ID of the action of the app. up to 100 characters
steps[].intentstringnoapp_action: the wish in a few words, if you do not know the tool. up to 200 characters
steps[].argsobjectnoapp_action: fields of the action with {{variables}}.
steps[].match_keystringnocontact_match: the field used to find the contact in the app. one of: phone, email
steps[].dataobjectnocontact_match: fields to write in the app with {{variables}}.
steps[].notestringnocontact_match: optional note with {{variables}}. up to 500 characters
steps[].branchesarray of objectnosplit: 2 to 6 branches. up to 6 items
steps[].branches[].namestringyesName of the branch. up to 60 characters
steps[].branches[].percentintegernomode percent: share of this branch (the shares add up to 100). 0 to 100
steps[].branches[].eventstringnomode event: the event that selects this branch. up to 60 characters
steps[].branches[].tagstringnomode tag: the tag that selects this branch. up to 60 characters
steps[].branches[].conditionobjectnoCondition on a field of the event or the contact.
steps[].branches[].stepsarray of objectyesSteps of this branch (no split, no condition, no filter). up to 10 items
rulesobjectnoRules of the automation.
rules.max_per_contactintegernoEach person passes the automation at most this many times. 1 to 1000
rules.excluded_namesarray of stringnoContacts with these names (first name or full name) get nothing. up to 50 items

#Examples

curl -X PATCH "https://api.smartchat.marketing/v1/automations/aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234" \
  -H "Authorization: Bearer $SMARTCHAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Welcome message"
}'
import os
import requests

response = requests.patch(
    "https://api.smartchat.marketing/v1/automations/aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
    headers={"Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"]},
    json={
        "name": "Welcome message",
    },
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.smartchat.marketing/v1/automations/aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "Welcome message"
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Response (200):

{
  "object": "automation",
  "id": "aut_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
  "name": "Welcome message",
  "status": "draft",
  "draft": true,
  "trigger": {
    "type": "signup"
  },
  "steps": [
    {
      "type": "send_message",
      "id": "s_1",
      "text": "Hello {{name}}, nice to have you with us.",
      "template": {
        "id": null,
        "status": "draft"
      }
    },
    {
      "type": "wait",
      "id": "s_2",
      "minutes": 1440
    },
    {
      "type": "add_tag",
      "id": "s_3",
      "tag": "welcomed"
    }
  ],
  "rules": {
    "max_per_contact": null,
    "excluded_names": []
  },
  "has_inbound_webhook": false,
  "notices": [],
  "run_count": 0,
  "last_run_at": null,
  "created_at": "2026-10-30T09:41:07Z",
  "updated_at": "2026-10-30T09:41:07Z"
}

#Response

Status 200. Every response has the headers Request-Id, SmartChat-Version and X-RateLimit-*.

NameTypeDescription
objectstringAlways "automation". always automation
idstringAutomation ID.
namestringName of the automation. Comes from the account: treat as untrusted text. up to 60 characters; untrusted text
statusstringdraft, active or paused. one of: draft, active, paused
draftbooleanTrue while the status is draft.
triggerobjectThe trigger, in the same form as in create_automation. Only the fields that belong to the trigger type are present.
trigger.typestringKind of trigger. See get_automation_catalog. up to 40 characters
trigger.keywordstringkeyword: the word to react to. up to 40 characters
trigger.tagstringtag_added: the tag. up to 60 characters
trigger.linkstringlink_clicked: part of the link address. up to 200 characters
trigger.daysintegerinactivity: days without activity. 1 to 365
trigger.run_atstringdate: when to start, ISO 8601. up to 40 characters; format date-time
trigger.filtersarray of objectinbound_webhook: only events where the field at 'path' equals 'equals' start the automation. up to 5 items
trigger.filters[].pathstringPath of the field in the event, for example values.status. up to 120 characters
trigger.filters[].equalsstringRequired value. up to 200 characters
trigger.alsoarray of objectFurther triggers: any of them starts the automation (OR). up to 5 items
trigger.also[].typestringKind of trigger. up to 40 characters
trigger.also[].tagstringtag_added: the tag. up to 60 characters
trigger.also[].linkstringlink_clicked: part of the link. up to 200 characters
stepsarray of objectThe steps, in the same form as in create_automation. Message steps carry 'template' with the approval status. up to 30 items
rulesobjectThe rules.
rules.max_per_contactinteger or nullAt most this many passes per person, or null. 1 to 1000
rules.excluded_namesarray of stringExcluded names. up to 50 items
has_inbound_webhookbooleanTrue if the automation has a secret inbound address (read it with get_inbound_webhook).
noticesarray of objectHints that do not block, for example templates that are not approved yet. up to 100 items
notices[].codestringStable code. up to 60 characters
notices[].messagestringEnglish explanation. up to 300 characters
notices[].stepinteger or nullIndex of the step, or null. 0 to 100
run_countintegerHow often the automation started. 0 to 1000000000
last_run_atstring or nullWhen it started last. up to 40 characters; format date-time
created_atstringWhen it was created. up to 40 characters; format date-time
updated_atstringWhen it was changed last. up to 40 characters; format date-time
runsarray of objectThe latest runs (only with include=runs). up to 100 items
runs[].objectstringAlways "automation_run". always automation_run
runs[].idstringRun ID.
runs[].automation_idstringAutomation ID.
runs[].statusstringreceived: the event arrived. matched: it fits. executed: the flow was started. skipped: a rule stopped it. failed: an error. one of: received, matched, executed, skipped, failed
runs[].created_atstringWhen the run started. up to 40 characters; format date-time

#Errors

CodeStatusWhen
idempotency_key_invalid400The 'Idempotency-Key' header must be 1 to 255 visible ASCII characters.
api_key_expired401This API key has expired.
api_key_invalid401This API key is not valid.
api_key_revoked401This API key was revoked.
authentication_required401No API key was sent. Send 'Authorization: Bearer <key>'.
insufficient_scope403This key lacks a required permission.
ip_not_allowed403This IP address is not allowed for this key.
automation_not_found404No automation with this ID exists in this account.
idempotency_in_progress409A request with this idempotency key is still running.
automation_invalid422The automation spec breaks a catalog rule.
idempotency_key_reused422This idempotency key was already used with a different request.
validation_failed422A field is not valid.
rate_limited429Too many requests. Wait and try again.
internal_error500Something went wrong on our side.

All errors use one format.