Careers Integration
Relevant source files
The following files were used as context for generating this wiki page:
The Careers Integration module enables users to browse open job positions at Resend and submit applications directly from the command-line interface. This system communicates with Resend's applicant tracking system through the CLI, allowing for both guided interactive applications and automated submissions via flags.
Careers commands function with any valid Resend API key. Submitted applications are processed independently and are not linked to the specific Resend team associated with the API key.
Sources: src/commands/careers/index.ts:7-16, skills/resend-cli/references/careers.md:5-5
Command Structure
The careers command group consists of two primary subcommands. The list command serves as the default action when no subcommand is specified.
| Command | Action | Default |
|---|---|---|
list | Fetches and displays open job postings. | Yes |
apply | Submits an application for a specific job ID. | No |
Sources: src/commands/careers/index.ts:17-18, src/commands/careers/list.ts:7-8
Careers List Logic
The list command performs a GET request to the /careers endpoint. In interactive mode, the CLI renders the results in a formatted table. In non-interactive or JSON mode, it outputs the raw list object.
The table displays the job title, location, department, and the unique job ID required for applications.
Sources: src/commands/careers/list.ts:31-47, src/commands/careers/utils.ts:58-72
Application Process
The apply command handles the submission of job applications using multipart form data. It supports two modes of operation: Interactive and Non-Interactive.
Interactive Mode
When you run the command without flags in a TTY environment, the CLI initiates a guided process.
- The system fetches the full job definition from
GET /careers/:id. - It iterates through the
fieldsarray defined for that specific job. - It prompts you for required information including name, email, and specific job questions.
- It requests a local file path for the resume.
- It displays a summary and asks for final confirmation before submission.
Sources: src/commands/careers/apply.ts:98-158, tests/commands/careers/apply.test.ts:77-80
Non-Interactive Mode
For automated environments, you must provide the job ID as a positional argument along with the required flags: --name, --email, and --resume. Custom job questions are passed using the --field <path=value> flag.
Sources: src/commands/careers/apply.ts:47-68, skills/resend-cli/references/careers.md:20-29
Application Sequence Diagram
This diagram illustrates the flow of an application submission involving the dynamic fetching of job-specific questions.
Data Models
The system uses specific TypeScript types to manage job data and field requirements.
Career Structure
| Field | Type | Description |
|---|---|---|
id | string | Unique UUID for the job posting. |
title | string | The job title. |
fields | CareerField[] | List of questions required for the application. |
location | string | Geographic location or "Remote". |
CareerField Types
Job questions vary by type, which dictates how the CLI handles input:
- Text/Email/Number: Standard text input with validation.
- Boolean: Prompts for Yes/No in interactive mode; accepts
true/falsein flags. - Location: Provides an autocomplete list of country names.
- Selectable: Provides a list of pre-defined options.
- File: Specifically used for the
resumefield (max 10MB).
Sources: src/commands/careers/utils.ts:5-34, src/commands/careers/apply.ts:200-260
Resume Handling
The resume is a mandatory component of every application. The CLI performs several checks before submission:
- File Read: It verifies the file exists at the specified path.
- Size Limit: It enforces a maximum size of 10MB (10,485,760 bytes).
- MIME Type: It maps file extensions to content types. Supported extensions include
.pdf,.doc,.docx, and.txt. If the extension is unknown, it defaults toapplication/octet-stream.
Sources: src/commands/careers/apply.ts:16-24, src/commands/careers/apply.ts:303-335
Error Handling
The following specific error codes are associated with careers integration:
| Code | Description |
|---|---|
missing_id | No job ID provided in non-interactive mode. |
missing_name | The --name flag is missing. |
missing_resume | The --resume flag is missing or the file was not found. |
invalid_field | A --field argument was formatted incorrectly (missing =). |
apply_error | The API rejected the application (e.g., duplicate email). |
fetch_error | Failed to retrieve the job application form definition. |
Sources: src/commands/careers/apply.ts:74-85, tests/commands/careers/apply.test.ts:125-141
Conclusion
Careers Integration provides a direct bridge between the developer's terminal and Resend's hiring process. By utilizing multipart form data and dynamic field fetching, it ensures that applications submitted via the CLI meet the same validation requirements as those submitted via the web interface.