Back to Arky

Broadcasts

One email, sent once, to the members of chosen packages and offerings

A broadcast is one email, sent once, to the members of chosen packages and offerings, like Klaviyo’s “send to” and “don’t send to”. A newsletter is a free package people join; each issue is a broadcast to its members. A broadcast to a gym’s Premium members isn’t a newsletter, and works the same way.

import type { Email, EpochMilliseconds } from "arky-sdk";

type BroadcastMembers =
	| { type: "package"; package_id: string }
	| { type: "package_offering"; package_offering_id: string };

interface Broadcast {
	id: string;
	store_id: string;
	key: string;
	audience: {
		include: BroadcastMembers[];
		exclude: BroadcastMembers[];
		conditions: (
			| { type: "ordered_product"; product_id: string }
			| { type: "ordered_within"; days: number }
			| { type: "not_ordered_within"; days: number }
		)[];
	};
	email: Email;
	status:
		| { type: "draft" }
		| { type: "scheduled"; send_at: EpochMilliseconds; content: BroadcastContent }
		| { type: "sending"; started_at: EpochMilliseconds; content: BroadcastContent }
		| { type: "sent"; started_at: EpochMilliseconds; recipient_count: number; content: BroadcastContent };
	created_at: EpochMilliseconds;
	updated_at: EpochMilliseconds;
}

interface BroadcastContent {
	default_language: string;
	translations: Record<string, { subject: string; preheader: string | null; html: string; text: string }>;
	layout: Record<string, { html: string; text: string }>;
	logo_media_id: string | null;
}

Routes

POST /v1/stores/{store_id}/broadcasts
SDK: sdk.broadcast.create()
GET /v1/stores/{store_id}/broadcasts
SDK: sdk.broadcast.find()
GET /v1/stores/{store_id}/broadcasts/{id}
SDK: sdk.broadcast.get()
PUT /v1/stores/{store_id}/broadcasts/{id}
SDK: sdk.broadcast.update()
DELETE /v1/stores/{store_id}/broadcasts/{id}?expected_updated_at=
SDK: sdk.broadcast.delete()
POST /v1/stores/{store_id}/broadcasts/{id}/schedule
SDK: sdk.broadcast.schedule()
POST /v1/stores/{store_id}/broadcasts/{id}/unschedule
SDK: sdk.broadcast.unschedule()
POST /v1/stores/{store_id}/broadcasts/{id}/send
SDK: sdk.broadcast.send()
POST /v1/stores/{store_id}/broadcasts/{id}/preview
SDK: sdk.broadcast.preview()
POST /v1/stores/{store_id}/broadcasts/{id}/test
SDK: sdk.broadcast.test()
POST /v1/broadcasts/unsubscribe?token=
SDK: arky.broadcast.unsubscribe()
import { epochMilliseconds } from "arky-sdk/utils";

const { creation_templates } = await sdk.store.emails.get({ store_id: storeId });

const draft = await sdk.broadcast.create({
	store_id: storeId,
	id: crypto.randomUUID(),
	key: "november-news",
	audience: {
		include: [{ type: "package", package_id: newsletter.id }],
		exclude: [],
		conditions: [{ type: "ordered_within", days: 365 }],
	},
	email: {
		email_template_id: creation_templates.broadcast,
		sending_address_id: news.id,
		from_name: "Northwind",
		reply_to: { type: "address", email_address_id: news.id },
	},
});

const scheduled = await sdk.broadcast.schedule({
	store_id: storeId,
	id: draft.id,
	expected_updated_at: draft.updated_at,
	send_at: epochMilliseconds(Date.UTC(2026, 10, 1, 8, 0)),
});

Parameters

Name Type Description
id required string The broadcast id the app picks (UUID v4).
key required string The label staff see.
audience required BroadcastAudience The packages and offerings to include and exclude, and the conditions every recipient matches.
email required Email The complete selection: a broadcast template, a sending address of the store, the sender name and the reply-to.

