@all2cf/shopify-send
v0.1.0
Published
CFsend adapter for transactional email and consented customer events in Shopify apps
Readme
All2CF Send for Shopify apps
This adapter sends transactional email created by a custom or public Shopify app, including webhook and Shopify Flow action handlers. Use the webhook/event ID as the idempotency key.
It does not claim to replace Shopify-owned order, shipping or account notifications. Shopify does not expose a global third-party mail transport for those platform messages.
npm install @all2cf/shopify-sendimport { createShopifyMailer } from "@all2cf/shopify-send";
const mail = createShopifyMailer({
runtimeUrl: process.env.ALL2CF_SEND_URL,
apiKey: process.env.ALL2CF_SEND_KEY,
defaultFrom: "[email protected]",
});
await mail.send({
eventId: webhookId,
shop: shopDomain,
to: customer.email,
template: { id: "back-in-stock", variables: { product: title } },
});
// Optional audience/event sync. CFsend owns consent, segments, campaigns and
// unsubscribe state; the app only forwards normalized Shopify data.
await mail.sync({
audienceName: "Shopify customers",
contacts: [{ email: customer.email, firstName: customer.first_name, properties: { shopifyId: customer.id } }],
events: [{ id: `order:${order.id}`, type: "order.created", email: customer.email, properties: { orderId: order.id, total: order.total_price } }],
});