Skip to content

IntuitDeveloper/Transactional-Node-Samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transactional API Node.js Use Cases

npm version MIT licensed

Comprehensive Node.js examples for the Transactional API

This repository provides examples for specific Transactional API use cases using Node.js. These examples demonstrate how to implement Transactional API email functionality effectively.

📧 Documentation Examples

All examples are available as documentation in the /use-cases/ directory. Each use case includes complete code examples you can copy and run.

If you need support using the Transactional API, please check the Transactional API Documentation.

Table of Contents

Getting Started

Prerequisites

  • Node >= 10.0.0
  • A Transactional API key

Installation

  1. Clone this repository

    git clone [email protected]:IntuitDeveloper/Transactional-Node-Samples.git
    cd Transactional-Node-Samples
  2. Install dependencies in the scripts folder:

    cd scripts
    npm install
  3. Add your API key and email addresses to your .env file

    TRANSACTIONAL_API_KEY='your-transactional-api-key-here'
    DEFAULT_FROM_EMAIL='[email protected]'
    DEFAULT_FROM_NAME='Your Name'
    DEFAULT_TO_EMAIL='[email protected]'
    DEFAULT_TO_NAME='Recipient Name'
  4. Run a script from the scripts folder

    node email_with_single_recipient.js

Use Cases

Basic Email Sending:

Advanced Features:

API Features

Core Capabilities

Feature Transactional API Implementation
Library @mailchimp/mailchimp_transactional
Recipients to: [{email: '[email protected]', type: 'to'}]
Sender from_email: '[email protected]'
Multiple Recipients preserve_recipients: false
Substitutions `*
Categories tags: ['tag']

Implementation Checklist

  • Install @mailchimp/mailchimp_transactional package
  • Configure API key
  • Set up message structure (recipients, sender format)
  • Implement error handling with try/catch
  • Configure substitution variables syntax
  • Test email delivery and tracking
  • Set up monitoring and analytics

Troubleshooting

Common Issues

  • Authentication Errors: Verify your Transactional API key is correct and active
  • Email Rejections: Check email format and domain reputation
  • Rate Limiting: Implement delays between API calls for bulk sending
  • Template Errors: Verify template names and merge variable syntax

Getting Help

Best Practices

  1. Error Handling: Always implement proper error handling
  2. Rate Limiting: Respect API limits to avoid throttling
  3. Email Validation: Validate email addresses before sending
  4. Content Quality: Follow email best practices for deliverability
  5. Monitoring: Track delivery rates and bounces
  6. Security: Keep API keys secure and use environment variables
  7. Testing: Test emails in development before production

Support

For Transactional API support, please contact Mailchimp Support.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Learn how to use Mailchimp's Transactional API with our sample code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published