Log info to Mesa Logs.
Name | Type | Description | |
---|---|---|---|
message |
string
|
||
meta |
object
|
Optional |
Void
Log a warning to Mesa Logs.
Name | Type | Description | |
---|---|---|---|
message |
string
|
||
meta |
object
|
Optional |
Void
Log an error to Mesa Logs.
Name | Type | Description | |
---|---|---|---|
message |
string
|
||
meta |
object
|
Optional |
Void
Log info to Mesa Logs only if the Automation is in Debug Mode.
Name | Type | Description | |
---|---|---|---|
message |
string
|
||
meta |
object
|
Optional |
Void
Make a GET request to an external Rest API.
Name | Type | Description | |
---|---|---|---|
path |
string
|
||
options |
object
|
Optional | |
options.json |
bool
|
Automatically add JSON Content-Type headers and decode the response. Default: |
Optional |
options.query |
object
|
Parameters to append to the querystring. |
Optional |
options.headers |
object
|
Headers to send to the request. |
Optional |
options.include_headers |
bool
|
Include headers in the response. The response format will be |
Optional |
options.debug |
bool
|
Log request information and response headers. Defaults to |
Optional |
options.debug_exclude_headers |
array
|
Exclude headers from debugging information to keep secret keys a secret. An array of header keys (example: |
Optional |
options.stringify_large_ints |
bool
|
If JSON response, and response has ints over the JS max int, will traverse entire payload and cast long ints to strings |
Optional |
string
object
The response returned by the request. object
if options.json
is true
, string
if options.json
is false
.
Make a POST request to an external Rest API.
Name | Type | Description | |
---|---|---|---|
path |
string
|
||
data |
object
|
||
options |
object
|
Optional | |
options.json |
bool
|
Automatically add JSON Content-Type headers and decode the response. Default: |
Optional |
options.query |
object
|
Parameters to append to the querystring. |
Optional |
options.headers |
object
|
Headers to send to the request. |
Optional |
options.include_headers |
bool
|
Include headers in the response. The response format will be |
Optional |
options.debug |
bool
|
Log request information and response headers. Defaults to |
Optional |
options.debug_exclude_headers |
array
|
Exclude headers from debugging information to keep secret keys a secret. An array of header keys (example: |
Optional |
options.stringify_large_ints |
bool
|
If JSON response, and response has ints over the JS max int, will traverse entire payload and cast long ints to strings |
Optional |
string
object
The response returned by the request. object
if options.json
is true
, string
if options.json
is false
.
Make a PUT request to an external Rest API.
Name | Type | Description | |
---|---|---|---|
path |
string
|
||
data |
object
|
||
options |
object
|
Optional | |
options.json |
bool
|
Automatically add JSON Content-Type headers and decode the response. Default: |
Optional |
options.query |
object
|
Parameters to append to the querystring. |
Optional |
options.headers |
object
|
Headers to send to the request. |
Optional |
options.include_headers |
bool
|
Include headers in the response. The response format will be |
Optional |
options.debug |
bool
|
Log request information and response headers. Defaults to |
Optional |
options.debug_exclude_headers |
array
|
Exclude headers from debugging information to keep secret keys a secret. An array of header keys (example: |
Optional |
options.stringify_large_ints |
bool
|
If JSON response, and response has ints over the JS max int, will traverse entire payload and cast long ints to strings |
Optional |
string
object
The response returned by the request. object
if options.json
is true
, string
if options.json
is false
.
Make a PATCH request to an external Rest API.
Name | Type | Description | |
---|---|---|---|
path |
string
|
||
data |
object
|
||
options |
object
|
Optional | |
options.json |
bool
|
Automatically add JSON Content-Type headers and decode the response. Default: |
Optional |
options.query |
object
|
Parameters to append to the querystring. |
Optional |
options.headers |
object
|
Headers to send to the request. |
Optional |
options.include_headers |
bool
|
Include headers in the response. The response format will be |
Optional |
options.debug |
bool
|
Log request information and response headers. Defaults to |
Optional |
options.debug_exclude_headers |
array
|
Exclude headers from debugging information to keep secret keys a secret. An array of header keys (example: |
Optional |
options.stringify_large_ints |
bool
|
If JSON response, and response has ints over the JS max int, will traverse entire payload and cast long ints to strings |
Optional |
string
object
The response returned by the request. object
if options.json
is true
, string
if options.json
is false
.
Make a DELETE request to an external Rest API.
Name | Type | Description | |
---|---|---|---|
path |
string
|
||
options |
object
|
Optional | |
options.json |
bool
|
Automatically add JSON Content-Type headers and decode the response. Default: |
Optional |
options.query |
object
|
Parameters to append to the querystring. |
Optional |
options.headers |
object
|
Headers to send to the request. |
Optional |
options.include_headers |
bool
|
Include headers in the response. The response format will be |
Optional |
options.debug |
bool
|
Log request information and response headers. Defaults to |
Optional |
options.debug_exclude_headers |
array
|
Exclude headers from debugging information to keep secret keys a secret. An array of header keys (example: |
Optional |
options.stringify_large_ints |
bool
|
If JSON response, and response has ints over the JS max int, will traverse entire payload and cast long ints to strings |
Optional |
string
object
The response returned by the request. object
if options.json
is true
, string
if options.json
is false
.
Make a request to an external Rest API.
Name | Type | Description | |
---|---|---|---|
method |
string
|
One of |
|
path |
string
|
||
data |
object
|
||
options |
object
|
Optional | |
options.json |
bool
|
Automatically add JSON Content-Type headers and decode the response. Default: |
Optional |
options.query |
object
|
Parameters to append to the querystring. |
Optional |
options.headers |
object
|
Headers to send to the request. |
Optional |
options.include_headers |
bool
|
Include headers in the response. The response format will be |
Optional |
options.debug |
bool
|
Log request information and response headers. Defaults to |
Optional |
options.debug_exclude_headers |
array
|
Exclude headers from debugging information to keep secret keys a secret. An array of header keys (example: |
Optional |
options.stringify_large_ints |
bool
|
If JSON response, and response has ints over the JS max int, will traverse entire payload and cast long ints to strings |
Optional |
string
object
The response returned by the request. object
if options.json
is true
, string
if options.json
is false
.
Base-64 encode a string.
This is helpful when building an Authorization
header for basic auth requests.
Name | Type | Description | |
---|---|---|---|
string |
string
|
The string to encode |
string
The base-64 encoded version of the input string parameter.
Base64 decode a string. Decodes data encoded with MIME base64
Name | Type | Description | |
---|---|---|---|
string |
string
|
The base-64 encoded version of the input string parameter. |
|
strict |
bool
|
If the strict parameter is set to TRUE then the base64_decode() function will return FALSE if the input contains character from outside the base64 alphabet. Defaults to FALSE. |
Optional |
string
The decoded string.
Generate a hash of a string. This is helpful when creating signed requests.
Name | Type | Description | |
---|---|---|---|
algorithm |
string
|
The algorithm to use. Options: |
|
string |
string
|
The string to create the hash from |
|
base64encode |
string
|
Should we base64-encode the raw value of the hash? |
Optional |
string
The raw binary data of the hash
Generate a keyed hash value using the HMAC method. This is helpful when creating signed requests.
Name | Type | Description | |
---|---|---|---|
algorithm |
string
|
The algorithm to use. Options: |
|
string |
string
|
The string to create the hash from |
|
string |
string
|
Shared secret key used for generating the HMAC variant of the message digest |
|
base64encode |
string
|
Should we base64-encode the raw value of the hash? |
Optional |
string
The raw binary data of the hash
Pauses execution
Name | Type | Description | |
---|---|---|---|
$seconds |
int
|
Get a secret.
Name | Type | Description | |
---|---|---|---|
key |
string
|
||
defaultValue |
string
|
A default value to use if the secret cannot be found. If |
Optional |
string
The secret value.
Save a secret value.
Name | Type | Description | |
---|---|---|---|
key |
string
|
The credential key or id. |
|
value |
string
|
The value to save. This will be encrypted at rest, and can contained a stringified JSON array. |
|
options |
object
|
Optional | |
options.oauth_provider |
bool
|
Optional | |
options.oauth_scope |
object
|
Optional | |
options.trigger_type |
object
|
Optional |
Void
Get a storage item
Name | Type | Description | |
---|---|---|---|
sql |
string
|
The SQL query to run |
array
The result of the query.
Get a storage item
Name | Type | Description | |
---|---|---|---|
key |
string
|
||
defaultValue |
string
|
A default value to use if the storage key cannot be found. If |
Optional |
string
The storage value.
Get a storage item
Name | Type | Description | |
---|---|---|---|
key |
string
|
||
value |
string
|
Void
Render a liquid template with the params
passed.
Name | Type | Description | |
---|---|---|---|
template |
string
|
String representing a liquid template. |
|
params |
object
|
A keyed object of parameters to replace. |
string
The rendered template code.
Generates the URL for input webhooks
Name | Type | Description | |
---|---|---|---|
type |
string
|
Type of webhook: |
|
format |
string
|
Format of the returned data: |
|
automationId |
string
|
ID of the Automation |
|
key |
string
|
The key of the trigger |
string
array
The rendered template code.
Pass a payload to the service and call the next step in this Automation.
Name | Type | Description | |
---|---|---|---|
payload |
object
|
||
params |
object
|
Parameters to send to the output, such as tokens to construct a Shopify API url |
|
params.enqueue |
bool
|
Defaults to false. Set to true if you are exploding multiple tasks that can be run in parallel. |
Optional |
Void
Call an arbitrary output from a Mesa Script
Name | Type | Description | |
---|---|---|---|
outputKey |
string
|
||
payload |
object
|
||
enqueue |
bool
|
Defaults to false. Set to true if you are exploding multiple tasks that can be run in parallel. |
Void
Call another automation from a Mesa Script
Name | Type | Description | |
---|---|---|---|
automationKey |
string
|
In the form |
|
payload |
object
|
Void
Delete the file loaded by the Input.
Name | Type | Description | |
---|---|---|---|
filename |
string
|
Typically passed from |
Void
Move the file loaded by the Input to a new location.
Name | Type | Description | |
---|---|---|---|
filename |
string
|
Typically passed from |
|
destinationFilenameAndPath |
string
|
Void
Convert an XML file into an {object}. This function will condense XML namespaces into {namespaceSep = '_'} separated values: soapenv:Body becomes { soapenv_Body: {} }
Name | Type | Description | |
---|---|---|---|
xmlString |
string
|
The xml file to be decoded |
|
namespaceSep='_' |
string
|
Namespace separator for replacing soapenv:Body type values with soapenv_Body |
Optional |
object
Convert an object into an XML string.
Name | Type | Description | |
---|---|---|---|
xmlObject |
object
|
The object to be turned into xml. |
|
wrapReplace |
string
|
Replace the default |
Optional |
namespaceSep='_' |
string
|
Namespace separator for replacing soapenv_Body: {} values with soapenv:Body |
Optional |
// returns <?xml version="1.0" encoding="UTF-8"?><doc>\n <book>\n ...
Mesa.xml.encode({ book: { ... }});
// returns <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n <soapenv:Body>\n ...
Mesa.xml.encode({ soapenv_Body: { ... } }, '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">');
string
Check if xml is valid
Name | Type | Description | |
---|---|---|---|
xmlString |
string
|
// returns true
Mesa.xml.valid('<?xml version="1.0" encoding="UTF-8"?><doc><book><Name>My Book</Name></book></doc>');
// throws error about namespace
Mesa.xml.valid('<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope><book><Name>My Book</Name></book></soapenv:Envelope>');
bool
Convert a CSV file into an object. Keys will be matched from the first header row of the CSV file.
Name | Type | Description | |
---|---|---|---|
data |
string
|
||
returnObject |
bool
|
Defaults to |
Optional |
object
array
Convert an object a CSV string.
Name | Type | Description | |
---|---|---|---|
data |
object
|
||
headerRow |
bool
|
Defaults to |
Optional |
string
Push to a Virtual Output.
Name | Type | Description | |
---|---|---|---|
outputKey |
string
|
||
payload |
mixed
|
Void
Mark the matching Virtual Output records as cleared by the current Mesa Script.
Name | Type | Description | |
---|---|---|---|
outputKey |
string
|
Void
Mark a single Virtual Output record as cleared by the current Mesa Script.
Name | Type | Description | |
---|---|---|---|
outputKey |
string
|
||
mesaId |
string
|
The ID of the record to clear (returned as mesa_id in the Virtual Output). |
Void
Set the timezone to use to execute all script commands.
Name | Type | Description | |
---|---|---|---|
timezone |
string
|
The timezone identifier, like UTC or America/Los_Angeles. See a full list of TZ Database names. |
string
The timezone identifier, like UTC or Europe/Lisbon.
Returns a date as a formatted string.
Name | Type | Description | |
---|---|---|---|
format |
string
|
The format of the outputted date string. See full list of options. |
|
timestamp |
int
|
Defaults to now. Optional |
string
The formatted date string.
Send an email.
Name | Type | Description | |
---|---|---|---|
to |
string
|
||
subject |
string
|
||
body |
string
|
||
from |
string
|
All emails will be sent from [email protected]. The from email address will be used as the From name and reply-to email address. |
Optional |
Void