The emails.receiving.forward() helper is the recommended path for forwarding inbound emails, and it is useful because it preserves received content and attachments without each app reimplementing MIME parsing.
For webhook-based forwarding, duplicate prevention is critical. Resend webhooks can be retried or replayed, and a serverless handler/background job can fail after the underlying email send is accepted but before local state is marked as sent. In that situation, retrying the forwarding job can send duplicate customer emails.
The Send Email API already supports Idempotency-Key, and the Node SDK exposes idempotencyKey for emails.send / emails.create request options. But emails.receiving.forward() does not currently expose a way to pass an idempotency key.
From the SDK shape, forward() appears to call /emails internally, so it would be useful if the helper accepted request options too.
Potential API:
await resend.emails.receiving.forward(
{
emailId,
to,
from,
},
{
idempotencyKey: `forward:${emailId}:${to}`,
}
)
Alternative API if preferred:
await resend.emails.receiving.forward({
emailId,
to,
from,
idempotencyKey: `forward:${emailId}:${to}`,
})
Use case:
- Receive
email.received webhook
- Resolve customer-specific forwarding address
- Forward inbound email
- Retry safely on transient failures or webhook replays
- Avoid duplicate forwarded messages
Without this, apps that need strict duplicate prevention have to avoid the recommended helper and manually download/parse/send the raw email through emails.send only to get idempotency support.
Thanks.
The
emails.receiving.forward()helper is the recommended path for forwarding inbound emails, and it is useful because it preserves received content and attachments without each app reimplementing MIME parsing.For webhook-based forwarding, duplicate prevention is critical. Resend webhooks can be retried or replayed, and a serverless handler/background job can fail after the underlying email send is accepted but before local state is marked as sent. In that situation, retrying the forwarding job can send duplicate customer emails.
The Send Email API already supports
Idempotency-Key, and the Node SDK exposesidempotencyKeyforemails.send/emails.createrequest options. Butemails.receiving.forward()does not currently expose a way to pass an idempotency key.From the SDK shape,
forward()appears to call/emailsinternally, so it would be useful if the helper accepted request options too.Potential API:
Alternative API if preferred:
Use case:
email.receivedwebhookWithout this, apps that need strict duplicate prevention have to avoid the recommended helper and manually download/parse/send the raw email through
emails.sendonly to get idempotency support.Thanks.