Skip to content

RenderHandlerOptions

@ebitex/content-sdk/render — serve ebitex’s render protocol from your own app, or reuse the default email renderer.

A sender of messages (ebitex Audience) asks your app to turn one of your pages into a message. This entry has the handler that answers it and a default renderer for sites that have no email layout of their own. Nothing here needs React or a DOM: it runs anywhere with the standard Request, Response and Web Crypto.

optional now?: () => number

Seconds since the epoch. Defaults to the clock; a parameter so a test need not wait.

number


render: (request) => RenderResult | Promise<RenderResult>

Turns a request into a message. Throw RenderNotFoundError when the page is not published; anything else answers 500.

RenderRequest

RenderResult | Promise<RenderResult>


secretFor: (channelId) => string | Promise<string | undefined> | undefined

The secret a connection signs its requests with, looked up by the request’s channelId. Return undefined for a connection you do not know and the request is refused. It is read before the signature is checked, so treat the id as untrusted.

string

string | Promise<string | undefined> | undefined


optional toleranceSeconds?: number

How far a request’s timestamp may be from now, in seconds. Defaults to five minutes.