Report Toaster: Pirate Ship Integration
Email Pirate Ship exports to Mechanic and add those shipping costs to orders with Report Toaster.
Try this taskWhen it runs
Occurs when your Mechanic account receives an email
What you choose
- Email subject
- Order name column
- Prepend pound sign to order name
- Shipping cost column
Documentation
Email Pirate Ship exports to Mechanic and add those shipping costs to orders with Report Toaster.
Did you know your store has its very own email address for triggering Mechanic tasks? A store at example.myshopify.com can receive email at example@mail.usemechanic.com.
One or more attachments can be sent and will be processed as long as they meet the following requirements:
- The email subject must match the email subject set in the task options.
- The CSV attachment format matches the order and shipping column names set in the task options.
- If the order name data does not include the # sign and your shop does, use the prepend pound sign to order name option.
Each attachment will be parsed and sent to Report Toaster.
Task code and subscriptions
You can edit the Liquid code after installing this task. View on GitHub or ask a question in the Mechanic Slack community.
Subscriptions
mechanic/emails/received
How task subscriptions work
Option types and flags
- Email subject (required)
- Order name column (required)
- Prepend pound sign to order name (boolean)
- Shipping cost column (required)
Task code
{% comment %}
An opinion about option order
{{ options.email_subject__required }}
{{ options.order_name_column__required }}
{{ options.prepend_pound_sign_to_order_name__boolean }}
{{ options.shipping_cost_column__required }}
{% endcomment %}
{% assign updates = array %}
{% if event.preview %}
{% assign update = hash %}
{% assign update["name"] = "#1234" %}
{% assign update["shipping_cost"] = 1.23 %}
{% assign updates[updates.size] = update %}
{% assign email = hash %}
{% assign email["subject"] = options.email_subject__required %}
{% endif %}
{% if email.subject == options.email_subject__required %}
{% for attachment in email.attachments %}
{% assign shipments = attachment.content | decode_base64 | parse_csv: headers: true %}
{% for shipment in shipments %}
{% assign order_name = shipment[options.order_name_column__required] %}
{% assign shipping_cost = shipment[options.shipping_cost_column__required] %}
{% if order_name != blank %}
{% if options.prepend_pound_sign_to_order_name__boolean %}
{% assign order_name = order_name | prepend: "#" %}
{% endif %}
{% assign update = hash %}
{% assign update["name"] = order_name %}
{% assign update["shipping_cost"] = shipping_cost %}
{% assign updates[updates.size] = update %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if updates != empty %}
{% action "report_toaster" %}
{
"operation": "update",
"Order": {{ updates | json }}
}
{% endaction %}
{% endif %}
Mechanic Liquid reference
Default option values
- Email subject
Shipping Costs- Order name column
Order ID- Prepend pound sign to order name
true- Shipping cost column
Cost