Stylograph API

Shopify

Send a card a set number of days after a qualifying order, and cancel it if the order is cancelled or refunded.

There is no Shopify app yet. A store can still send cards from its orders today, by calling the API from Shopify Flow or from Zapier.

What works today

Each paid order that qualifies calls POST /api/v1/notes with:

  • The shipping name and address as recipient. The key needs recipients:write.
  • scheduled_for set to the order date plus your delay, up to 90 days ahead. The note exists at once, shows in your Notes list, and goes to print on that day.
  • An Idempotency-Key built from the order, such as shopify-order-5551234567. A retried event then returns the same note and never sends twice.

When an order is cancelled or fully refunded before its card prints, cancel the card by that same key:

DELETE https://composer.stylograph.ai/api/v1/notes?idempotency_key=shopify-order-5551234567

The credits go back to the account. A partial refund keeps the card, so leave it alone.

A queued card can be cancelled until the printer starts on it. A cancel that comes after that answers 409 NOTE_NOT_CANCELLABLE and changes nothing. To leave time for a cancel, set scheduled_for a day or two out. See Cancelling.

Try the first one with "dry_run": true in the body. It runs every check, including the address, and sends nothing.

Shopify Flow

Flow's Send HTTP request action is on Shopify's Grow, Advanced and Plus plans. Check Shopify's own docs for the current plans.

  1. Trigger on the order being paid, or fulfilled if your delay should start when it ships.
  2. Add a condition for the product, tag or collection that qualifies.
  3. Send HTTP request: POST https://composer.stylograph.ai/api/v1/notes, with the headers Authorization: Bearer {{secrets.stylograph_key}}, Idempotency-Key: shopify-order-{{order.legacyResourceId}} and Content-Type: application/json. Keep the key in Flow's secrets, never in the body of the workflow.
  4. Flow can retry a failed request for up to a day. A retry with the same Idempotency-Key is safe. A 400 or 422 means the request itself is wrong, such as an address USPS doesn't confirm, and a retry won't fix it.
  5. A second workflow on cancellation or refund sends the DELETE above. Add a condition so only a full refund cancels.
{
  "format": "folded",
  "recipient": {
    "first_name": "{{order.shippingAddress.firstName}}",
    "last_name": "{{order.shippingAddress.lastName}}",
    "address_line1": "{{order.shippingAddress.address1}}",
    "address_line2": "{{order.shippingAddress.address2}}",
    "city": "{{order.shippingAddress.city}}",
    "state": "{{order.shippingAddress.provinceCode}}",
    "zip": "{{order.shippingAddress.zip}}"
  },
  "message": "Hi {{order.shippingAddress.firstName}}, thank you for your order.",
  "scheduled_for": "2027-01-15"
}

Build scheduled_for from the order date in Flow. For a delay longer than 90 days, add a Wait step first and set scheduled_for for the rest.

Zapier

This doesn't need Flow. Webhooks by Zapier needs a paid Zapier plan.

  1. Trigger: Shopify, New Paid Order.
  2. Filter: a line item matches the product that qualifies.
  3. Formatter, Date/Time: the order date plus your delay, written as YYYY-MM-DD.
  4. Webhooks by Zapier, Custom Request: the same POST, headers and body as above.

Zapier's own delay step can't wait 90 days, so keep the delay in scheduled_for, not in the Zap.

Without automation

Export the month's qualifying orders, import them as recipients in the Note Composer, and send them as a campaign. A campaign has one send date, so this works in monthly batches, not per order.

Things to plan for

  • The note is charged when it is sent, which can be up to 90 days before it mails. Cancelling gives the credits back.
  • The account sends 25 API notes in any 24 hours unless support raises it, counted on the day the order comes in. A busy sale day can pass that. Ask support to raise the limit before a launch or a sale.
  • A card scheduled at the first order goes out whether or not the customer is still a customer by then. If that matters, trigger on a later event, such as a renewal order, with a shorter delay.

Planned

A Shopify app: connect a store from Settings, pick the products that qualify, set the delay and the card, and it runs. It would handle cancellations and refunds on its own, and delays longer than 90 days. A first version would run as a custom app for a few beta stores. There is no date yet.

On this page