MESA SDK

Mesa.log.info(message[, meta])

Log info to Mesa Logs.

Parameters

Returns

  • Void

Mesa.log.warn(message[, meta])

Log a warning to Mesa Logs.

Parameters

Returns

  • Void

Mesa.log.error(message[, meta])

Log an error to Mesa Logs.

Parameters

Returns

  • Void

Mesa.log.debug(message[, meta])

Log info to Mesa Logs only if the Automation is in Debug Mode.

Parameters

Returns

  • Void

Mesa.request.get(path, options)

Make a GET request to an external Rest API.

Parameters

Returns

  • Types.Response Types.ResponseRaw The response returned by the request. object if options.json is true, string if options.json is false.

Mesa.request.post(path, data, options)

Make a POST request to an external Rest API.

Parameters

Returns

  • Types.Response Types.ResponseRaw The response returned by the request. object if options.json is true, string if options.json is false.

Mesa.request.put(path, data, options)

Make a PUT request to an external Rest API.

Parameters

Returns

  • Types.Response Types.ResponseRaw The response returned by the request. object if options.json is true, string if options.json is false.

Mesa.request.patch(path, data, options)

Make a PATCH request to an external Rest API.

Parameters

Returns

  • Types.Response Types.ResponseRaw The response returned by the request. object if options.json is true, string if options.json is false.

Mesa.request.delete(path, options)

Make a DELETE request to an external Rest API.

Parameters

Returns

  • Types.Response Types.ResponseRaw The response returned by the request. object if options.json is true, string if options.json is false.

Mesa.request.send(method, path, data, options)

Make a request to an external Rest API.

Parameters

Returns

  • Types.Response Types.ResponseRaw The response returned by the request. object if options.json is true, string if options.json is false.

Mesa.request.base64_encode(string)

Base-64 encode a string. This is helpful when building an Authorization header for basic auth requests.

Parameters

Returns

  • string The base-64 encoded version of the input string parameter.

Mesa.request.base64_decode(string[, strict])

Base64 decode a string. Decodes data encoded with MIME base64

Parameters

Returns

  • string The decoded string.

Mesa.request.hash(algorithm, string[, base64encode])

Generate a hash of a string. This is helpful when creating signed requests.

Parameters

Returns

  • string The raw binary data of the hash

Mesa.request.hashHmac(algorithm, string, string[, base64encode])

Generate a keyed hash value using the HMAC method. This is helpful when creating signed requests.

Parameters

Returns

  • string The raw binary data of the hash

Mesa.request.sleep($seconds)

Pauses execution

Parameters

Returns

Mesa.credential.get(key[, defaultValue])

Get a secret.

Parameters

Returns

  • string The secret value.

Mesa.credential.set(key, value[, options])

Save a secret value.

Parameters

Returns

  • Void

Mesa.database.query(sql)

Get a storage item

Parameters

Returns

  • array The result of the query.

Mesa.storage.get(key[, defaultValue])

Get a storage item

Parameters

Returns

  • string The storage value.

Mesa.storage.set(key, value)

Get a storage item

Parameters

Returns

  • Void

Mesa.liquid.render(template, params)

Render a liquid template with the params passed.

Parameters

Returns

  • string The rendered template code.

Mesa.input.getWebhookUrl(type, format, automationId, key)

Generates the URL for input webhooks

Parameters

Returns

  • string array The rendered template code.

Mesa.output.next(payload, params)

Pass a payload to the service and call the next step in this Automation.

Parameters

Returns

  • Void

Mesa.output.send(outputKey, payload, enqueue)

Call an arbitrary output from a MESA Script

Parameters

Returns

  • Void

Mesa.automation.send(automationKey, payload)

Call another automation from a MESA Script

Parameters

Returns

  • Void

Mesa.ftp.deleteFile(filename)

Delete the file loaded by the Input.

Parameters

Returns

  • Void

Mesa.ftp.moveFile(filename, destinationFilenameAndPath)

Move the file loaded by the Input to a new location.

Parameters

Returns

  • Void

Mesa.xml.decode(xmlString[, namespaceSep='_'])

Convert an XML file into an {object}. This function will condense XML namespaces into {namespaceSep = '_'} separated values: soapenv:Body becomes { soapenv_Body: {} }

Parameters

Returns

  • object

Mesa.xml.encode(xmlObject[, wrapReplace, namespaceSep='_'])

Convert an object into an XML string.

Parameters

Examples

// 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">');

Returns

  • string

Mesa.xml.valid(xmlString)

Check if xml is valid

Parameters

Examples

// 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>');

Returns

  • bool

Mesa.csv.decode(data[, returnObject, options])

Convert a CSV file into an object. Keys will be matched from the first header row of the CSV file.

Parameters

Returns

  • object array

Mesa.csv.encode(data[, headerRow])

Convert an object a CSV string.

Parameters

Returns

  • string

Mesa.vo.push(outputKey, payload)

Push to a Virtual Output.

Parameters

Returns

  • Void

Mesa.vo.clear(outputKey)

Mark the matching Virtual Output records as cleared by the current Mesa Script.

Parameters

Returns

  • Void

Mesa.vo.clearOne(outputKey, mesaId)

Mark a single Virtual Output record as cleared by the current Mesa Script.

Parameters

Returns

  • Void

Mesa.date.setTimezone(timezone)

Set the timezone to use to execute all script commands.

Parameters

Returns

  • string The timezone identifier, like UTC or Europe/Lisbon.

Mesa.date.format(format, timestamp)

Returns a date as a formatted string.

Parameters

Returns

  • string The formatted date string.

Mesa.email.send(to, subject, body[, from])

Send an email.

Parameters

Returns

  • Void

Full list of MESA Libraries

Last updated