Metadata-Version: 2.5
Name: fancy-resend
Version: 0.4.0
Summary: Resend for Python — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP; no vendor SDK.
Project-URL: Homepage, https://github.com/Fancy-Friends/resend
Project-URL: Issues, https://github.com/Fancy-Friends/resend/issues
Project-URL: Source, https://github.com/Fancy-Friends/resend
Author: Particle Academy
License-Expression: MIT
License-File: LICENSE
Keywords: api,connector,email,fancy-flow,particle-academy,resend
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# Resend

[![Fancified](art/fancified.svg)](https://particle.academy)

Resend for [fancy-flow][flow] — as **four imported, versioned packages**, one
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
change.

[flow]: https://github.com/Particle-Academy/fancy-flow

| Runtime | Package | Install |
|---|---|---|
| Authoring surface (every host) | `@particle-academy/resend-ui` | `npm install @particle-academy/resend-ui` |
| Node | `@particle-academy/resend-js` | `npm install @particle-academy/resend-js` |
| PHP 8.4+ | `particle-academy/resend-php` | `composer require particle-academy/resend-php` |
| Python 3.11+ | `fancy-resend` | `pip install fancy-resend` |

The `ui` package is the editor surface and is React on every host — a PHP or
Python project installs it *and* its own runtime package, and never the `js` one.

## What it costs you

One dependency: `@particle-academy/fancy-connector-core` (or
`particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
packages pull in themselves. The Python package has **zero** runtime
dependencies.

**No Resend SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
subject to the kit's full approval bar, and one per provider is hundreds of
dependencies nobody is tracking.

## Setting it up

Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.

### Credentials

A Resend connection holds 2 values.

Every value here is `account` scope: one per connected account, not one per installation.

| Field | Scope | Secret | Where it comes from |
|---|---|---|---|
| **API key** | per connected account | **secret** | re_... from the Resend dashboard. There is only one estate, so this key sends real email. |
| **Webhook signing secret** *(optional)* | per connected account | **secret** | whsec_... from the webhook endpoint you added in the Resend dashboard, exactly as shown -- the prefix stays. Required only by the email_received trigger. |

### The estate

**Resend has no test estate, and somebody checked.** Everything this connector does is real. Use the faker to build against it.

> Resend has NO test estate, and somebody checked. Its simulator RECIPIENTS -- delivered@resend.dev, bounced@resend.dev, complained@resend.dev, suppressed@resend.dev -- are not one: the send is real, it is billed, and it counts against the quota. Modelling them as a sandbox would put a live send behind a control labelled "test", so `mode` does not offer sandbox at all and `fake` is the primary development mode rather than the fallback.

## What it can do

### Actions

#### `attachment_get` — Get attachment

Turn one attachment of a received email into a signed download URL.

`GET /emails/receiving/{emailId}/attachments/{attachmentId}` · reads only — safe to replay

| Input | Required | What it is |
|---|---|---|
| `emailId` | yes | The received email's id -- `data.email_id` on the delivery, or `email.id` after the trigger's read. |
| `attachmentId` | yes | From `email.attachments[].id` on the trigger, or from attachment_list. |

#### `attachment_list` — List attachments

List a received email's attachments, each with a signed download URL.

`GET /emails/receiving/{emailId}/attachments` · reads only — safe to replay

| Input | Required | What it is |
|---|---|---|
| `emailId` | yes | The received email's id -- `data.email_id` on the delivery, or `email.id` after the trigger's read. |
| `limit` | no | Attachments per page, 1 to 100. Leave blank for all of them. |
| `after` | no | An attachment id: the page after it. Not together with `before`. |
| `before` | no | An attachment id: the page before it. Not together with `after`. |

#### `email_get` — Get received email

Read a received email in full: its bodies, its headers and the list of its attachments.

`GET /emails/receiving/{emailId}` · reads only — safe to replay

| Input | Required | What it is |
|---|---|---|
| `emailId` | yes | The received email's id -- `data.email_id` on an email.received delivery. Not the message_id: that is the RFC 5322 header, which Resend does not look up by. |

#### `email_send` — Send email

Send an email through Resend.

`POST /emails` · idempotent — safe to replay

| Input | Required | What it is |
|---|---|---|
| `from` | yes | Must be an address on a domain you have verified with Resend. An unverified sender is refused at send time, not at setup. |
| `to` | yes | One address, a comma-separated list, or an expression. Resend's simulator addresses (delivered@resend.dev, bounced@resend.dev) are LIVE sends that are billed and counted — they are not a sandbox. |
| `subject` | no | Subject |
| `html` | no | HTML body |
| `text` | no | Plain-text body |
| `replyTo` | no | Reply-To |
| `headers` | no | Sent as the email's own headers. The usual use is a threading or reference id. |

### Triggers

#### `email_received` — Email received

Start when an email arrives at one of your Resend receiving addresses, with the email read in full.

Delivered by webhook, and the signature is verified before anything runs. The delivery only names what arrived, so the run's first step reads it: `email_get` with `emailId` from `data.email_id`, published under `email`. A failed read fails the run.

**You have to set this up with the provider first:**

Point a receiving domain's MX record at Resend, then in the Resend dashboard (Webhooks → Add webhook) point an endpoint at the route your host mounts for this trigger and subscribe it to email.received. Put the endpoint's signing secret -- shown as whsec_… -- on the connection as `webhookSecret`, exactly as shown.

## Run it before you have credentials

Every operation ships a **faker**, whether or not Resend has a sandbox. Set a
node's mode to `fake` and it returns the shape Resend actually publishes — the
same field names, deterministically — so you can wire the downstream nodes before
touching an account, a key, or a network.

## This repository is generated

`provider/` is the source. Everything under `packages/` is emitted from it and
**must not be hand-edited** — CI regenerates and diffs on every push, and the
next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).

## Two namespaces, which do not match on purpose

The repo is `github.com/Fancy-Friends/resend`; the packages publish under
`particle-academy`. Nothing derives one from the other — the names come from
weaver's `friends.json` and nowhere else.

## Licence

MIT.
