Back to Arky

Outgoing Email And Webhooks

Every email Arky sends and every webhook post, with its type and status

Email and webhook delivery evidence have separate records: OutgoingEmail and OutgoingWebhook. The business operation retains the outgoing record’s ID.

import type { OutgoingEmail, OutgoingWebhook } from "arky-sdk";

const emails = await sdk.notification.outgoingEmail.find({
  store_id: storeId,
  to: "[email protected]",
  limit: 20,
});
const email = await sdk.notification.outgoingEmail.get({
  store_id: storeId,
  id: outgoingEmailId,
});
const posts = await sdk.notification.outgoingWebhook.find({
  store_id: storeId,
  webhook_id: webhookId,
});

OutgoingEmail has id, type, to, email_provider_id, delivery_report, complained_at, preview, send_before, status, created_at and updated_at. Its tagged type is arky_sign_in, customer_sign_in, store_admin_sign_in, store_admin_invite, event_email, receipt_resend, template_test, broadcast_email or support_reply; every store email names its sending address, and email_provider_id is the connection it goes through, kept for every retry. Event emails retain the event and template IDs; receipt resends retain the Order ID. The email status is waiting, sending, retrying, sent, not_sent or maybe_sent. Sending and retrying carry the attempt and recovery evidence; terminal statuses retain provider acceptance or the factual refusal/uncertainty.

OutgoingWebhook retains store_id, webhook_id, event_id, event_type, status and timestamps. Its terminal status is acknowledged or unacknowledged.

History

GET /v1/stores/{store_id}/outgoing-emails
SDK: sdk.notification.outgoingEmail.find()
GET /v1/stores/{store_id}/outgoing-emails/{id}
SDK: sdk.notification.outgoingEmail.get()
GET /v1/stores/{store_id}/outgoing-webhooks
SDK: sdk.notification.outgoingWebhook.find()
GET /v1/stores/{store_id}/outgoing-webhooks/{id}
SDK: sdk.notification.outgoingWebhook.get()

Email filters are to, type and broadcast_id, with limit and cursor. order_id goes only with type: "receipt_resend" and finds that order’s receipt resends, the one email that names an order; any other use is refused with 400. To answer “I never got it”, filter by the recipient. Webhook history has a webhook_id filter and pagination.

  • Rows are summaries. find answers OutgoingEmailSummary rows whose preview holds the sender, sender name, reply-to, rendered language and subject. get answers the full OutgoingEmail, whose preview adds the final HTML and text.
  • Previews are redacted. The preview is an encrypted copy of the final message with login codes and private action links taken out, kept for the 30 days the email is kept. Sign-in codes are never previewed, and a preview that can’t be read back is null for that email only. A preview is never a way to send the email again.
  • The unresolved email request is immutable and encrypted. After the email finishes, its request content is removed; delivery evidence remains. Raw codes and Order tokens are never returned in this history.
  • delivery_report and complained_at come from the connection’s signed Resend reports: delivered, delayed, bounced, failed or suppressed, and a spam complaint. Acceptance by Resend is sent, not delivery.

Nothing Is Stopped

There is no stop. Nothing cancels an email or a post once it waits: not a second invite, not removing a team member, not a new code request, not an unsubscribe or a new suppression, not disabling a webhook. Instead, right before each try, Arky checks whether the message may still go, and a message that may not ends with its reason. There is no resend either: “resend receipt” makes a new outgoing email.

How Sending Works

Before each email try Arky checks, in order:

  1. the deadline: past send_before, the email ends not_sent with send_before_passed;
  2. the retry window and the tries left: at most 8 tries within 23 hours of the first;
  3. the store: a store being closed ends it not_sent with store_closing, a store whose Arky plan has no access with store_unavailable;
  4. the store’s email sending: while it is paused, the email waits without using a try;
  5. the sending address and its connection: an address that is gone, or whose connection can’t send, ends it not_sent with sender_cannot_send;
  6. the store’s suppressions: a broadcast stops at any active entry for the address, a sign-in code at none, every other store email at a block, a hard bounce or a complaint (recipient_suppressed).

An email whose purpose has no contact, such as a form receipt for a submission without an email answer, is recorded not_sent with no_recipient and to: null, once per event and template, and is never queued; it is finished when it is made.

Arky’s own mail skips the store checks. An email refused when it is queued, such as wording that can’t be built from the email’s data (render_failed: <reason>), starts not_sent and never reaches Resend.

Sending through Resend:

  • Store email goes through the connection of its sending address and Arky’s own mail through Arky’s Resend account, and a key change never moves a waiting email to another account.
  • Arky paces each Resend key and keeps part of each key’s rate for sign-in codes, invites, tests, receipts and support replies, so a large broadcast never takes it. Keys of one Resend team share Resend’s team limit, which Arky can’t see, so Resend’s 429 stays the backstop.
  • The idempotency key is the email’s send key: its id, or for a broadcast email the broadcast and a hash of the address. An unclear answer (no answer, or a 408, 409, 424, 425 or 5xx) is tried again with the same key after 1 minute, 5 minutes, 30 minutes, 2, 6 and 12 hours. A refusal ends it not_sent.
  • A 429 goes by Resend’s error name. A rate limit (rate_limit_exceeded) puts the email back without using a try. daily_quota_exceeded uses a try, and the email is retrying until 00:01 UTC, a minute after Resend’s daily reset, with the reason “Resend’s daily sending quota is used up”; when that time is at or past its send_before or the end of its 23-hour window, or the try was its eighth, it ends not_sent with resend_daily_quota_used_up at once. monthly_quota_exceeded uses a try and ends it not_sent with resend_monthly_quota_used_up.
  • After a try whose acceptance is uncertain, the email never ends not_sent: a Resend report settles it sent, or it ends maybe_sent.
  • No duplicates. An event email is unique per event, template and address; a broadcast email per broadcast and address; a webhook post per webhook and event. Handling the same event twice makes no second email.
  • Reports. Resend’s signed reports, matched to the connection the email went through, say whether it was delivered, delayed, bounced or failed, and whether it was reported as spam. A hard bounce or a complaint adds the store’s suppression for that address. They also say when Resend suppressed the address, skipping it because Resend’s own suppression list holds it: that ends the delivery as suppressed with Resend’s reason and adds no store suppression, because Resend’s list already covers its whole team, every store that shares it included.

Webhook posts read the webhook’s current URL, headers and secret on each try. A 2xx answer ends the post acknowledged. Otherwise it is tried again after 1 minute, 5 minutes, 30 minutes, 2, 6, 12 and 24 hours, and the eighth failure ends it unacknowledged. A disabled or deleted webhook, or a store being closed, ends a waiting post unacknowledged at its next try.

Cleanup. A finished outgoing email or webhook post is deleted 30 days after it finished; a support message keeps its own send history.

Warning

Never create a second email because one is maybe_sent. Arky can’t prove whether Resend accepted the first one.

Reading outgoing emails needs the store’s email permission. Reading webhook posts needs the store’s admin permission, like managing webhooks.