#Automations
GET /automations
List the organization's automations, newest first by default.
Requires the automations:read permission.
Query parameters
limitnumberThe number of records to return.
cursorstringA pagination cursor. Fetch the next page by passing the nextCursor value from the previous response.
sortname | -name | createdAt | -createdAtThe sort order. Prefix a field with - to sort descending. Defaults to -createdAt.
filterstringA JSON-encoded filter document, for example {"createdAt":{"$gte":"2025-01-01T00:00:00Z"}}. Filterable fields: id, name, isActive, templateKey, createdAt. See Filtering for the syntax.
curl \
"https://your-store.meisei.app/api/automations" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { getAutomations } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await getAutomations()require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
page = meisei.automations.listfrom meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
page = meisei.automations.list(){
"data": [
{
"id": "A4Ws1igz",
"name": "string",
"code": "string",
"events": ["..."],
"permissions": ["..."],
"secretNames": ["..."],
"isActive": true,
"templateKey": "string",
"parameters": ["..."],
"config": "...",
"emails": ["..."],
"inbound": {
"urlCreatedAt": "...",
"signature": "...",
"idempotencyHeader": "..."
},
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}
],
"nextCursor": "string"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the automation.",
"idCodec": "sqid"
},
"name": {
"type": "string",
"description": "What the automation is called in the dashboard."
},
"code": {
"type": "string",
"description": "The script, as a JavaScript module whose default export is `async function (event, { meisei, secrets, config })`."
},
"events": {
"type": "array",
"items": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"description": "The events the automation runs on, from the same list webhooks subscribe to, plus `inbound.received` when it takes requests at its incoming URL."
},
"permissions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"analytics:read",
"analytics:write",
"automations:read",
"automations:write",
"customers:read",
"customers:write",
"exports:read",
"exports:write",
"imports:read",
"imports:write",
"loyalty:read",
"loyalty:write",
"orders:read",
"orders:write",
"products:read",
"products:write",
"reviews:read",
"reviews:write",
"settings:read",
"settings:write",
"surveys:read",
"surveys:write",
"webhooks:read",
"webhooks:write",
"wishlists:read",
"wishlists:write"
],
"description": "One permission a secret key can hold, as `<resource group>:<read or write>`. Write covers creating, updating and deleting, and does not imply read."
},
"description": "The permissions the script's api calls are held to, as on a secret key."
},
"secretNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of the secrets the script can read. The values are never returned."
},
"isActive": {
"type": "boolean",
"description": "Whether the automation runs on its events."
},
"templateKey": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The template the automation was started from, if any."
},
"parameters": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "number"
},
"default": {
"description": "The value a new automation starts with.",
"type": "number"
},
"min": {
"description": "The lowest value allowed.",
"type": "number"
},
"max": {
"description": "The highest value allowed.",
"type": "number"
},
"integer": {
"description": "Whether only whole numbers are allowed.",
"type": "boolean"
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "text"
},
"default": {
"description": "The value a new automation starts with.",
"type": "string",
"maxLength": 1000
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "select"
},
"options": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "What the script reads."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard shows."
}
},
"required": ["value", "label"],
"additionalProperties": false
},
"description": "The choices, in the order the dashboard lists them."
},
"default": {
"description": "The option a new automation starts with.",
"type": "string"
}
},
"required": ["key", "label", "type", "options"],
"additionalProperties": false
}
]
},
"description": "The settings the automation asks for, each a number, a piece of text or a choice from a list. The dashboard shows them as a form."
},
"config": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
"description": "The value of each parameter, by key. The script reads them as `config`."
},
"emails": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "What the script calls the email by when it sends it, unique within the automation."
},
"name": {
"type": "string",
"description": "What the dashboard calls the email."
},
"subject": {
"type": "string",
"description": "The subject line. It can use the same variables as the body, filled in as plain text."
},
"preheader": {
"type": "string",
"description": "The preview line an inbox shows after the subject. It can use the same variables as the body."
},
"body": {
"type": "string",
"description": "The email's own content, sent inside the store's default layout. `customer` and `site` are filled in by Meisei, and anything else comes from the `data` the script sends with it."
},
"reason": {
"type": "string",
"description": "Finishes the footer's \"You're receiving this because\" sentence, which ends with the store's name, such as \"you saved this to a wishlist at\"."
},
"sampleData": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the dashboard's preview fills the email's variables with, standing in for the `data` the script sends."
}
},
"required": ["key", "name", "subject", "preheader", "body", "reason", "sampleData"],
"additionalProperties": false
},
"description": "The emails the automation owns. Its script sends one to a customer with `POST /customers/{id}/send-email`, naming it by `key`."
},
"inbound": {
"type": "object",
"properties": {
"urlCreatedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the automation's incoming URL was made, or null while it has none. The URL itself is shown once, when it is made."
},
"signature": {
"anyOf": [
{
"type": "object",
"properties": {
"header": {
"type": "string",
"description": "The request header that carries the signature, such as `X-WC-Webhook-Signature`."
},
"secretName": {
"type": "string",
"description": "The automation's secret the sender signs with, by name. Its value is the HMAC key."
},
"encoding": {
"type": "string",
"enum": ["hex", "base64"],
"description": "How the signature is written: as hex digits or as base64."
},
"prefix": {
"type": "string",
"description": "Text the header puts before the signature, such as `sha256=`. Empty when there is none."
}
},
"required": ["header", "secretName", "encoding", "prefix"],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "The HMAC-SHA256 signature a request to the incoming URL has to carry, or null to take any request that has the URL."
},
"idempotencyHeader": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A header whose value names one delivery, such as `X-WC-Webhook-Delivery-ID`. A request repeating a value already received runs nothing, so a sender's retry runs once."
}
},
"required": ["urlCreatedAt", "signature", "idempotencyHeader"],
"additionalProperties": false,
"description": "How the automation takes requests from other apps at its incoming URL."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was last changed."
}
},
"required": [
"id",
"name",
"code",
"events",
"permissions",
"secretNames",
"isActive",
"templateKey",
"parameters",
"config",
"emails",
"inbound",
"createdAt",
"updatedAt"
],
"additionalProperties": false
},
"description": "The page of records, in the requested sort order."
},
"nextCursor": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Pass this back as `cursor` to fetch the next page. Null once the last page has been returned."
}
},
"required": ["data", "nextCursor"],
"additionalProperties": false
}POST /automations
Create an automation: a script Meisei runs for you whenever one of its events happens, with an api client held to the permissions you give it. You can only give it permissions your own credential holds.
Requires the automations:write permission.
Body parameters
namestringrequiredWhat to call the automation.
codestringrequiredThe script: a JavaScript module whose default export is async function (event, { meisei, secrets, config }). meisei calls the admin api as the automation (get, post, put, patch, delete), config holds the value of each parameter, and fetch reaches anywhere else. Imports are not supported.
eventscustomer.created | customer.updated | customer.deleted | order.created | order.updated | order.deleted | product.created | product.updated | product.deleted | productVariant.updated | review.created | review.updated | review.deleted | review.published | reviewQuestion.created | reviewQuestion.updated | reviewQuestion.deleted | site.created | site.updated | site.deleted | emailTemplate.created | emailTemplate.updated | emailTemplate.deleted | survey.deleted | reviewRequest.eligible | reviewRequest.canceled | loyaltyProgram.created | loyaltyProgram.updated | loyaltyProgram.deleted | loyaltyRule.created | loyaltyRule.updated | loyaltyRule.deleted | loyaltyTier.created | loyaltyTier.updated | loyaltyTier.deleted | loyaltyMembership.created | loyaltyMembership.updated | loyaltyMembership.deleted | loyaltyMembership.tierChanged | loyaltyMembership.pointsEarned | loyaltyTransaction.created | loyaltyReward.issued | loyaltyReward.claimed | loyaltyReward.redeemed | loyaltyReward.revoked | loyaltyReward.expired | loyaltyReward.expiringSoon | loyaltyPoints.expiringSoon | wishlist.created | wishlist.updated | wishlist.deleted | webhook.created | webhook.updated | webhook.deleted | metadataDefinition.created | metadataDefinition.updated | metadataDefinition.deleted | schedule.hourly | schedule.daily | inbound.received[]requiredThe events to run on. Call GET /webhook-events for the list; schedule.hourly and schedule.daily run on a clock, and inbound.received runs on a request to the automation's incoming URL.
permissionsanalytics:read | analytics:write | automations:read | automations:write | customers:read | customers:write | exports:read | exports:write | imports:read | imports:write | loyalty:read | loyalty:write | orders:read | orders:write | products:read | products:write | reviews:read | reviews:write | settings:read | settings:write | surveys:read | surveys:write | webhooks:read | webhooks:write | wishlists:read | wishlists:write[]What the script's api calls may do, as on a secret key. You can only give permissions your own credential holds.
secretsobjectValues the script reads as secrets.NAME, such as another service's API key. They are never returned.
isActivebooleanWhether the automation runs. Defaults to true.
parametersobject | object | object[]The settings the automation asks for. Each has a key the script reads it under, a label, and a type of number (with optional min, max and integer), text, or select (with options). A default fills it in when config leaves it out.
configobjectA value for each parameter, by key. One left out takes the parameter's default, and a parameter with no default has to be given one.
emailsobject[]The emails the automation owns, which its script sends with POST /customers/{id}/send-email. Each needs a key, a name, a subject and a body.
inboundobjectHow the incoming URL checks a request. Fields left out are left alone. The URL itself is made with POST /automations/{id}/inbound-url.
templateKeyreview-requests | slack-review-alerts | review-edited | rating-badges | review-points | low-rating-follow-up | top-reviewer-tags | review-digest-slack | zendesk-review-tickets | loyalty-tiers | loyalty-emails | loyalty-tier-tags | birthday-events | scheduled-promotion | win-back | order-anniversary | order-streak | customer-segments | wishlist-alerts | wishlist-reminders-klaviyo | most-wished-tags | wishlist-demand-report | order-status-emails | custom-field-changes | shopify-review-metafields | shopify-customer-tags | shopify-most-wished-collection | woocommerce-orders | woocommerce-reward-coupons | nullThe template this automation was started from, as GET /automation-templates names it.
curl \
-X POST \
"https://your-store.meisei.app/api/automations" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"code": "string",
"events": [
"customer.created"
],
"permissions": [],
"secrets": "...",
"isActive": true,
"parameters": [
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": true
}
],
"config": "...",
"emails": [
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sampleData": "..."
}
],
"inbound": {
"signature": {
"header": "string",
"secretName": "string",
"encoding": "hex",
"prefix": ""
},
"idempotencyHeader": "string"
},
"templateKey": "review-requests"
}'import { client } from "@meisei/api/admin/client"
import { postAutomations } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await postAutomations({
body: {
name: "string",
code: "string",
events: ["customer.created"],
permissions: [],
secrets: "...",
isActive: true,
parameters: [
{
key: "string",
label: "string",
description: "string",
type: "number",
default: 0,
min: 0,
max: 0,
integer: true,
},
],
config: "...",
emails: [
{
key: "string",
name: "string",
subject: "string",
preheader: "string",
body: "string",
reason: "string",
sampleData: "...",
},
],
inbound: {
signature: {
header: "string",
secretName: "string",
encoding: "hex",
prefix: "",
},
idempotencyHeader: "string",
},
templateKey: "review-requests",
},
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.create(
name: "string",
code: "string",
events: ["customer.created"],
permissions: [],
secrets: "...",
is_active: true,
parameters: [
{
key: "string",
label: "string",
description: "string",
type: "number",
default: 0,
min: 0,
max: 0,
integer: true,
},
],
config: "...",
emails: [
{
key: "string",
name: "string",
subject: "string",
preheader: "string",
body: "string",
reason: "string",
sample_data: "...",
},
],
inbound: {
signature: { header: "string", secret_name: "string", encoding: "hex", prefix: "" },
idempotency_header: "string",
},
template_key: "review-requests",
)from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.create(
name="string",
code="string",
events=["customer.created"],
permissions=[],
secrets={},
is_active=True,
parameters=[
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": True,
},
],
config={},
emails=[
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sample_data": {},
},
],
inbound={
"signature": {
"header": "string",
"secret_name": "string",
"encoding": "hex",
"prefix": "",
},
"idempotency_header": "string",
},
template_key="review-requests",
){
"id": "A4Ws1igz",
"name": "string",
"code": "string",
"events": ["customer.created"],
"permissions": ["analytics:read"],
"secretNames": ["string"],
"isActive": true,
"templateKey": "string",
"parameters": [
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": true
}
],
"config": "...",
"emails": [
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sampleData": "..."
}
],
"inbound": {
"urlCreatedAt": "2025-01-15T09:30:00Z",
"signature": {
"header": "string",
"secretName": "string",
"encoding": "hex",
"prefix": "string"
},
"idempotencyHeader": "string"
},
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the automation.",
"idCodec": "sqid"
},
"name": {
"type": "string",
"description": "What the automation is called in the dashboard."
},
"code": {
"type": "string",
"description": "The script, as a JavaScript module whose default export is `async function (event, { meisei, secrets, config })`."
},
"events": {
"type": "array",
"items": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"description": "The events the automation runs on, from the same list webhooks subscribe to, plus `inbound.received` when it takes requests at its incoming URL."
},
"permissions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"analytics:read",
"analytics:write",
"automations:read",
"automations:write",
"customers:read",
"customers:write",
"exports:read",
"exports:write",
"imports:read",
"imports:write",
"loyalty:read",
"loyalty:write",
"orders:read",
"orders:write",
"products:read",
"products:write",
"reviews:read",
"reviews:write",
"settings:read",
"settings:write",
"surveys:read",
"surveys:write",
"webhooks:read",
"webhooks:write",
"wishlists:read",
"wishlists:write"
],
"description": "One permission a secret key can hold, as `<resource group>:<read or write>`. Write covers creating, updating and deleting, and does not imply read."
},
"description": "The permissions the script's api calls are held to, as on a secret key."
},
"secretNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of the secrets the script can read. The values are never returned."
},
"isActive": {
"type": "boolean",
"description": "Whether the automation runs on its events."
},
"templateKey": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The template the automation was started from, if any."
},
"parameters": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "number"
},
"default": {
"description": "The value a new automation starts with.",
"type": "number"
},
"min": {
"description": "The lowest value allowed.",
"type": "number"
},
"max": {
"description": "The highest value allowed.",
"type": "number"
},
"integer": {
"description": "Whether only whole numbers are allowed.",
"type": "boolean"
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "text"
},
"default": {
"description": "The value a new automation starts with.",
"type": "string",
"maxLength": 1000
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "select"
},
"options": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "What the script reads."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard shows."
}
},
"required": ["value", "label"],
"additionalProperties": false
},
"description": "The choices, in the order the dashboard lists them."
},
"default": {
"description": "The option a new automation starts with.",
"type": "string"
}
},
"required": ["key", "label", "type", "options"],
"additionalProperties": false
}
]
},
"description": "The settings the automation asks for, each a number, a piece of text or a choice from a list. The dashboard shows them as a form."
},
"config": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
"description": "The value of each parameter, by key. The script reads them as `config`."
},
"emails": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "What the script calls the email by when it sends it, unique within the automation."
},
"name": {
"type": "string",
"description": "What the dashboard calls the email."
},
"subject": {
"type": "string",
"description": "The subject line. It can use the same variables as the body, filled in as plain text."
},
"preheader": {
"type": "string",
"description": "The preview line an inbox shows after the subject. It can use the same variables as the body."
},
"body": {
"type": "string",
"description": "The email's own content, sent inside the store's default layout. `customer` and `site` are filled in by Meisei, and anything else comes from the `data` the script sends with it."
},
"reason": {
"type": "string",
"description": "Finishes the footer's \"You're receiving this because\" sentence, which ends with the store's name, such as \"you saved this to a wishlist at\"."
},
"sampleData": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the dashboard's preview fills the email's variables with, standing in for the `data` the script sends."
}
},
"required": ["key", "name", "subject", "preheader", "body", "reason", "sampleData"],
"additionalProperties": false
},
"description": "The emails the automation owns. Its script sends one to a customer with `POST /customers/{id}/send-email`, naming it by `key`."
},
"inbound": {
"type": "object",
"properties": {
"urlCreatedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the automation's incoming URL was made, or null while it has none. The URL itself is shown once, when it is made."
},
"signature": {
"anyOf": [
{
"type": "object",
"properties": {
"header": {
"type": "string",
"description": "The request header that carries the signature, such as `X-WC-Webhook-Signature`."
},
"secretName": {
"type": "string",
"description": "The automation's secret the sender signs with, by name. Its value is the HMAC key."
},
"encoding": {
"type": "string",
"enum": ["hex", "base64"],
"description": "How the signature is written: as hex digits or as base64."
},
"prefix": {
"type": "string",
"description": "Text the header puts before the signature, such as `sha256=`. Empty when there is none."
}
},
"required": ["header", "secretName", "encoding", "prefix"],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "The HMAC-SHA256 signature a request to the incoming URL has to carry, or null to take any request that has the URL."
},
"idempotencyHeader": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A header whose value names one delivery, such as `X-WC-Webhook-Delivery-ID`. A request repeating a value already received runs nothing, so a sender's retry runs once."
}
},
"required": ["urlCreatedAt", "signature", "idempotencyHeader"],
"additionalProperties": false,
"description": "How the automation takes requests from other apps at its incoming URL."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was last changed."
}
},
"required": [
"id",
"name",
"code",
"events",
"permissions",
"secretNames",
"isActive",
"templateKey",
"parameters",
"config",
"emails",
"inbound",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The new automation."
}GET /automations/{id}
Get a single automation by ID, with its script. Secret values are never returned.
Requires the automations:read permission.
Path parameters
idstringrequiredThe ID of the automation.
curl \
"https://your-store.meisei.app/api/automations/A4Ws1igz" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { getAutomationsById } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await getAutomationsById({
path: { id: "A4Ws1igz" },
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.retrieve("A4Ws1igz")from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.retrieve("A4Ws1igz"){
"id": "A4Ws1igz",
"name": "string",
"code": "string",
"events": ["customer.created"],
"permissions": ["analytics:read"],
"secretNames": ["string"],
"isActive": true,
"templateKey": "string",
"parameters": [
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": true
}
],
"config": "...",
"emails": [
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sampleData": "..."
}
],
"inbound": {
"urlCreatedAt": "2025-01-15T09:30:00Z",
"signature": {
"header": "string",
"secretName": "string",
"encoding": "hex",
"prefix": "string"
},
"idempotencyHeader": "string"
},
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the automation.",
"idCodec": "sqid"
},
"name": {
"type": "string",
"description": "What the automation is called in the dashboard."
},
"code": {
"type": "string",
"description": "The script, as a JavaScript module whose default export is `async function (event, { meisei, secrets, config })`."
},
"events": {
"type": "array",
"items": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"description": "The events the automation runs on, from the same list webhooks subscribe to, plus `inbound.received` when it takes requests at its incoming URL."
},
"permissions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"analytics:read",
"analytics:write",
"automations:read",
"automations:write",
"customers:read",
"customers:write",
"exports:read",
"exports:write",
"imports:read",
"imports:write",
"loyalty:read",
"loyalty:write",
"orders:read",
"orders:write",
"products:read",
"products:write",
"reviews:read",
"reviews:write",
"settings:read",
"settings:write",
"surveys:read",
"surveys:write",
"webhooks:read",
"webhooks:write",
"wishlists:read",
"wishlists:write"
],
"description": "One permission a secret key can hold, as `<resource group>:<read or write>`. Write covers creating, updating and deleting, and does not imply read."
},
"description": "The permissions the script's api calls are held to, as on a secret key."
},
"secretNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of the secrets the script can read. The values are never returned."
},
"isActive": {
"type": "boolean",
"description": "Whether the automation runs on its events."
},
"templateKey": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The template the automation was started from, if any."
},
"parameters": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "number"
},
"default": {
"description": "The value a new automation starts with.",
"type": "number"
},
"min": {
"description": "The lowest value allowed.",
"type": "number"
},
"max": {
"description": "The highest value allowed.",
"type": "number"
},
"integer": {
"description": "Whether only whole numbers are allowed.",
"type": "boolean"
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "text"
},
"default": {
"description": "The value a new automation starts with.",
"type": "string",
"maxLength": 1000
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "select"
},
"options": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "What the script reads."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard shows."
}
},
"required": ["value", "label"],
"additionalProperties": false
},
"description": "The choices, in the order the dashboard lists them."
},
"default": {
"description": "The option a new automation starts with.",
"type": "string"
}
},
"required": ["key", "label", "type", "options"],
"additionalProperties": false
}
]
},
"description": "The settings the automation asks for, each a number, a piece of text or a choice from a list. The dashboard shows them as a form."
},
"config": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
"description": "The value of each parameter, by key. The script reads them as `config`."
},
"emails": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "What the script calls the email by when it sends it, unique within the automation."
},
"name": {
"type": "string",
"description": "What the dashboard calls the email."
},
"subject": {
"type": "string",
"description": "The subject line. It can use the same variables as the body, filled in as plain text."
},
"preheader": {
"type": "string",
"description": "The preview line an inbox shows after the subject. It can use the same variables as the body."
},
"body": {
"type": "string",
"description": "The email's own content, sent inside the store's default layout. `customer` and `site` are filled in by Meisei, and anything else comes from the `data` the script sends with it."
},
"reason": {
"type": "string",
"description": "Finishes the footer's \"You're receiving this because\" sentence, which ends with the store's name, such as \"you saved this to a wishlist at\"."
},
"sampleData": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the dashboard's preview fills the email's variables with, standing in for the `data` the script sends."
}
},
"required": ["key", "name", "subject", "preheader", "body", "reason", "sampleData"],
"additionalProperties": false
},
"description": "The emails the automation owns. Its script sends one to a customer with `POST /customers/{id}/send-email`, naming it by `key`."
},
"inbound": {
"type": "object",
"properties": {
"urlCreatedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the automation's incoming URL was made, or null while it has none. The URL itself is shown once, when it is made."
},
"signature": {
"anyOf": [
{
"type": "object",
"properties": {
"header": {
"type": "string",
"description": "The request header that carries the signature, such as `X-WC-Webhook-Signature`."
},
"secretName": {
"type": "string",
"description": "The automation's secret the sender signs with, by name. Its value is the HMAC key."
},
"encoding": {
"type": "string",
"enum": ["hex", "base64"],
"description": "How the signature is written: as hex digits or as base64."
},
"prefix": {
"type": "string",
"description": "Text the header puts before the signature, such as `sha256=`. Empty when there is none."
}
},
"required": ["header", "secretName", "encoding", "prefix"],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "The HMAC-SHA256 signature a request to the incoming URL has to carry, or null to take any request that has the URL."
},
"idempotencyHeader": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A header whose value names one delivery, such as `X-WC-Webhook-Delivery-ID`. A request repeating a value already received runs nothing, so a sender's retry runs once."
}
},
"required": ["urlCreatedAt", "signature", "idempotencyHeader"],
"additionalProperties": false,
"description": "How the automation takes requests from other apps at its incoming URL."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was last changed."
}
},
"required": [
"id",
"name",
"code",
"events",
"permissions",
"secretNames",
"isActive",
"templateKey",
"parameters",
"config",
"emails",
"inbound",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The requested automation."
}PUT /automations/{id}
Update an automation's name, script, events, permissions, secrets or active flag. Only the fields you send are changed, and the next run uses them. A change runs with the automation's permissions, so your credential has to hold every one of them; without them you can only set isActive to false.
Requires the automations:write permission.
Path parameters
idstringrequiredThe ID of the automation.
Body parameters
namestringA new name.
codestringA new script. The next run uses it.
eventscustomer.created | customer.updated | customer.deleted | order.created | order.updated | order.deleted | product.created | product.updated | product.deleted | productVariant.updated | review.created | review.updated | review.deleted | review.published | reviewQuestion.created | reviewQuestion.updated | reviewQuestion.deleted | site.created | site.updated | site.deleted | emailTemplate.created | emailTemplate.updated | emailTemplate.deleted | survey.deleted | reviewRequest.eligible | reviewRequest.canceled | loyaltyProgram.created | loyaltyProgram.updated | loyaltyProgram.deleted | loyaltyRule.created | loyaltyRule.updated | loyaltyRule.deleted | loyaltyTier.created | loyaltyTier.updated | loyaltyTier.deleted | loyaltyMembership.created | loyaltyMembership.updated | loyaltyMembership.deleted | loyaltyMembership.tierChanged | loyaltyMembership.pointsEarned | loyaltyTransaction.created | loyaltyReward.issued | loyaltyReward.claimed | loyaltyReward.redeemed | loyaltyReward.revoked | loyaltyReward.expired | loyaltyReward.expiringSoon | loyaltyPoints.expiringSoon | wishlist.created | wishlist.updated | wishlist.deleted | webhook.created | webhook.updated | webhook.deleted | metadataDefinition.created | metadataDefinition.updated | metadataDefinition.deleted | schedule.hourly | schedule.daily | inbound.received[]Replaces the list of events wholesale. Omit to leave it alone. Leaving out inbound.received turns the incoming URL off.
permissionsanalytics:read | analytics:write | automations:read | automations:write | customers:read | customers:write | exports:read | exports:write | imports:read | imports:write | loyalty:read | loyalty:write | orders:read | orders:write | products:read | products:write | reviews:read | reviews:write | settings:read | settings:write | surveys:read | surveys:write | webhooks:read | webhooks:write | wishlists:read | wishlists:write[]Replaces the permissions wholesale. You can only give permissions your own credential holds.
secretsobjectSecrets to set or, with null, remove. A secret left out of the object is left alone.
isActivebooleanWhether the automation runs.
parametersobject | object | object[]Replaces the list of parameters wholesale. A value whose parameter is gone is dropped, and a new parameter takes its default.
configobjectValues to set or, with null, put back to the parameter's default. A parameter left out of the object keeps its value.
emailsobject[]Replaces the emails wholesale. An email left out of the list is deleted.
inboundobjectHow the incoming URL checks a request. Fields left out are left alone. The URL itself is made with POST /automations/{id}/inbound-url.
curl \
-X PUT \
"https://your-store.meisei.app/api/automations/A4Ws1igz" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"code": "string",
"events": [
"customer.created"
],
"permissions": [
"analytics:read"
],
"secrets": "...",
"isActive": true,
"parameters": [
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": true
}
],
"config": "...",
"emails": [
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sampleData": "..."
}
],
"inbound": {
"signature": {
"header": "string",
"secretName": "string",
"encoding": "hex",
"prefix": ""
},
"idempotencyHeader": "string"
}
}'import { client } from "@meisei/api/admin/client"
import { putAutomationsById } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await putAutomationsById({
path: { id: "A4Ws1igz" },
body: {
name: "string",
code: "string",
events: ["customer.created"],
permissions: ["analytics:read"],
secrets: "...",
isActive: true,
parameters: [
{
key: "string",
label: "string",
description: "string",
type: "number",
default: 0,
min: 0,
max: 0,
integer: true,
},
],
config: "...",
emails: [
{
key: "string",
name: "string",
subject: "string",
preheader: "string",
body: "string",
reason: "string",
sampleData: "...",
},
],
inbound: {
signature: {
header: "string",
secretName: "string",
encoding: "hex",
prefix: "",
},
idempotencyHeader: "string",
},
},
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.update(
"A4Ws1igz",
name: "string",
code: "string",
events: ["customer.created"],
permissions: ["analytics:read"],
secrets: "...",
is_active: true,
parameters: [
{
key: "string",
label: "string",
description: "string",
type: "number",
default: 0,
min: 0,
max: 0,
integer: true,
},
],
config: "...",
emails: [
{
key: "string",
name: "string",
subject: "string",
preheader: "string",
body: "string",
reason: "string",
sample_data: "...",
},
],
inbound: {
signature: { header: "string", secret_name: "string", encoding: "hex", prefix: "" },
idempotency_header: "string",
},
)from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.update(
"A4Ws1igz",
name="string",
code="string",
events=["customer.created"],
permissions=["analytics:read"],
secrets={},
is_active=True,
parameters=[
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": True,
},
],
config={},
emails=[
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sample_data": {},
},
],
inbound={
"signature": {
"header": "string",
"secret_name": "string",
"encoding": "hex",
"prefix": "",
},
"idempotency_header": "string",
},
){
"id": "A4Ws1igz",
"name": "string",
"code": "string",
"events": ["customer.created"],
"permissions": ["analytics:read"],
"secretNames": ["string"],
"isActive": true,
"templateKey": "string",
"parameters": [
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": true
}
],
"config": "...",
"emails": [
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sampleData": "..."
}
],
"inbound": {
"urlCreatedAt": "2025-01-15T09:30:00Z",
"signature": {
"header": "string",
"secretName": "string",
"encoding": "hex",
"prefix": "string"
},
"idempotencyHeader": "string"
},
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the automation.",
"idCodec": "sqid"
},
"name": {
"type": "string",
"description": "What the automation is called in the dashboard."
},
"code": {
"type": "string",
"description": "The script, as a JavaScript module whose default export is `async function (event, { meisei, secrets, config })`."
},
"events": {
"type": "array",
"items": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"description": "The events the automation runs on, from the same list webhooks subscribe to, plus `inbound.received` when it takes requests at its incoming URL."
},
"permissions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"analytics:read",
"analytics:write",
"automations:read",
"automations:write",
"customers:read",
"customers:write",
"exports:read",
"exports:write",
"imports:read",
"imports:write",
"loyalty:read",
"loyalty:write",
"orders:read",
"orders:write",
"products:read",
"products:write",
"reviews:read",
"reviews:write",
"settings:read",
"settings:write",
"surveys:read",
"surveys:write",
"webhooks:read",
"webhooks:write",
"wishlists:read",
"wishlists:write"
],
"description": "One permission a secret key can hold, as `<resource group>:<read or write>`. Write covers creating, updating and deleting, and does not imply read."
},
"description": "The permissions the script's api calls are held to, as on a secret key."
},
"secretNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of the secrets the script can read. The values are never returned."
},
"isActive": {
"type": "boolean",
"description": "Whether the automation runs on its events."
},
"templateKey": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The template the automation was started from, if any."
},
"parameters": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "number"
},
"default": {
"description": "The value a new automation starts with.",
"type": "number"
},
"min": {
"description": "The lowest value allowed.",
"type": "number"
},
"max": {
"description": "The highest value allowed.",
"type": "number"
},
"integer": {
"description": "Whether only whole numbers are allowed.",
"type": "boolean"
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "text"
},
"default": {
"description": "The value a new automation starts with.",
"type": "string",
"maxLength": 1000
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "select"
},
"options": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "What the script reads."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard shows."
}
},
"required": ["value", "label"],
"additionalProperties": false
},
"description": "The choices, in the order the dashboard lists them."
},
"default": {
"description": "The option a new automation starts with.",
"type": "string"
}
},
"required": ["key", "label", "type", "options"],
"additionalProperties": false
}
]
},
"description": "The settings the automation asks for, each a number, a piece of text or a choice from a list. The dashboard shows them as a form."
},
"config": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
"description": "The value of each parameter, by key. The script reads them as `config`."
},
"emails": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "What the script calls the email by when it sends it, unique within the automation."
},
"name": {
"type": "string",
"description": "What the dashboard calls the email."
},
"subject": {
"type": "string",
"description": "The subject line. It can use the same variables as the body, filled in as plain text."
},
"preheader": {
"type": "string",
"description": "The preview line an inbox shows after the subject. It can use the same variables as the body."
},
"body": {
"type": "string",
"description": "The email's own content, sent inside the store's default layout. `customer` and `site` are filled in by Meisei, and anything else comes from the `data` the script sends with it."
},
"reason": {
"type": "string",
"description": "Finishes the footer's \"You're receiving this because\" sentence, which ends with the store's name, such as \"you saved this to a wishlist at\"."
},
"sampleData": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the dashboard's preview fills the email's variables with, standing in for the `data` the script sends."
}
},
"required": ["key", "name", "subject", "preheader", "body", "reason", "sampleData"],
"additionalProperties": false
},
"description": "The emails the automation owns. Its script sends one to a customer with `POST /customers/{id}/send-email`, naming it by `key`."
},
"inbound": {
"type": "object",
"properties": {
"urlCreatedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the automation's incoming URL was made, or null while it has none. The URL itself is shown once, when it is made."
},
"signature": {
"anyOf": [
{
"type": "object",
"properties": {
"header": {
"type": "string",
"description": "The request header that carries the signature, such as `X-WC-Webhook-Signature`."
},
"secretName": {
"type": "string",
"description": "The automation's secret the sender signs with, by name. Its value is the HMAC key."
},
"encoding": {
"type": "string",
"enum": ["hex", "base64"],
"description": "How the signature is written: as hex digits or as base64."
},
"prefix": {
"type": "string",
"description": "Text the header puts before the signature, such as `sha256=`. Empty when there is none."
}
},
"required": ["header", "secretName", "encoding", "prefix"],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "The HMAC-SHA256 signature a request to the incoming URL has to carry, or null to take any request that has the URL."
},
"idempotencyHeader": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A header whose value names one delivery, such as `X-WC-Webhook-Delivery-ID`. A request repeating a value already received runs nothing, so a sender's retry runs once."
}
},
"required": ["urlCreatedAt", "signature", "idempotencyHeader"],
"additionalProperties": false,
"description": "How the automation takes requests from other apps at its incoming URL."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was last changed."
}
},
"required": [
"id",
"name",
"code",
"events",
"permissions",
"secretNames",
"isActive",
"templateKey",
"parameters",
"config",
"emails",
"inbound",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The updated automation."
}DELETE /automations/{id}
Delete an automation and its run history. To pause it instead, set isActive to false.
Requires the automations:write permission.
Path parameters
idstringrequiredThe ID of the automation.
curl \
-X DELETE \
"https://your-store.meisei.app/api/automations/A4Ws1igz" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { deleteAutomationsById } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await deleteAutomationsById({
path: { id: "A4Ws1igz" },
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.delete("A4Ws1igz")from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.delete("A4Ws1igz"){
"id": "A4Ws1igz",
"name": "string",
"code": "string",
"events": ["customer.created"],
"permissions": ["analytics:read"],
"secretNames": ["string"],
"isActive": true,
"templateKey": "string",
"parameters": [
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": true
}
],
"config": "...",
"emails": [
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sampleData": "..."
}
],
"inbound": {
"urlCreatedAt": "2025-01-15T09:30:00Z",
"signature": {
"header": "string",
"secretName": "string",
"encoding": "hex",
"prefix": "string"
},
"idempotencyHeader": "string"
},
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the automation.",
"idCodec": "sqid"
},
"name": {
"type": "string",
"description": "What the automation is called in the dashboard."
},
"code": {
"type": "string",
"description": "The script, as a JavaScript module whose default export is `async function (event, { meisei, secrets, config })`."
},
"events": {
"type": "array",
"items": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"description": "The events the automation runs on, from the same list webhooks subscribe to, plus `inbound.received` when it takes requests at its incoming URL."
},
"permissions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"analytics:read",
"analytics:write",
"automations:read",
"automations:write",
"customers:read",
"customers:write",
"exports:read",
"exports:write",
"imports:read",
"imports:write",
"loyalty:read",
"loyalty:write",
"orders:read",
"orders:write",
"products:read",
"products:write",
"reviews:read",
"reviews:write",
"settings:read",
"settings:write",
"surveys:read",
"surveys:write",
"webhooks:read",
"webhooks:write",
"wishlists:read",
"wishlists:write"
],
"description": "One permission a secret key can hold, as `<resource group>:<read or write>`. Write covers creating, updating and deleting, and does not imply read."
},
"description": "The permissions the script's api calls are held to, as on a secret key."
},
"secretNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of the secrets the script can read. The values are never returned."
},
"isActive": {
"type": "boolean",
"description": "Whether the automation runs on its events."
},
"templateKey": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The template the automation was started from, if any."
},
"parameters": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "number"
},
"default": {
"description": "The value a new automation starts with.",
"type": "number"
},
"min": {
"description": "The lowest value allowed.",
"type": "number"
},
"max": {
"description": "The highest value allowed.",
"type": "number"
},
"integer": {
"description": "Whether only whole numbers are allowed.",
"type": "boolean"
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "text"
},
"default": {
"description": "The value a new automation starts with.",
"type": "string",
"maxLength": 1000
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "select"
},
"options": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "What the script reads."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard shows."
}
},
"required": ["value", "label"],
"additionalProperties": false
},
"description": "The choices, in the order the dashboard lists them."
},
"default": {
"description": "The option a new automation starts with.",
"type": "string"
}
},
"required": ["key", "label", "type", "options"],
"additionalProperties": false
}
]
},
"description": "The settings the automation asks for, each a number, a piece of text or a choice from a list. The dashboard shows them as a form."
},
"config": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
"description": "The value of each parameter, by key. The script reads them as `config`."
},
"emails": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "What the script calls the email by when it sends it, unique within the automation."
},
"name": {
"type": "string",
"description": "What the dashboard calls the email."
},
"subject": {
"type": "string",
"description": "The subject line. It can use the same variables as the body, filled in as plain text."
},
"preheader": {
"type": "string",
"description": "The preview line an inbox shows after the subject. It can use the same variables as the body."
},
"body": {
"type": "string",
"description": "The email's own content, sent inside the store's default layout. `customer` and `site` are filled in by Meisei, and anything else comes from the `data` the script sends with it."
},
"reason": {
"type": "string",
"description": "Finishes the footer's \"You're receiving this because\" sentence, which ends with the store's name, such as \"you saved this to a wishlist at\"."
},
"sampleData": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the dashboard's preview fills the email's variables with, standing in for the `data` the script sends."
}
},
"required": ["key", "name", "subject", "preheader", "body", "reason", "sampleData"],
"additionalProperties": false
},
"description": "The emails the automation owns. Its script sends one to a customer with `POST /customers/{id}/send-email`, naming it by `key`."
},
"inbound": {
"type": "object",
"properties": {
"urlCreatedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the automation's incoming URL was made, or null while it has none. The URL itself is shown once, when it is made."
},
"signature": {
"anyOf": [
{
"type": "object",
"properties": {
"header": {
"type": "string",
"description": "The request header that carries the signature, such as `X-WC-Webhook-Signature`."
},
"secretName": {
"type": "string",
"description": "The automation's secret the sender signs with, by name. Its value is the HMAC key."
},
"encoding": {
"type": "string",
"enum": ["hex", "base64"],
"description": "How the signature is written: as hex digits or as base64."
},
"prefix": {
"type": "string",
"description": "Text the header puts before the signature, such as `sha256=`. Empty when there is none."
}
},
"required": ["header", "secretName", "encoding", "prefix"],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "The HMAC-SHA256 signature a request to the incoming URL has to carry, or null to take any request that has the URL."
},
"idempotencyHeader": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A header whose value names one delivery, such as `X-WC-Webhook-Delivery-ID`. A request repeating a value already received runs nothing, so a sender's retry runs once."
}
},
"required": ["urlCreatedAt", "signature", "idempotencyHeader"],
"additionalProperties": false,
"description": "How the automation takes requests from other apps at its incoming URL."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was last changed."
}
},
"required": [
"id",
"name",
"code",
"events",
"permissions",
"secretNames",
"isActive",
"templateKey",
"parameters",
"config",
"emails",
"inbound",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The deleted automation."
}POST /automations/{id}/test
Run the script once, now, on an event you describe, whether or not the automation is active. The run is not retried, and its api calls are real, so a script that writes will write. Your credential has to hold every permission the automation holds. Poll the run for its logs and result.
Requires the automations:write permission.
Path parameters
idstringrequiredThe ID of the automation.
Body parameters
eventNamecustomer.created | customer.updated | customer.deleted | order.created | order.updated | order.deleted | product.created | product.updated | product.deleted | productVariant.updated | review.created | review.updated | review.deleted | review.published | reviewQuestion.created | reviewQuestion.updated | reviewQuestion.deleted | site.created | site.updated | site.deleted | emailTemplate.created | emailTemplate.updated | emailTemplate.deleted | survey.deleted | reviewRequest.eligible | reviewRequest.canceled | loyaltyProgram.created | loyaltyProgram.updated | loyaltyProgram.deleted | loyaltyRule.created | loyaltyRule.updated | loyaltyRule.deleted | loyaltyTier.created | loyaltyTier.updated | loyaltyTier.deleted | loyaltyMembership.created | loyaltyMembership.updated | loyaltyMembership.deleted | loyaltyMembership.tierChanged | loyaltyMembership.pointsEarned | loyaltyTransaction.created | loyaltyReward.issued | loyaltyReward.claimed | loyaltyReward.redeemed | loyaltyReward.revoked | loyaltyReward.expired | loyaltyReward.expiringSoon | loyaltyPoints.expiringSoon | wishlist.created | wishlist.updated | wishlist.deleted | webhook.created | webhook.updated | webhook.deleted | metadataDefinition.created | metadataDefinition.updated | metadataDefinition.deleted | schedule.hourly | schedule.daily | inbound.receivedrequiredThe event to pretend happened.
dataunknownThe event's data, as a delivery would carry it. Leave it out to reuse the latest real event of that name (for inbound.received, the latest request to this automation's URL), or null when there has not been one.
curl \
-X POST \
"https://your-store.meisei.app/api/automations/A4Ws1igz/test" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"eventName": "customer.created",
"data": "..."
}'import { client } from "@meisei/api/admin/client"
import { postAutomationsByIdTest } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await postAutomationsByIdTest({
path: { id: "A4Ws1igz" },
body: {
eventName: "customer.created",
data: "...",
},
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.test(
"A4Ws1igz",
event_name: "customer.created",
data: "...",
)from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.test(
"A4Ws1igz",
event_name="customer.created",
data="...",
){
"id": "A4Ws1igz",
"automationId": "A4Ws1igz",
"eventName": "customer.created",
"idempotencyKey": "string",
"event": "...",
"isTest": true,
"status": "pending",
"attempts": 0,
"nextAttemptAt": "2025-01-15T09:30:00Z",
"logs": [
{
"level": "log",
"message": "string",
"at": "2025-01-15T09:30:00Z"
}
],
"returnValue": "...",
"error": "string",
"durationMs": 0,
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the run.",
"idCodec": "sqid"
},
"automationId": {
"type": "string",
"description": "The automation that ran.",
"idCodec": "sqid"
},
"eventName": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"idempotencyKey": {
"type": "string",
"description": "The event's own key, the same one its webhook deliveries carry. A script that writes elsewhere can use it to ignore a repeat."
},
"event": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the script was handed: the event's `name`, `idempotencyKey`, `timestamp` and `data`. For a request to the incoming URL, `data` holds its `method`, `headers`, `query` and `body`."
},
"isTest": {
"type": "boolean",
"description": "Whether someone started the run by hand to try the script."
},
"status": {
"type": "string",
"enum": ["pending", "retrying", "succeeded", "failed"],
"description": "How the run stands: `pending` until it has run, `retrying` after the script threw and another attempt is scheduled, `succeeded` once it finished without throwing, and `failed` once every attempt was used up."
},
"attempts": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "How many times the script has run for this event. A script that throws is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours, so there are at most 6. Tests and reruns are tried once."
},
"nextAttemptAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the next attempt is scheduled, while the run is `retrying`."
},
"logs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"level": {
"type": "string",
"enum": ["log", "info", "warn", "error"],
"description": "The console method that wrote it."
},
"message": {
"type": "string",
"description": "What the script logged."
},
"at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When it was logged."
}
},
"required": ["level", "message", "at"],
"additionalProperties": false
},
"description": "What the script wrote to the console on its latest attempt."
},
"returnValue": {
"description": "What the script returned on its latest attempt, as `{ value }`, or `{ truncated, preview }` when it was too big to keep. Null when it returned nothing."
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "What the script threw on its latest attempt, if it threw."
},
"durationMs": {
"anyOf": [
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
{
"type": "null"
}
],
"description": "How long the latest attempt took, in milliseconds."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was queued."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was last attempted."
}
},
"required": [
"id",
"automationId",
"eventName",
"idempotencyKey",
"event",
"isTest",
"status",
"attempts",
"nextAttemptAt",
"logs",
"returnValue",
"error",
"durationMs",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The run, `pending` until it has run."
}POST /automations/{id}/inbound-url
Make the automation's incoming URL: an address another app can post to, such as a WooCommerce or Stripe webhook, where each request runs the script with the request as its event. The automation has to run on inbound.received. The URL is returned once, here, and making a new one turns the old one off. Your credential has to hold every permission the automation holds.
Requires the automations:write permission.
Path parameters
idstringrequiredThe ID of the automation.
curl \
-X POST \
"https://your-store.meisei.app/api/automations/A4Ws1igz/inbound-url" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { postAutomationsByIdInboundUrl } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await postAutomationsByIdInboundUrl({
path: { id: "A4Ws1igz" },
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.inbound_url.create("A4Ws1igz")from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.inbound_url.create("A4Ws1igz"){
"url": "string",
"token": "string",
"createdAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The address to give the other app. It is the whole credential and is not shown again, so keep it somewhere safe."
},
"token": {
"type": "string",
"description": "The token at the end of the address."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the address was made."
}
},
"required": ["url", "token", "createdAt"],
"additionalProperties": false,
"description": "The new incoming URL."
}DELETE /automations/{id}/inbound-url
Turn the automation's incoming URL off. A request to it is answered with a 404 from then on.
Requires the automations:write permission.
Path parameters
idstringrequiredThe ID of the automation.
curl \
-X DELETE \
"https://your-store.meisei.app/api/automations/A4Ws1igz/inbound-url" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { deleteAutomationsByIdInboundUrl } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await deleteAutomationsByIdInboundUrl({
path: { id: "A4Ws1igz" },
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.inbound_url.delete("A4Ws1igz")from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.inbound_url.delete("A4Ws1igz"){
"id": "A4Ws1igz",
"name": "string",
"code": "string",
"events": ["customer.created"],
"permissions": ["analytics:read"],
"secretNames": ["string"],
"isActive": true,
"templateKey": "string",
"parameters": [
{
"key": "string",
"label": "string",
"description": "string",
"type": "number",
"default": 0,
"min": 0,
"max": 0,
"integer": true
}
],
"config": "...",
"emails": [
{
"key": "string",
"name": "string",
"subject": "string",
"preheader": "string",
"body": "string",
"reason": "string",
"sampleData": "..."
}
],
"inbound": {
"urlCreatedAt": "2025-01-15T09:30:00Z",
"signature": {
"header": "string",
"secretName": "string",
"encoding": "hex",
"prefix": "string"
},
"idempotencyHeader": "string"
},
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the automation.",
"idCodec": "sqid"
},
"name": {
"type": "string",
"description": "What the automation is called in the dashboard."
},
"code": {
"type": "string",
"description": "The script, as a JavaScript module whose default export is `async function (event, { meisei, secrets, config })`."
},
"events": {
"type": "array",
"items": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"description": "The events the automation runs on, from the same list webhooks subscribe to, plus `inbound.received` when it takes requests at its incoming URL."
},
"permissions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"analytics:read",
"analytics:write",
"automations:read",
"automations:write",
"customers:read",
"customers:write",
"exports:read",
"exports:write",
"imports:read",
"imports:write",
"loyalty:read",
"loyalty:write",
"orders:read",
"orders:write",
"products:read",
"products:write",
"reviews:read",
"reviews:write",
"settings:read",
"settings:write",
"surveys:read",
"surveys:write",
"webhooks:read",
"webhooks:write",
"wishlists:read",
"wishlists:write"
],
"description": "One permission a secret key can hold, as `<resource group>:<read or write>`. Write covers creating, updating and deleting, and does not imply read."
},
"description": "The permissions the script's api calls are held to, as on a secret key."
},
"secretNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of the secrets the script can read. The values are never returned."
},
"isActive": {
"type": "boolean",
"description": "Whether the automation runs on its events."
},
"templateKey": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The template the automation was started from, if any."
},
"parameters": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "number"
},
"default": {
"description": "The value a new automation starts with.",
"type": "number"
},
"min": {
"description": "The lowest value allowed.",
"type": "number"
},
"max": {
"description": "The highest value allowed.",
"type": "number"
},
"integer": {
"description": "Whether only whole numbers are allowed.",
"type": "boolean"
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "text"
},
"default": {
"description": "The value a new automation starts with.",
"type": "string",
"maxLength": 1000
}
},
"required": ["key", "label", "type"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-zA-Z0-9]{0,39}$",
"description": "The name the script reads it under, as `config.<key>`."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard calls the field."
},
"description": {
"description": "Help text shown under the field.",
"type": "string",
"maxLength": 500
},
"type": {
"type": "string",
"const": "select"
},
"options": {
"minItems": 1,
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "What the script reads."
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"description": "What the dashboard shows."
}
},
"required": ["value", "label"],
"additionalProperties": false
},
"description": "The choices, in the order the dashboard lists them."
},
"default": {
"description": "The option a new automation starts with.",
"type": "string"
}
},
"required": ["key", "label", "type", "options"],
"additionalProperties": false
}
]
},
"description": "The settings the automation asks for, each a number, a piece of text or a choice from a list. The dashboard shows them as a form."
},
"config": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
"description": "The value of each parameter, by key. The script reads them as `config`."
},
"emails": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "What the script calls the email by when it sends it, unique within the automation."
},
"name": {
"type": "string",
"description": "What the dashboard calls the email."
},
"subject": {
"type": "string",
"description": "The subject line. It can use the same variables as the body, filled in as plain text."
},
"preheader": {
"type": "string",
"description": "The preview line an inbox shows after the subject. It can use the same variables as the body."
},
"body": {
"type": "string",
"description": "The email's own content, sent inside the store's default layout. `customer` and `site` are filled in by Meisei, and anything else comes from the `data` the script sends with it."
},
"reason": {
"type": "string",
"description": "Finishes the footer's \"You're receiving this because\" sentence, which ends with the store's name, such as \"you saved this to a wishlist at\"."
},
"sampleData": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the dashboard's preview fills the email's variables with, standing in for the `data` the script sends."
}
},
"required": ["key", "name", "subject", "preheader", "body", "reason", "sampleData"],
"additionalProperties": false
},
"description": "The emails the automation owns. Its script sends one to a customer with `POST /customers/{id}/send-email`, naming it by `key`."
},
"inbound": {
"type": "object",
"properties": {
"urlCreatedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the automation's incoming URL was made, or null while it has none. The URL itself is shown once, when it is made."
},
"signature": {
"anyOf": [
{
"type": "object",
"properties": {
"header": {
"type": "string",
"description": "The request header that carries the signature, such as `X-WC-Webhook-Signature`."
},
"secretName": {
"type": "string",
"description": "The automation's secret the sender signs with, by name. Its value is the HMAC key."
},
"encoding": {
"type": "string",
"enum": ["hex", "base64"],
"description": "How the signature is written: as hex digits or as base64."
},
"prefix": {
"type": "string",
"description": "Text the header puts before the signature, such as `sha256=`. Empty when there is none."
}
},
"required": ["header", "secretName", "encoding", "prefix"],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "The HMAC-SHA256 signature a request to the incoming URL has to carry, or null to take any request that has the URL."
},
"idempotencyHeader": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A header whose value names one delivery, such as `X-WC-Webhook-Delivery-ID`. A request repeating a value already received runs nothing, so a sender's retry runs once."
}
},
"required": ["urlCreatedAt", "signature", "idempotencyHeader"],
"additionalProperties": false,
"description": "How the automation takes requests from other apps at its incoming URL."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the automation was last changed."
}
},
"required": [
"id",
"name",
"code",
"events",
"permissions",
"secretNames",
"isActive",
"templateKey",
"parameters",
"config",
"emails",
"inbound",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The automation, with no incoming URL."
}GET /automations/{id}/runs
List an automation's recent runs, newest first, with what each one logged, returned or threw. Pass status=failed to find the runs that ran out of retries.
Requires the automations:read permission.
Path parameters
idstringrequiredThe ID of the automation.
Query parameters
limitnumberThe number of runs to return.
statuspending | retrying | succeeded | failedOnly return runs in this state.
curl \
"https://your-store.meisei.app/api/automations/A4Ws1igz/runs" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { getAutomationsByIdRuns } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await getAutomationsByIdRuns({
path: { id: "A4Ws1igz" },
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
page = meisei.automations.runs.list("A4Ws1igz")from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
page = meisei.automations.runs.list("A4Ws1igz"){
"data": [
{
"id": "A4Ws1igz",
"automationId": "A4Ws1igz",
"eventName": "customer.created",
"idempotencyKey": "string",
"event": "...",
"isTest": true,
"status": "pending",
"attempts": 0,
"nextAttemptAt": "2025-01-15T09:30:00Z",
"logs": ["..."],
"returnValue": "...",
"error": "string",
"durationMs": 0,
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}
],
"nextCursor": "string"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the run.",
"idCodec": "sqid"
},
"automationId": {
"type": "string",
"description": "The automation that ran.",
"idCodec": "sqid"
},
"eventName": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"idempotencyKey": {
"type": "string",
"description": "The event's own key, the same one its webhook deliveries carry. A script that writes elsewhere can use it to ignore a repeat."
},
"event": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the script was handed: the event's `name`, `idempotencyKey`, `timestamp` and `data`. For a request to the incoming URL, `data` holds its `method`, `headers`, `query` and `body`."
},
"isTest": {
"type": "boolean",
"description": "Whether someone started the run by hand to try the script."
},
"status": {
"type": "string",
"enum": ["pending", "retrying", "succeeded", "failed"],
"description": "How the run stands: `pending` until it has run, `retrying` after the script threw and another attempt is scheduled, `succeeded` once it finished without throwing, and `failed` once every attempt was used up."
},
"attempts": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "How many times the script has run for this event. A script that throws is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours, so there are at most 6. Tests and reruns are tried once."
},
"nextAttemptAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the next attempt is scheduled, while the run is `retrying`."
},
"logs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"level": {
"type": "string",
"enum": ["log", "info", "warn", "error"],
"description": "The console method that wrote it."
},
"message": {
"type": "string",
"description": "What the script logged."
},
"at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When it was logged."
}
},
"required": ["level", "message", "at"],
"additionalProperties": false
},
"description": "What the script wrote to the console on its latest attempt."
},
"returnValue": {
"description": "What the script returned on its latest attempt, as `{ value }`, or `{ truncated, preview }` when it was too big to keep. Null when it returned nothing."
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "What the script threw on its latest attempt, if it threw."
},
"durationMs": {
"anyOf": [
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
{
"type": "null"
}
],
"description": "How long the latest attempt took, in milliseconds."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was queued."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was last attempted."
}
},
"required": [
"id",
"automationId",
"eventName",
"idempotencyKey",
"event",
"isTest",
"status",
"attempts",
"nextAttemptAt",
"logs",
"returnValue",
"error",
"durationMs",
"createdAt",
"updatedAt"
],
"additionalProperties": false
},
"description": "The page of records, in the requested sort order."
},
"nextCursor": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Pass this back as `cursor` to fetch the next page. Null once the last page has been returned."
}
},
"required": ["data", "nextCursor"],
"additionalProperties": false
}GET /automations/{id}/runs/{runId}
Get a single run, with its logs, return value and any error.
Requires the automations:read permission.
Path parameters
idstringrequiredThe ID of the automation.
runIdstringrequiredThe ID of the run.
curl \
"https://your-store.meisei.app/api/automations/A4Ws1igz/runs/A4Ws1igz" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { getAutomationsByIdRunsByRunId } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await getAutomationsByIdRunsByRunId({
path: { id: "A4Ws1igz", runId: "A4Ws1igz" },
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.runs.retrieve("A4Ws1igz", "A4Ws1igz")from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.runs.retrieve("A4Ws1igz", "A4Ws1igz"){
"id": "A4Ws1igz",
"automationId": "A4Ws1igz",
"eventName": "customer.created",
"idempotencyKey": "string",
"event": "...",
"isTest": true,
"status": "pending",
"attempts": 0,
"nextAttemptAt": "2025-01-15T09:30:00Z",
"logs": [
{
"level": "log",
"message": "string",
"at": "2025-01-15T09:30:00Z"
}
],
"returnValue": "...",
"error": "string",
"durationMs": 0,
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the run.",
"idCodec": "sqid"
},
"automationId": {
"type": "string",
"description": "The automation that ran.",
"idCodec": "sqid"
},
"eventName": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"idempotencyKey": {
"type": "string",
"description": "The event's own key, the same one its webhook deliveries carry. A script that writes elsewhere can use it to ignore a repeat."
},
"event": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the script was handed: the event's `name`, `idempotencyKey`, `timestamp` and `data`. For a request to the incoming URL, `data` holds its `method`, `headers`, `query` and `body`."
},
"isTest": {
"type": "boolean",
"description": "Whether someone started the run by hand to try the script."
},
"status": {
"type": "string",
"enum": ["pending", "retrying", "succeeded", "failed"],
"description": "How the run stands: `pending` until it has run, `retrying` after the script threw and another attempt is scheduled, `succeeded` once it finished without throwing, and `failed` once every attempt was used up."
},
"attempts": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "How many times the script has run for this event. A script that throws is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours, so there are at most 6. Tests and reruns are tried once."
},
"nextAttemptAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the next attempt is scheduled, while the run is `retrying`."
},
"logs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"level": {
"type": "string",
"enum": ["log", "info", "warn", "error"],
"description": "The console method that wrote it."
},
"message": {
"type": "string",
"description": "What the script logged."
},
"at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When it was logged."
}
},
"required": ["level", "message", "at"],
"additionalProperties": false
},
"description": "What the script wrote to the console on its latest attempt."
},
"returnValue": {
"description": "What the script returned on its latest attempt, as `{ value }`, or `{ truncated, preview }` when it was too big to keep. Null when it returned nothing."
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "What the script threw on its latest attempt, if it threw."
},
"durationMs": {
"anyOf": [
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
{
"type": "null"
}
],
"description": "How long the latest attempt took, in milliseconds."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was queued."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was last attempted."
}
},
"required": [
"id",
"automationId",
"eventName",
"idempotencyKey",
"event",
"isTest",
"status",
"attempts",
"nextAttemptAt",
"logs",
"returnValue",
"error",
"durationMs",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The requested run."
}POST /automations/{id}/runs/{runId}/rerun
Run the script again for the same event, now, with the automation's current script. It is one attempt and is not retried on its own if it fails. Use it after fixing a script that failed. Your credential has to hold every permission the automation holds.
Requires the automations:write permission.
Path parameters
idstringrequiredThe ID of the automation.
runIdstringrequiredThe ID of the run.
curl \
-X POST \
"https://your-store.meisei.app/api/automations/A4Ws1igz/runs/A4Ws1igz/rerun" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"import { client } from "@meisei/api/admin/client"
import { postAutomationsByIdRunsByRunIdRerun } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await postAutomationsByIdRunsByRunIdRerun({
path: { id: "A4Ws1igz", runId: "A4Ws1igz" },
})require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
result = meisei.automations.runs.rerun("A4Ws1igz", "A4Ws1igz")from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
result = meisei.automations.runs.rerun("A4Ws1igz", "A4Ws1igz"){
"id": "A4Ws1igz",
"automationId": "A4Ws1igz",
"eventName": "customer.created",
"idempotencyKey": "string",
"event": "...",
"isTest": true,
"status": "pending",
"attempts": 0,
"nextAttemptAt": "2025-01-15T09:30:00Z",
"logs": [
{
"level": "log",
"message": "string",
"at": "2025-01-15T09:30:00Z"
}
],
"returnValue": "...",
"error": "string",
"durationMs": 0,
"createdAt": "2025-01-15T09:30:00Z",
"updatedAt": "2025-01-15T09:30:00Z"
}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the run.",
"idCodec": "sqid"
},
"automationId": {
"type": "string",
"description": "The automation that ran.",
"idCodec": "sqid"
},
"eventName": {
"type": "string",
"enum": [
"customer.created",
"customer.updated",
"customer.deleted",
"order.created",
"order.updated",
"order.deleted",
"product.created",
"product.updated",
"product.deleted",
"productVariant.updated",
"review.created",
"review.updated",
"review.deleted",
"review.published",
"reviewQuestion.created",
"reviewQuestion.updated",
"reviewQuestion.deleted",
"site.created",
"site.updated",
"site.deleted",
"emailTemplate.created",
"emailTemplate.updated",
"emailTemplate.deleted",
"survey.deleted",
"reviewRequest.eligible",
"reviewRequest.canceled",
"loyaltyProgram.created",
"loyaltyProgram.updated",
"loyaltyProgram.deleted",
"loyaltyRule.created",
"loyaltyRule.updated",
"loyaltyRule.deleted",
"loyaltyTier.created",
"loyaltyTier.updated",
"loyaltyTier.deleted",
"loyaltyMembership.created",
"loyaltyMembership.updated",
"loyaltyMembership.deleted",
"loyaltyMembership.tierChanged",
"loyaltyMembership.pointsEarned",
"loyaltyTransaction.created",
"loyaltyReward.issued",
"loyaltyReward.claimed",
"loyaltyReward.redeemed",
"loyaltyReward.revoked",
"loyaltyReward.expired",
"loyaltyReward.expiringSoon",
"loyaltyPoints.expiringSoon",
"wishlist.created",
"wishlist.updated",
"wishlist.deleted",
"webhook.created",
"webhook.updated",
"webhook.deleted",
"metadataDefinition.created",
"metadataDefinition.updated",
"metadataDefinition.deleted",
"schedule.hourly",
"schedule.daily",
"inbound.received"
],
"description": "An event name in `resource.action` form, or `inbound.received` for a request to the automation's incoming URL."
},
"idempotencyKey": {
"type": "string",
"description": "The event's own key, the same one its webhook deliveries carry. A script that writes elsewhere can use it to ignore a repeat."
},
"event": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "What the script was handed: the event's `name`, `idempotencyKey`, `timestamp` and `data`. For a request to the incoming URL, `data` holds its `method`, `headers`, `query` and `body`."
},
"isTest": {
"type": "boolean",
"description": "Whether someone started the run by hand to try the script."
},
"status": {
"type": "string",
"enum": ["pending", "retrying", "succeeded", "failed"],
"description": "How the run stands: `pending` until it has run, `retrying` after the script threw and another attempt is scheduled, `succeeded` once it finished without throwing, and `failed` once every attempt was used up."
},
"attempts": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "How many times the script has run for this event. A script that throws is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours, so there are at most 6. Tests and reruns are tried once."
},
"nextAttemptAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
},
{
"type": "null"
}
],
"description": "When the next attempt is scheduled, while the run is `retrying`."
},
"logs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"level": {
"type": "string",
"enum": ["log", "info", "warn", "error"],
"description": "The console method that wrote it."
},
"message": {
"type": "string",
"description": "What the script logged."
},
"at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When it was logged."
}
},
"required": ["level", "message", "at"],
"additionalProperties": false
},
"description": "What the script wrote to the console on its latest attempt."
},
"returnValue": {
"description": "What the script returned on its latest attempt, as `{ value }`, or `{ truncated, preview }` when it was too big to keep. Null when it returned nothing."
},
"error": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "What the script threw on its latest attempt, if it threw."
},
"durationMs": {
"anyOf": [
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
{
"type": "null"
}
],
"description": "How long the latest attempt took, in milliseconds."
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was queued."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
"description": "When the run was last attempted."
}
},
"required": [
"id",
"automationId",
"eventName",
"idempotencyKey",
"event",
"isTest",
"status",
"attempts",
"nextAttemptAt",
"logs",
"returnValue",
"error",
"durationMs",
"createdAt",
"updatedAt"
],
"additionalProperties": false,
"description": "The run, marked `pending` until it has run."
}