Rules

  1. Audience. include names at least one package or offering, and include and exclude each name at most 32 (409 BROADCAST.AUDIENCE_LIMIT); an entry is never both included and excluded, and each kind of condition appears at most once. A recipient is a person member of an included package or offering who is in no excluded one and matches every condition: ordered_product (a kept purchase with a confirmed line of any variant of that product), ordered_within (the newest kept purchase was placed at most that many days ago) and not_ordered_within (no kept purchase in that many days). A kept purchase is an order that isn’t a free sign-up and has at least one line confirmed now: expired or failed checkouts and fully cancelled orders don’t count. To leave one person out, put them in a package and exclude it.
  2. The template. email selects a broadcast template with its layout, the sending address, the sender name and the reply-to. Its wording uses only the broadcast’s fields: the customer’s email (customer.email) and blocks (customer.profile.<key>, customer.blocks.<key>), the store (store.name), the member’s package and its offering (package_member.package.key and .blocks.<key>, package_member.package_offering.key and .blocks.<key>), unsubscribe_url, and {{media "<id>"}} for a picture from the store’s media; its HTML and its text both print {{unsubscribe_url}}, or {{unsubscribe_token}} in a link to the store’s own unsubscribe page. The store’s creation_templates.broadcast names the starter.
  3. Languages. A person gets the language of their verified contact when the template has it, and the template’s default language otherwise. Text that can’t be built from a person’s data, such as a subject that comes out empty, records that person’s email not_sent with render_failed: <reason>, and it still counts.
  4. Who gets it: person members who joined with an order, joined before sending began and still count when their batch is made, at an email the customer proved with a sign-in code, never at an address the store suppressed (unsubscribed, blocked, bounced or complained). Members the team assigned without an order, and company or location members, get none. A cancelled member gets none, even while its paid period runs. Members and their orders are read from Arky’s own records, never from search, so nobody is missed while search catches up.
  5. Sending. Creating, editing and scheduling check the email selection against the saved setup, and scheduling needs a future send_at. Scheduling, or send of a draft, freezes the template’s translations, its layout and the default language into the status as content, so a later template edit changes nothing already scheduled or sent; a draft holds no copy, and send of a scheduled broadcast keeps what scheduling froze. At send_at, or at once with send, the broadcast becomes sending; a scheduled broadcast whose sender can’t send, or whose store isn’t active or has no plan access, then goes back to draft instead. Arky makes one broadcast_email outgoing email per recipient, unique per broadcast and address, so a rerun makes no second email. It makes them 50 at a time, the next batch once the store’s share of Arky’s sending pace can take them, so the store’s other emails wait behind at most one batch; while the store’s sending is paused, or it has no plan access, it makes none and looks again later. Its Resend send key is broadcast:{id}:{hex}, the broadcast and the SHA-256 of the address, so a batch repeated after a restore sends nothing twice. When the walk ends the broadcast is sent, with recipient_count: the emails made, not the deliveries.
  6. Editing. Everything changes only while draft. A scheduled broadcast goes back to draft with unschedule. Every action carries the expected_updated_at it read. There is no stop: pausing the store’s email holds the queued emails and the batches, and allowing sending again sends them all.
  7. Unsubscribe. Every broadcast email has the one-click List-Unsubscribe headers, which name Arky’s address, and the body’s {{unsubscribe_url}} or {{unsubscribe_token}}: one signed token naming the store, the address and the broadcast. Arky’s own page is in English; a store that wants its own words links the template to a page on its site carrying {{unsubscribe_token}}, which posts it with arky.broadcast.unsubscribe({ token }) when the reader confirms. Opening Arky’s link only shows its confirmation; the one-click post records the store’s unsubscribe for the address, so a link scanner unsubscribes nobody. Arky checks it right before each send, so the address’s waiting broadcast emails end not_sent. It never ends a membership, paid or free. Signing up for a free package again, or resubscribe from the account, lifts it.
  8. Replies go to the selection’s reply-to. When that is a store address that receives, replies that a support flow’s entry takes become support conversations.
  9. Preview and test take a language and fill a sample: a draft shows its live template, a scheduled or sent broadcast its frozen content. test takes the outgoing_email_id the app picked for the click and sends to the signed-in person clicking.
  10. Deleting. A draft or scheduled broadcast is deleted in one write. Once sending starts it stays, with its count.
await sdk.broadcast.test({
	store_id: storeId,
	id: draft.id,
	outgoing_email_id: crypto.randomUUID(),
	language: "en",
});

const sent = await sdk.broadcast.find({ store_id: storeId, status: "sent", limit: 20 });
const emails = await sdk.notification.outgoingEmail.find({ store_id: storeId, broadcast_id: draft.id });
Note

Opens and clicks aren’t recorded on the broadcast. A broadcast is one email; a welcome series is a later feature. Broadcasts need the marketing permission, and the plan’s broadcasts limit counts the broadcasts not yet sent.

See the Newsletters guide for the sign-up side.