Skip to main content
Platform feature. Requires WANIWANI_API_KEY. Works whether your MCP server is self-hosted or on Managed Hosting. About the Platform.
The email module sends one email from your agent to one person, usually the visitor it just talked with: a quote recap, a booking confirmation, a link to finish signing up. You write the email in your own project, the platform sends it, and every send lands in a log you can check.

Setup

The email client sits on the Waniwani client instance:

Send an email

Render the email to HTML, then pass it with a recipient and a subject:
Any HTML string works, and the SDK sends it exactly as you pass it. React Email is not a dependency of the SDK, so add it to your own project if you want it:
Leave text out and a plain-text version is built from the HTML. Pass text when you want to write that version yourself.

Send from a flow node or a tool

The request-scoped client carries the conversation’s session id, so the log row points back to the conversation that sent the email. Where you get that client depends on how the tool is built. Inside a flow node, it is the waniwani field of the node context:
Inside a tool registered with server.registerTool, get the scoped client with extractScopedClient(extra):
Pass your own sessionId to override the one from the request.

Who the email comes from

Every email leaves from a shared address carrying your agent’s name, as it is set in the dashboard:
Nobody receives mail at that address, so a visitor who replies gets a bounce. Set replyTo to a mailbox you read:

The email log

Every accepted send appears in the dashboard under Settings > Modules > Email > Logs with its recipient, subject and status. The status starts at sent and moves to delivered, bounced or complained as the receiving server answers. send() resolves with the id of that log row.

Limits

Errors

Without an API key, send() throws before making any request. Every refusal from the platform throws WaniWaniError: its status is the HTTP status and its message starts with the code.