#Automation templates
GET /automation-templates
List the templates an automation can start from: ready-made scripts for common jobs, such as tagging loyalty tiers or posting reviews to Slack.
Requires the automations:read permission.
Request
curl \
"https://your-store.meisei.app/api/automation-templates" \
-H "Authorization: Bearer sk_YOUR_SECRET_KEY"Request
import { client } from "@meisei/api/admin/client"
import { getAutomationTemplates } from "@meisei/api/admin"
client.setConfig({
baseUrl: "https://your-store.meisei.app/api",
headers: { Authorization: "Bearer sk_YOUR_SECRET_KEY" },
})
const { data, error } = await getAutomationTemplates()Request
require "meisei"
meisei = Meisei::Client.new(
secret_key: "sk_YOUR_SECRET_KEY",
base_url: "https://your-store.meisei.app/api",
)
page = meisei.automation_templates.listRequest
from meisei import Client
meisei = Client(
secret_key="sk_YOUR_SECRET_KEY",
base_url="https://your-store.meisei.app/api",
)
page = meisei.automation_templates.list()Response
{
"data": [
{
"key": "string",
"name": "string",
"description": "string",
"events": ["..."],
"permissions": ["..."],
"secrets": ["..."],
"parameters": ["..."],
"emails": ["..."],
"inbound": {
"signature": "...",
"idempotencyHeader": "..."
},
"code": "string"
}
]
}Response schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "Pass it as `templateKey` when creating an automation from it."
},
"name": {
"type": "string",
"description": "What the template does, in a few words."
},
"description": {
"type": "string",
"description": "What the template does and when to use it."
},
"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 it runs on."
},
"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 its api calls need."
},
"secrets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The secret's name, as the script reads it."
},
"description": {
"type": "string",
"description": "What to put in it."
},
"optional": {
"description": "True when the script still runs without it, doing a little less.",
"type": "boolean"
}
},
"required": ["name", "description"],
"additionalProperties": false
},
"description": "The secrets it reads, which you fill in when creating it."
},
"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 it asks for, to pass as `parameters` when creating an automation from it. Every one has a default."
},
"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 its script sends, to pass as `emails` when creating an automation from it. Empty when it sends none."
},
"inbound": {
"anyOf": [
{
"type": "object",
"properties": {
"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"
}
]
},
"idempotencyHeader": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": ["signature", "idempotencyHeader"],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "How it checks a request to its incoming URL, to pass as `inbound` when creating an automation from it. Null when it takes no requests."
},
"code": {
"type": "string",
"description": "The script, to edit before or after creating the automation."
}
},
"required": [
"key",
"name",
"description",
"events",
"permissions",
"secrets",
"parameters",
"emails",
"inbound",
"code"
],
"additionalProperties": false
},
"description": "Every available template."
}
},
"required": ["data"],
"additionalProperties": false
}