A Mesa Script exports a class with a script() method that is passed the following parameters:
Name | Type | Description | |
---|---|---|---|
payload |
object
|
The payload data |
|
context |
context
|
Contains data relative to the current task that is running. |
Void
context parameter
Name | Type | Description | |
---|---|---|---|
shop |
shop
|
Complete Shopify shop object |
|
shop.email |
string
|
Merchant's email address |
|
shop.myshopify_domain |
string
|
Shop string. Example: myshop.myshopify.com |
|
shop.myshopify_domain |
domain
|
Shop's domain if it has been customized, otherwise the myshopify domain |
|
steps |
object
|
An object containing the full payload for each step run in this automation so far, keyed by each step's key. For example |
|
automation |
trigger
|
The complete Trigger object contains information about the current step being run |
|
task |
task
|
The complete Task object contains information about this specific task run |
|
automation |
automation
|
The complete Automation object contains information about the workflow |
task model generated from https://transform.tools/json-to-jsdoc
Name | Type | Description | |
---|---|---|---|
is_test |
boolean
|
||
is_premium |
boolean
|
||
execution_time |
number
|
||
memory |
number
|
||
replay_of | |||
replayed_by | |||
replay_count |
number
|
||
automation |
object
|
||
automation._id |
string
|
||
automation.automation_name |
string
|
||
trigger |
object
|
||
trigger._id |
string
|
||
trigger.trigger_name |
string
|
||
trigger.trigger_type |
string
|
||
trigger.trigger_key |
string
|
||
trigger.task_id |
string
|
||
parents |
Array.<object>
|
||
parents._id |
string
|
||
parents.trigger_name |
string
|
||
parents.trigger_type |
string
|
||
parents.trigger_key |
string
|
||
parents.task_id |
string
|
||
depth_parent_id |
string
|
||
child_id | |||
child_fails |
number
|
||
source |
string
|
||
context |
object
|
||
context.headers |
object
|
A key-value object of all of the headers passed to this task (if it was an input) |
|
context.timestamp |
string
|
||
payload_hash |
string
|
A hash of the payload that is used to deduplicate duplicate webhooks |
|
billable |
boolean
|
Whether or not this was a billable task (criteria: is an input, not a test, etc) |
|
billable_amount |
number
|
The number of units this task cost (1 if just the input for an automation, 2 if it's the input of an automation that contains a premium step) |
|
unbillable_reason |
string
|
The reason this task is unbillable. |
|
external_id |
string
|
The ID of this object in the external system (shopify order id, etc) |
|
external_label |
string
|
A human-readable representation of this object in the external system (Shopify Order Name like #1001, etc) |
|
enqueued |
boolean
|
||
active |
boolean
|
||
_id | |||
created_at | |||
updated_at |
trigger model generated from https://transform.tools/json-to-jsdoc
Name | Type | Description | |
---|---|---|---|
schema |
number
|
||
version |
string
|
||
trigger_type |
string
|
||
is_premium |
boolean
|
||
is_pro |
boolean
|
||
uuid |
string
|
||
automation |
string
|
||
type |
string
|
||
entity |
string
|
||
action |
string
|
||
operation_id |
string
|
||
name |
string
|
||
key |
string
|
||
trigger_name |
string
|
||
metadata |
object
|
||
metadata.script |
string
|
||
metadata.mapping |
Array.<object>
|
||
metadata.mapping.destination |
string
|
||
metadata.mapping.source |
string
|
||
local_fields |
Array.<object>
|
Optional | |
local_fields.key |
string
|
||
local_fields.type |
string
|
||
local_fields.tokens |
string
|
||
local_fields.location |
string
|
||
weight |
number
|
||
script | |||
on_error |
string
|
||
_id |
string
|
||
created_at |
string
|
||
updated_at |
string
|
||
tokens_ignore_previous | |||
response |
Array.<object>
|
||
fields |
Array.<object>
|
||
fields.key |
string
|
||
fields.type |
string
|
||
fields.tokens |
string
|
||
fields.location |
string
|
||
fields.label |
string
|
||
fields.file |
string
|
||
response_example |
object
|
||
response_example.trigger_type |
string
|
||
response_example.connector |
string
|
||
response_example.title |
string
|
||
response_example.description |
string
|
||
response_example.icon |
string
|
||
response_example.endpoint |
string
|
||
response_example.operation_id |
string
|
||
response_example.key |
string
|
||
{} | request_example |
||
configuration_aside | |||
connector_name |
string
|
||
icon |
string
|
||
description |
string
|
||
raw_metadata |
object
|
The raw metadata without any token replacements. This can be helpful if we want to to have a field where the merchant enters a token (like Dropbox) |
Optional |
automation model generated from https://transform.tools/json-to-jsdoc
Name | Type | Description | |
---|---|---|---|
uuid |
string
|
||
key |
string
|
||
name |
string
|
||
version |
string
|
||
template |
string
|
||
prismic_uid |
string
|
||
helpscout_article_id |
string
|
||
description |
string
|
||
video |
string
|
||
readme |
string
|
||
readme_is_from_prismic |
boolean
|
||
show_readme |
boolean
|
||
is_premium |
boolean
|
||
enabled |
boolean
|
||
did_complete |
boolean
|
||
logging |
boolean
|
||
debug |
boolean
|
||
seconds |
number
|
||
notifications |
object
|
||
notifications.enabled |
boolean
|
||
_id |
string
|
||
created_at |
string
|
||
updated_at |
string
|
||
inputs |
array.trigger
|
||
outputs |
array.trigger
|
||
scripts |
array.script
|
||
source_entity |
string
|
||
{} | field_provides |
||
key_editable |
boolean
|
trigger model generated from https://transform.tools/json-to-jsdoc
Name | Type | Description | |
---|---|---|---|
schema |
number
|
||
version |
string
|
||
trigger_type |
string
|
||
is_premium |
boolean
|
||
is_pro |
boolean
|
||
uuid |
string
|
||
automation |
string
|
||
type |
string
|
||
entity |
string
|
||
action |
string
|
||
operation_id |
string
|
||
name |
string
|
||
key |
string
|
||
trigger_name |
string
|
||
metadata |
object
|
||
metadata.host |
string
|
||
metadata.allow_duplicate |
boolean
|
||
{} | local_fields |
||
weight |
number
|
||
script | |||
on_error | |||
_id |
string
|
||
created_at |
string
|
||
updated_at |
string
|
||
tokens_ignore_previous | |||
{} | response |
||
fields |
Array.<object>
|
||
fields.key |
string
|
||
fields.label |
string
|
||
fields.type |
string
|
||
fields.disabled |
boolean
|
||
fields.export |
boolean
|
||
fields.copy |
boolean
|
||
{} | response_example |
||
{} | request_example |
||
configuration_aside | |||
connector_name |
string
|
||
icon |
string
|
||
description |
string
|
script model generated from https://transform.tools/json-to-jsdoc
Name | Type | Description | |
---|---|---|---|
automation |
string
|
||
script_id |
string
|
||
filename |
string
|
||
version |
string
|
||
_id |
string
|
||
created_at |
string
|
||
updated_at |
string
|
shop model generated from https://transform.tools/json-to-jsdoc
Name | Type | Description | |
---|---|---|---|
id |
number
|
||
name |
string
|
||
string
|
|||
domain |
string
|
||
province |
string
|
||
country |
string
|
||
address1 |
string
|
||
zip |
string
|
||
city |
string
|
||
source | |||
phone |
string
|
||
latitude | |||
longitude | |||
primary_locale |
string
|
||
address2 | |||
created_at |
string
|
||
updated_at |
string
|
||
country_code |
string
|
||
country_name |
string
|
||
currency |
string
|
||
customer_email |
string
|
||
timezone |
string
|
||
iana_timezone |
string
|
||
shop_owner |
string
|
||
money_format |
string
|
||
money_with_currency_format |
string
|
||
weight_unit |
string
|
||
province_code |
string
|
||
taxes_included |
boolean
|
||
auto_configure_tax_inclusivity | |||
tax_shipping | |||
county_taxes |
boolean
|
||
plan_display_name |
string
|
||
plan_name |
string
|
||
has_discounts |
boolean
|
||
has_gift_cards |
boolean
|
||
myshopify_domain |
string
|
||
google_apps_domain | |||
google_apps_login_enabled | |||
money_in_emails_format |
string
|
||
money_with_currency_in_emails_format |
string
|
||
eligible_for_payments |
boolean
|
||
requires_extra_payments_agreement |
boolean
|
||
password_enabled |
boolean
|
||
has_storefront |
boolean
|
||
eligible_for_card_reader_giveaway |
boolean
|
||
finances |
boolean
|
||
primary_location_id |
number
|
||
cookie_consent_level |
string
|
||
visitor_tracking_consent_preference |
string
|
||
checkout_api_supported |
boolean
|
||
multi_location_enabled |
boolean
|
||
setup_required |
boolean
|
||
pre_launch_enabled |
boolean
|
||
enabled_presentment_currencies |
Array.<string>
|