Common Workflows & Recipes
Relevant source files
The following files were used as context for generating this wiki page:
Common workflows and recipes provide developers with standardized procedures for operating the Resend platform through the command-line interface (CLI). This system streamlines multi-step tasks such as environment setup, transactional email delivery, bulk marketing operations, and automated CI/CD notifications.
These recipes utilize the resend command to interact with API endpoints for emails, domains, broadcasts, and webhooks. The CLI handles complex internal logic like bundling React Email templates and managing multi-account authentication profiles.
Sources: skills/resend-cli/references/workflows.md:1-5, SKILL.md:1-15
1. Environment Setup & Authentication
The initial setup workflow ensures the CLI is correctly installed and authenticated to a Resend account. Authentication resolves credentials via the RESEND_API_KEY environment variable or a local config file managed by resend login.
Installation and Verification
You can install the CLI using Node.js, Homebrew, or a standalone shell script. Once installed, the doctor command validates the environment health by checking the CLI version, API key presence, credential storage, and domain status.
The diagram above illustrates the linear path from installation to a verified working state.
Sources: install.sh:1-20, SKILL.md:27-45, src/commands/doctor.ts:160-200
Multi-Profile Management
For developers managing multiple environments, the auth command group allows switching between named profiles.
- Switching:
resend auth switch <profile-name> - Listing:
resend auth list
Sources: skills/resend-cli/references/workflows.md:129-145
2. Transactional Email Delivery
The email workflow covers sending single messages, using HTML files, or leveraging React Email templates. The CLI bundles .tsx files into HTML before transmission.
Sending Logic Flow
When sending a React Email, the CLI invokes a bundler to render the template into static HTML.
This sequence shows how the CLI abstracts the rendering process for React templates.
Sources: src/commands/emails/send.ts:250-300, SKILL.md:195-200
Email Options Summary
| Feature | CLI Flag | Description |
|---|---|---|
| HTML File | --html-file | Path to a local .html file. |
| React Email | --react-email | Path to a .tsx template. |
| Attachments | --attachment | Path or URL; supports ;cid=, ;type=, ;filename=. |
| Scheduling | --scheduled-at | ISO 8601 or natural language (e.g., "in 2 hours"). |
| Sources: src/commands/emails/send.ts:50-100 |
3. Marketing & Bulk Operations
Bulk operations involve segments, contacts, and broadcasts. This recipe follows a sequence of creating a target segment, importing contacts, and executing a broadcast.
Broadcast Execution Flow
Contact Import Procedure
- Prepare CSV: Ensure headers match
email,first_name, andlast_name. - Start Import:
resend contacts imports create --file ./data.csv. - Poll Status:
resend contacts imports get <import-id>.
Sources: skills/resend-cli/references/workflows.md:215-235
4. Webhooks & Automation
Automation workflows allow the CLI to react to platform events. The webhooks listen command is particularly useful for local development, acting as a proxy for events.
Webhook Listener Architecture
The CLI receives events from the remote URL and forwards them to a local development server.
Sources: skills/resend-cli/references/workflows.md:149-170
Automation Recipes
You can trigger complex multi-step automations by sending events from the CLI:
- Define an event:
resend events create --name "user.signup". - Trigger the automation:
resend events send --event "user.signup" --email user@example.com.
Sources: skills/resend-cli/references/workflows.md:188-210
5. CI/CD Integrations
Integrating Resend into CI/CD pipelines (e.g., GitHub Actions) requires using environment variables to avoid interactive prompts. The CLI automatically detects non-TTY environments and switches to JSON output.
GitHub Actions Recipe
- name: Notify Team
env:
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
run: |
resend emails send -q \
--from "ci@example.com" \
--to "devs@example.com" \
--subject "Build Successful" \
--text "Revision ${{ github.sha }} passed."
Sources: skills/resend-cli/references/workflows.md:243-260, SKILL.md:50-65
6. Careers & Application
The CLI includes a specialized workflow for interacting with Resend's hiring platform. You can list open positions and apply directly from the terminal.
Application Steps
- List Positions:
resend careers listto find a job ID. - Apply:
resend careers apply <id> --name "Name" --email "email" --resume ./path.pdf.
Sources: src/commands/careers/apply.ts:60-100, skills/resend-cli/references/workflows.md:275-285
Summary
Common Workflows & Recipes enable developers to move beyond basic API calls into structured operational procedures. By combining standard flags, environment variables, and specialized commands like doctor and listen, the CLI serves as a robust tool for both interactive development and automated production workflows. Key components include authentication profile management, React Email rendering, and bulk contact ingestion.
Sources: SKILL.md:175-220, skills/resend-cli/references/workflows.md:1-20