Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull-reqeust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 16.x, 18.x, 20.x ]
node-version: [ 18.x, 20.x, 24.x, 25.x ]
name: Nodejs ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v2
Expand Down
91 changes: 90 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,33 @@ This directory contains examples of how to use the Nylas Node.js SDK to interact

## Examples

### Node.js Examples

- [Grants](./grants/README.md) - Examples of how to fetch, list, sort, and filter grants (authenticated connections to email/calendar providers).
- [Notetakers](./notetakers/README.md) - Examples of how to use the Nylas Notetakers API to invite a Notetaker bot to meetings, get recordings and transcripts, and more.
- [Messages](./messages/README.md) - Examples of how to use the Nylas Messages API to list, find, send, update messages, and work with new features like tracking options and raw MIME data.
- [Folders](./folders/README.md) - Examples of how to use the Nylas Folders API, including the new `singleLevel` parameter for Microsoft accounts.
- [Calendars](./calendars/README.md) - Examples of how to use the Nylas Calendar API to create and manage calendar events with Notetaker integration.

### Cloudflare Workers Examples

- [Cloudflare Vite Calendars](./cloudflare-vite-calendars/README.md) - Modern Cloudflare Workers example using Vite for building a calendar event manager. Showcases listing and creating events with a beautiful web interface.
- [Edge Environment](./edge-environment/README.md) - Standard Cloudflare Workers example for sending email attachments. Demonstrates file upload handling and email sending on the edge.

### AWS Lambda Examples

- [AWS Lambda Attachments](./aws-lambda/README.md) - AWS Lambda example for sending email attachments using the Nylas SDK. Demonstrates how to handle multiple file uploads (including 2+ attachments over 3MB total) without Lambda freezing. Includes interactive setup CLI and Serverless Framework deployment.

### Module System Examples

- [ESM Only](./esm-only/) - Example of using the SDK with ES Modules
- [CJS Only](./cjs-only/) - Example of using the SDK with CommonJS

## Running the Examples

To run these examples, you'll need to:
### Node.js Examples

To run the Node.js examples, you'll need to:

1. Install dependencies:
```bash
Expand Down Expand Up @@ -52,6 +71,76 @@ To run these examples, you'll need to:
node dist/messages/messages.js
```

### Cloudflare Workers Examples

The Cloudflare Workers examples are self-contained and have their own setup:

1. Navigate to the example directory:
```bash
cd examples/cloudflare-vite-calendars
# or
cd examples/edge-environment
```

2. Install dependencies:
```bash
npm install
```

3. Set up environment variables (see each example's README for details):
```bash
cp .dev.vars.example .dev.vars
# Edit .dev.vars with your Nylas credentials
```

4. Run the development server:
```bash
npm run dev
```

5. Deploy to Cloudflare (optional):
```bash
npm run deploy
```

Each Cloudflare example has its own comprehensive README with detailed instructions.

### AWS Lambda Examples

The AWS Lambda example is self-contained and has its own setup:

1. Navigate to the example directory:
```bash
cd examples/aws-lambda
```

2. Run the interactive setup:
```bash
npm run setup
```

This will guide you through:
- Prerequisites checking
- Nylas credentials configuration
- AWS credentials setup
- Environment variable configuration
- Optional immediate deployment

3. Or set up manually:
```bash
npm install
# Create .env file with your Nylas credentials
# Configure AWS credentials
npm run deploy
```

4. Test the deployed function:
- Visit the API Gateway URL displayed after deployment
- Upload multiple files and send emails
- Test with files totaling over 3MB to verify the bug fix

The AWS Lambda example includes a comprehensive README with detailed instructions and troubleshooting.

## Documentation

For more information, see the [Nylas API Documentation](https://developer.nylas.com/).
7 changes: 7 additions & 0 deletions examples/aws-lambda/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
.env
.serverless/
*.log
.DS_Store
lambda-package.zip
Loading