Docs menu

Platform APIs

Google API

Every handle of the Google fake: the google fixture, the people and objects a test creates on it, and what they read and wait for. How to test a Google app or agent, step by step, is in the Google 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 GoogleUser 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.

GoogleFixture#

Returned by Session.google().

FieldPython / RustType
appappGoogleApp
apiUrlapi_urlstring

createApp()#

Make another app: a mailbox 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_GOOGLE_APP_<NAME>_WEBHOOK_URL.

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

Returns GoogleApp.

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 mailboxs 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 google.apps();

Returns GoogleApps.

createUser()#

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

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

Returns GoogleUser.

users()#

The people this session created.

const users = await google.users();

Returns GoogleUsers.

threads()#

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

const threads = await google.threads();

Returns GoogleThreads.

deliveries()#

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

const deliveries = await google.deliveries({ type: "…" });
ParameterPython / RustTypeRequired
typetype · r#typestringnooption
resourceresourceGoogleThreadnooption
appappGoogleAppnooption

Returns GoogleDeliveries.

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 Gmail calls the agent made about this session's mail, by the SDK's method name (users.messages.send).

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

Returns GoogleApiCalls.

Live: needs proxy mode: Gmail doesn't report the mailbox'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 google.waitForCall({ operation: "…" });
ParameterTypeRequired
operationstringnofilter
errortrue | stringnofilter
timeoutDurationnodefault 10s

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

GoogleApp#

Returned by GoogleFixture.createApp().

FieldPython / RustType
ididstring
channelchannel"google"
kindkind"app"
namenamestring
botUserIdbot_user_idstring
addressaddressstring
clientIdclient_idstring
clientSecretclient_secretstring
refreshTokenrefresh_tokenstring

send()#

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

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

Returns GoogleEmail.

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
emailGoogleEmailyespositional
textstringnooption
htmlstringnooption
allbooleannooption
headersRecord<string, string>nooption

Returns GoogleEmail.

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).

GoogleEmail#

Returned by GoogleApp.send(), GoogleApp.reply(), GoogleEmail.refresh(), GoogleUser.send().

FieldPython / RustType
ididstring
channelchannel"google"
threadthreadGoogleThread
authorauthorGooglePrincipal
fromfrom_ · fromstring
totostring[]
ccccstring[]
subjectsubjectstring
texttextstring
atatstring
messageIdmessage_idstring
headersheadersRecord<string, string>
labelslabelsstring[]
deliverydeliveryGoogleDelivery | undefined

refresh()#

Re-read an email.

const updated = await email.refresh();

Returns GoogleEmail.

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
appGoogleAppyespositional

Returns GoogleDelivery | 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).

GoogleThread#

FieldType
idstring
channel"google"
subjectstring

messages()#

Every email in the thread, oldest first.

const messages = await thread.messages();

Returns GoogleMessages.

replies()#

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

const replies = await thread.replies();

Returns GoogleReplies.

transcript()#

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

const transcript = await thread.transcript();

Returns GoogleTranscript.

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_ · fromGooglePrincipal | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s

Returns GoogleEmail. 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_ · fromGooglePrincipal | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s
quietForquiet_forDurationnodefault 750ms

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

GoogleDelivery#

Returned by GoogleEmail.deliveryFor(), GoogleDelivery.refresh().

FieldPython / RustType
ididstring
channelchannel"google"
appappstring
typetype · r#typestring
emailAddressemail_addressstring
historyIdhistory_idstring
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 GoogleDelivery.

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()#

Push the same message again, as Pub/Sub does when a push isn't acknowledged: the same message id.

const deliveryAttempt = await delivery.redeliver();

Returns DeliveryAttempt.

Live: refused with unsupported_in_live: Pub/Sub has no API to push an acknowledged message again.

resend()#

Push it again, forged: with a token signed by another key, one that has expired, or one for another audience than the push endpoint.

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

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 GoogleDelivery. When the time is up, it fails with what it was waiting for.

GoogleUser#

Returned by GoogleFixture.createUser().

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

send()#

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

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

Returns GoogleEmail.

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
emailGoogleEmailyespositional
textstringnooption
htmlstringnooption
allbooleannooption

Returns GoogleEmail.

inbox()#

What reached the person's mailbox, oldest first.

const inbox = await user.inbox();

Returns GoogleInbox.

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_ · fromGooglePrincipal | stringnoa handle, or a name
timeouttimeoutDurationnodefault 10s

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

Types#

Plain values the handles return and take.

GoogleApps#

type GoogleApps = GoogleApp[];

GooglePrincipal#

FieldType
idstring
namestring
kind"user" | "app"

GoogleUsers#

type GoogleUsers = GoogleUser[];

GoogleThreads#

type GoogleThreads = GoogleThread[];

GoogleInbox#

type GoogleInbox = GoogleEmail[];

GoogleMessages#

type GoogleMessages = GoogleEmail[];

GoogleReplies#

type GoogleReplies = GoogleEmail[];

GoogleTranscript#

FieldType
entriesGoogleTranscriptEntry[]
textstring

GoogleTranscriptEntry#

FieldType
idstring
authorGooglePrincipal
atstring
textstring
controlsstring[]
editedboolean
depthnumber

GoogleDeliveries#

type GoogleDeliveries = GoogleDelivery[];

GoogleApiCalls#

type GoogleApiCalls = GoogleApiCall[];

GoogleApiCall#

FieldPython / RustType
ididstring
channelchannel"google"
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.