Docs menu

Platform APIs

Resend API

Every handle of the Resend fake: the resend fixture, the people and objects a test creates on it, and what they read and wait for. How to test a Resend app or agent, step by step, is in the Resend guide.

Each call is shown in every SDK's language, with its required options (the table under it lists them all). Arguments go first; options are TypeScript's trailing object, Python's keyword arguments and Rust's builder setters. The variable names are the ones the calls return elsewhere on these pages, so user is a ResendUser handle.

Besides the errors listed with each method, most methods can fail with action_requires, cross_workspace_credential, fake_actor_in_live_world, internal, invalid_argument, live_misconfigured, live_not_allowlisted, not_found, session_not_found, unauthorized, unsupported_in_live: a bad request, a closed session, or live mode refusing or misconfigured.

ResendFixture#

Returned by Session.resend().

FieldPython / RustType
appappResendApp
apiUrlapi_urlstring

createApp()#

Make another app: a team of its own, with its own address and credentials (decision 0027), or return the one made with this name and settings. Its events go to CHANNELSTACK_RESEND_APP_<NAME>_WEBHOOK_URL.

const app = await resend.createApp({ name: "…" });
ParameterTypeRequired
namestringyesoption
domainstringnooption

Returns ResendApp.

Live: refused with unsupported_in_live: Live, each app is a sandbox app set up by hand, and this channel has no second one yet (decision 0027).

apps()#

The teams this session used: the agent's first, then each it got from createApp, in the order it first did. Another session's are not_found here.

const apps = await resend.apps();

Returns ResendApps.

createUser()#

Create a person: a mailbox, at <name>@example.com unless a test gives the address.

const user = await resend.createUser({ name: "…" });
ParameterTypeRequired
namestringyesoption
addressstringnooption
tokenstringnooption; read from CHANNELSTACK_RESEND_USER_{name}_TOKEN when left out

Returns ResendUser.

users()#

The people this session created.

const users = await resend.users();

Returns ResendUsers.

threads()#

The threads this session's people started, oldest first.

const threads = await resend.threads();

Returns ResendThreads.

deliveries()#

Every webhook channelstack sent the agent for this session, with every attempt.

const deliveries = await resend.deliveries({ type: "…" });
ParameterPython / RustTypeRequired
typetype · r#typestringnooption
resourceresourceResendThreadnooption
appappResendAppnooption

Returns ResendDeliveries.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

calls()#

The REST calls the agent made about this session's emails, by the SDK's method name (emails.send).

const apiCalls = await resend.calls({ operation: "…" });
ParameterTypeRequired
operationstringnooption
errortrue | stringnooption

Returns ResendApiCalls.

