The example message that you shared will be a result of several Shopify API resources combined. To iterate step by setp, you will need to use the following 3 API resources.
- Order
- Fulfillment
- Fulfillment Event
First from the Order resource, have look at fulfillment_status field. Valid values are
- shipped: Show orders that have been shipped.
- partial: Show partially shipped orders.
- unshipped: Show orders that have not yet been shipped
From the Fulfillment resource, have look at status and shipment_status fields.
From the FulfillmentEvent resource, have look at estimated_delivery_at and status field.
Combined these fields together, you have the information if any of the items are fulfilled, shipment status and estimated delivery date.
You can have a look at code inside Shopify Email templates that are sent on Shipping Confirmation etc.
Sample Code from Shipping Confirmation Email
{% if fulfillment.item_count == item_count %}
{% capture email_title %}Your order is on the way{% endcapture %}
{% capture email_body %}Your order is on the way. Track your shipment to see the delivery status.{% endcapture %}
{% elsif fulfillment.item_count > 1 %}
{% if fulfillment_status == 'fulfilled' %}
{% capture email_title %}The last items in your order are on the way{% endcapture %}
{% capture email_body %}The last items in your order are on the way. Track your shipment to see the delivery status.{% endcapture %}
{% else %}
{% capture email_title %}Some items in your order are on the way{% endcapture %}
{% capture email_body %}Some items in your order are on the way. Track your shipment to see the delivery status.{% endcapture %}
{% endif %}
{% else %}
{% if fulfillment_status == 'fulfilled' %}
{% capture email_title %}The last item in your order is on the way{% endcapture %}
{% capture email_body %}The last item in your order is on the way. Track your shipment to see the delivery status.{% endcapture %}
{% else %}
{% capture email_title %}One item in your order is on the way{% endcapture %}
{% capture email_body %}One item in your order is on the way. Track your shipment to see the delivery status.{% endcapture %}
{% endif %}
{% endif %}
{% capture email_emphasis %}Estimated delivery date: <strong>{{fulfillment.estimated_delivery_at | date: "%B %-d, %Y"}}</strong>{% endcapture %}