Getting Started with Notify

Welcome to Notify! This guide will walk you through setting up your account, creating a company profile, obtaining your API key, and sending your first email.

1. Setting Up Your Account

To get started with Notify, you'll need to create an account:

  1. Go to Notify's registration page and sign up.
  2. Verify your email address, and log in to access the Notify dashboard.

Once logged in, you'll see an introduction to help you get familiar with Notify's features.

2. Creating Your Company Profile

After logging in, you'll be prompted to create a company profile. This step is essential for accessing your API key, managing usage limits, and personalizing your email templates.

  1. Go to the Company Setup page on the dashboard.
  2. Enter the required details, such as your company's name, website, and contact information.
  3. Click Create Company. Once your profile is set up, you'll be directed to your dashboard.

Note: Each Notify account is linked to a single company profile. If you need additional profiles, consider setting up separate accounts or contacting Notify support for assistance.

3. Accessing Your API Key

With your company profile in place, you're now ready to retrieve your API key, which will allow you to start sending emails programmatically.

  1. Go to the Credentials page in the dashboard.
  2. Copy your API key from the provided field. This key will only be shown once for security reasons, so make sure to store it securely in your environment variables or a secure vault.

⚠️ Warning: Do not expose your API key in client-side code or share it publicly.

4. Installing the Notify NPM Package

Notify provides an npm package to help you integrate email-sending capabilities with minimal setup.

  1. In your project's root directory, install the Notify package:

    npm install notify `
    
    
  2. With Notify installed, you're ready to configure your email-sending functionality.

5. Sending Your First Email with Notify

Here's a basic example of how to use your API key to send an email using Notify:

Using the Notify NPM Package

  1. Import Notify and initialize it with your API key:

    
    import Notify from 'notify';
    
    const notify = new Notify('<your_api_key>');
    
    const sendWelcomeEmail = async () => {
      try {
        await notify.send({
          to: 'recipient@example.com',
          name: 'Recipient Name',
          template_id: 'welcome-template',
          data: {
            name: 'Recipient Name',
            company: 'Your Company',
            message: 'Welcome to our service!',
          },
        });
        console.log('Email sent successfully!');
      } catch (error) {
        console.error('Failed to send email:', error);
      }
    };
    
    sendWelcomeEmail();
    

    This example sends an email with a pre-created template, substituting in dynamic values such as name and message.

Using Node.js's Native Fetch

Alternatively, you can call the Notify API directly:

const sendEmail = async () => {
  try {
    const response = await fetch('https://api.notify.com/send', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer <your_api_key>`,
      },
      body: JSON.stringify({
        to: 'recipient@example.com',
        template_id: 'welcome-template',
        data: {
          name: 'Recipient Name',
          company: 'Your Company',
        },
      }),
    });

    if (!response.ok) {
      throw new Error('Failed to send email');
    }

    console.log('Email sent successfully!');
  } catch (error) {
    console.error('Error sending email:', error);
  }
};

sendEmail();

In this example, fetch is used to send a POST request to the Notify API with the required headers and email details.

6. Testing Your Setup

Once you've set up your email-sending code, it's a good idea to run a test to ensure everything is working properly.

  • Verify Success: Check your console logs for a success message (Email sent successfully!) to confirm your setup.
  • Check Delivery: Confirm receipt of the email at the specified recipient address.
  • Monitor Usage: In your Notify dashboard, go to Usage & Limits to track the number of emails sent and verify they appear in your email logs.

7. Securing Your API Key

As you continue to use Notify, keep your API key secure:

  • Environment Variables: Store your API key in environment variables (e.g., in .env files) rather than hard-coding it in your source code.
  • Rotate Regularly: For enhanced security, consider regenerating your API key periodically via the Credentials page.