Skip to main content
Pass an email-capable piece to buildConfig({ email }) to send authentication emails and application messages. The email option accepts only EmailPiece | Promise<EmailPiece>.

Configure Resend

Install the Resend piece in your FrogBot app:
Set RESEND_API_KEY in your environment, then configure credentials and the default sender on the piece factory:
Resend has no OAuth recipe, so the factory does not accept oauth. See factory options. FrogBot uses the factory credentials for application email, including password resets and verification messages. It creates a request without a signed-in user for each send, so user connections do not supply email credentials. Missing factory credentials raise a ConnectionError naming the piece when you send.

Promised configuration

You can also pass a promise that resolves to the piece. With the resend instance above, use email: Promise.resolve(resend) in the config. FrogBot awaits the promise and validates the piece during initialization, before serving requests.

Send email

After FrogBot initializes, call frogbot.email.sendEmail(...) wherever you have a FrogBot instance:
The default from is formatted as "Acme" <notifications@example.com> using the factory options. An explicit per-message from overrides that default:
Resend email supports these options. Recipients can be address strings, { address, name } objects, or arrays of either. sendEmail also accepts the other fields of the standard mail options type, such as headers; the Resend piece ignores them.

Attach files

Provide each attachment’s contents as a string or a Node.js Buffer. FrogBot converts the content to base64 for Resend. Strings use UTF-8 unless you supply an encoding; for an already-base64 string, set encoding: 'base64'.
Streams, local attachment paths, and remote attachment URLs are unsupported. Read or download the file yourself, then pass its contents as a Buffer. An attachment without string or Buffer content throws Piece 'resend' email attachments must be a string or Buffer before a request is sent.

Configuration errors

FrogBot rejects invalid email configuration during initialization. Direct pieces are validated while building the config; promised pieces are validated after they resolve.

Delivery errors

The Resend piece sends a direct fetch request to the Resend API. Non-success responses throw an error such as Resend request failed (422): <message>, using Resend’s message when available and the HTTP status text otherwise. Network failures also reject the send. There are no automatic retries; handle rejected sends in your application.

Without email

If you omit email, FrogBot warns at startup and logs attempts to send email without delivering messages.