Live: needs proxy mode: Resend doesn't report the team's calls; proxy mode sees them. Proxy mode doesn't read the app's calls back live yet (#24), so for now the call is refused with action_requires and the test is skipped.

waitForCall()#

Waits for the next API call from the agent after the last one this handle returned: it polls calls() and never sleeps longer than it must.

const apiCall = await resend.waitForCall({ operation: "…" });
ParameterTypeRequired
operationstringnofilter
errortrue | stringnofilter
timeoutDurationnodefault 10s

Returns ResendApiCall. When the time is up, it fails with what it was waiting for.

ResendApp#

Returned by ResendFixture.createApp().

FieldPython / RustType
ididstring
channelchannel"resend"
kindkind"app"
namenamestring
botUserIdbot_user_idstring
addressaddressstring
domaindomainstring
apiKeyapi_keystring
webhookSecretwebhook_secretstring

send()#

An app a test made sends an email, through its own team's API, as its own call would.

const email = await app.send({ to, subject: "…" });
ParameterTypeRequired
toArray<ResendUser | ResendApp>yesoption
ccArray<ResendUser | ResendApp>nooption
subjectstringyesoption
textstringnooption
htmlstringnooption
headersRecord<string, string>nooption

Returns ResendEmail.

Live: refused with unsupported_in_live: Live, each app is a sandbox app set up by hand, and this channel has no second one yet (decision 0027).

reply()#

An app a test made replies to an email, in its thread, as its own call would.

const result = await app.reply(email, { text: "…" });
ParameterTypeRequired
emailResendEmailyespositional
textstringnooption
htmlstringnooption
allbooleannooption
headersRecord<string, string>nooption

Returns ResendEmail.

Live: refused with unsupported_in_live: Live, each app is a sandbox app set up by hand, and this channel has no second one yet (decision 0027).

ResendEmail#

Returned by ResendApp.send(), ResendApp.reply(), ResendEmail.refresh(), ResendUser.send().

FieldPython / RustType
ididstring
channelchannel"resend"
threadthreadResendThread
authorauthorResendPrincipal
fromfrom_ · fromstring
totostring[]
ccccstring[]
subjectsubjectstring
texttextstring
atatstring
messageIdmessage_idstring
headersheadersRecord<string, string>
deliverydeliveryResendDelivery | undefined

refresh()#

Re-read an email.

const updated = await email.refresh();

Returns ResendEmail.

deliveryFor()#

The delivery that told this app of the email (decision 0027), or nothing when it wasn't told.

const delivery = await email.deliveryFor(app);
ParameterTypeRequired
appResendAppyespositional

Returns ResendDelivery | undefined.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

ResendThread#

FieldType
idstring
channel"resend"
subjectstring

messages()#

Every email in the thread, oldest first.

const messages = await thread.messages();

Returns ResendMessages.

replies()#

The thread's answers: every email after the first, oldest first.

const replies = await thread.replies();

Returns ResendReplies.

transcript()#

The thread as a person reads it: each email's own words, without the quoted history.

const transcript = await thread.transcript();

Returns ResendTranscript.

waitForReply()#

Waits for the next reply after the last one this handle returned: it polls replies() and never sleeps longer than it must.

const email = await thread.waitForReply({ from: "my-agent" });
ParameterPython / RustTypeRequired
fromfrom_ · fromResendPrincipal | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s

Returns ResendEmail. When the time is up, it fails with what it was waiting for.

latestReply()#

The latest reply, once the app is quiet. Waits for at least one: it polls replies() and never sleeps longer than it must.

const email = await thread.latestReply({ from: "my-agent" });
ParameterPython / RustTypeRequired
fromfrom_ · fromResendPrincipal | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s
quietForquiet_forDurationnodefault 750ms

Returns ResendEmail. When the time is up, it fails with what it was waiting for.

ResendDelivery#

Returned by ResendEmail.deliveryFor(), ResendDelivery.refresh().

FieldPython / RustType
ididstring
channelchannel"resend"
appappstring
typetype · r#typestring
emailemailstring
payloadpayloadunknown | undefined
attemptsattemptsDeliveryAttempt[]
statusstatus"pending" | "acknowledged" | "failed" | "timed_out" | "unreachable"

refresh()#

Re-read a delivery: its attempts and status.

const updated = await delivery.refresh();

Returns ResendDelivery.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

redeliver()#

Send the same webhook again, as Resend retries: the same svix-id, signed again.

const deliveryAttempt = await delivery.redeliver();

Returns DeliveryAttempt.

Live: refused with unsupported_in_live: Resend has no API to redeliver a webhook.

resend()#

Send the webhook again, forged: signed with a secret that isn't the webhook's, or with a timestamp past the five minutes receivers accept.

const deliveryAttempt = await delivery.resend({ badSignature });
ParameterPython / RustTypeRequired
badSignaturebad_signaturebooleannooption
stalestalebooleannooption

Returns DeliveryAttempt.

Live: refused with unsupported_in_live: Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

settled()#

Waits for the delivery to settle: it polls refresh() and never sleeps longer than it must.

const updated = await delivery.settled();
ParameterTypeRequired
timeoutDurationnodefault 10s

Returns ResendDelivery. When the time is up, it fails with what it was waiting for.

ResendUser#

Returned by ResendFixture.createUser().

FieldType
idstring
channel"resend"
kind"user"
namestring
addressstring

send()#

The person emails someone: the agent (resend.app), another app, or another person.

const email = await user.send({ to, subject: "…" });
ParameterTypeRequired
toArray<ResendUser | ResendApp>yesoption
ccArray<ResendUser | ResendApp>nooption
subjectstringyesoption
textstringnooption
htmlstringnooption

Returns ResendEmail.

reply()#

The person replies to an email, in its thread: Re: its subject, with In-Reply-To and References.

const result = await user.reply(email, { text: "…" });
ParameterTypeRequired
emailResendEmailyespositional
textstringnooption
htmlstringnooption
allbooleannooption

Returns ResendEmail.

inbox()#

What reached the person's mailbox, oldest first.

const inbox = await user.inbox();

Returns ResendInbox.

waitForEmail()#

Waits for the next email after the last one this handle returned: it polls inbox() and never sleeps longer than it must.

const email = await user.waitForEmail({ from: "my-agent" });
ParameterPython / RustTypeRequired
fromfrom_ · fromResendPrincipal | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s

Returns ResendEmail. When the time is up, it fails with what it was waiting for.

Types#

Plain values the handles return and take.

ResendApps#

type ResendApps = ResendApp[];

ResendPrincipal#

FieldType
idstring
namestring
kind"user" | "app"

ResendUsers#

type ResendUsers = ResendUser[];

ResendThreads#

type ResendThreads = ResendThread[];

ResendInbox#

type ResendInbox = ResendEmail[];

ResendMessages#

type ResendMessages = ResendEmail[];

ResendReplies#

type ResendReplies = ResendEmail[];

ResendTranscript#

FieldType
entriesResendTranscriptEntry[]
textstring

ResendTranscriptEntry#

FieldType
idstring
authorResendPrincipal
atstring
textstring
controlsstring[]
editedboolean
depthnumber

ResendDeliveries#

type ResendDeliveries = ResendDelivery[];

ResendApiCalls#

type ResendApiCalls = ResendApiCall[];

ResendApiCall#

FieldPython / RustType
ididstring
channelchannel"resend"
operationoperationstring
methodmethodstring
pathpathstring
atatstring
durationMsduration_msnumber
requestrequestunknown | undefined
responseStatusresponse_statusnumber
responseresponseunknown | undefined
errorerrorstring | undefined

This page is generated from the control API's routes by codegen/src/emit/docs.ts: suggest changes there.