Skip to main content
The Effect app client has the same methods and scope rules as the Promise client. Each method returns an Effect whose error channel holds the endpoint’s tagged errors, so failures show up in your handler’s type. See Errors.

In handlers

reintersect in the context is already authorized for the install the delivery came from. It has the methods for the scopes the piece declares, and its block methods accept the blocks the piece can use:
src/onDecision.tsx
In a route, call reintersect.forInstall(installId) to get a client for an install your app knows. See Routes.

Outside handlers

In a job, a script or your own backend, build a client with ReintersectAppClient.make(app, options). It needs an HttpClient, such as FetchHttpClient.layer:
src/markDone.ts
See Authentication for how tokens are minted and cached.

App streams

An app stream posts events into a circle as conversations from your app. There are two ways to post. With an install, call streams.sendEvent on the client. It needs replies:write:
Without an install, post to a stream URL from the circle’s app settings with ReintersectStream. The URL is the credential, so keep it secret. ReintersectStream.make checks the options and returns an Either, which you can yield inside Effect.gen:
src/announceDeploy.ts
Both make exactly one request and never retry on their own. An idempotencyKey makes a resend post once, so a retry like the one above is safe. A stream post fails with ReintersectStreamRateLimitedError (with retryAfterSeconds), ReintersectStreamInvalidTokenError, ReintersectStreamRevokedError, ReintersectStreamInvalidPayloadError or ReintersectStreamPayloadTooLargeError, or a transport error. See Writing to circles for threads, titles and personas.

renderPayload

renderPayload(content) from @reintersect/sdk/effect renders JSX into the document JSON the API accepts, for an HTTP client of your own. It returns an Effect:
Files and images are rejected, because nothing uploads them.

The member API client

Reintersect is a service for Reintersect’s member API, which acts as a member with an API key from Settings → Developer → API keys. It reads circles, conversations, replies and files, and creates and updates replies. It’s separate from the app client. Provide it with ReintersectClient.layer or, to read REINTERSECT_API_KEY and REINTERSECT_BASE_URL through Config, with ReintersectClient.layerConfig():
src/circles.ts
A missing circle fails with ReintersectApiCircleNotFoundError.