npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@evershop/sendgrid

v1.0.1

Published

A SendGrid extension for EverShop.

Downloads

30

Readme

SendGrid emailing for EverShop

A SendGrid extension for EverShop. This extension is used to send email to customers.

Note: This extension requires EverShop version 1.0.0-rc.6 or higher.

Installation

Step 1: Install the extension package

npm install @evershop/sendgrid

Step 2: Register the extension by adding it to the config file

// config/default.json
{
  ...,
  "system": [
    ...,
    "extensions": [
        ...,
        {
          "name": "sendGrid",
          "resolve": "node_modules/@evershop/sendgrid",
          "enabled": true,
          "priority": 10
        }
    ]
  ]
}

Step 3: Configure the extension

// config/config.json
{
  ...,
  "sendgrid": {
    "from": "Customer Service <Your email>",
    "fromName": "Evershop",
    "events": {
      "order_placed": {
        "enabled": true,
        "templateId": "d-4c5e08f0c69d45f6994b93372f68d4" // Your email template ID
      },
      "reset_password": {
        "enabled": true,
        "templateId": "d-4f34caba1e184273c7f3d5568f3c21"// Your email template ID
      },
      "customer_registered": {
        "enabled": true,
        "templateId": "d-98b1cdc4896c4e7595e04dcf4a4560"// Your email template ID
      }
    }
  }
}

Step 4: Add the API key to the environment variables

// .env
SENDGRID_API_KEY=your_api_key

This extension now supports 3 events:

  1. order_placed: This event is fired when a customer places an order. Send an email to confirm the order.
  2. reset_password: This event is fired when a customer requests to reset password. Send an email with a link to reset password.
  3. customer_registered: This event is fired when a customer registers an account. Send a customer welcome email.

Email template data

Order confirmation

Below is the data you can use in your email template

{
  "order_id": 2072,
  "uuid": "5fede624-66b9-4d8d-9e4e-73d3800d9960",
  "integration_order_id": null,
  "sid": "d991f3b4-a403-46cd-84fe-59e11a83560a",
  "order_number": "12072",
  "cart_id": 26274,
  "currency": "CAD",
  "customer_id": 12684,
  "customer_email": "[email protected]",
  "customer_full_name": "David",
  "user_ip": null,
  "user_agent": null,
  "coupon": null,
  "shipping_fee_excl_tax": "9.0000",
  "shipping_fee_incl_tax": "9.0000",
  "discount_amount": "0.0000",
  "sub_total": "250.0000",
  "total_qty": 1,
  "total_weight": "3.1000",
  "tax_amount": "0.0000",
  "shipping_note": null,
  "grand_total": "259.0000",
  "shipping_method": "7d0aba1a-fa8a-4b37-8b0c-5162cb34997e",
  "shipping_method_name": "Standard Delivery",
  "shipping_address_id": 4145,
  "payment_method": "cod",
  "payment_method_name": "Cash On Delivery",
  "billing_address_id": 4146,
  "shipment_status": "unfullfilled",
  "payment_status": "pending",
  "created_at": 2023-07-06T06:17:53.560Z,
  "updated_at": 2023-07-06T06:17:53.560Z,
  "items": [
    {
    "order_item_id": 3127,
    "uuid": "ec293ae6-2877-4260-8cb3-ec22994e8af3",
    "order_item_order_id": 2072,
    "product_id": 81,
    "referer": null,
    "product_sku": "NJC11368-Black-XL",
    "product_name": "Geography class chuck taylor all star",
    "thumbnail": "/assets/theme/frontStore/default/image/placeholder.png",
    "product_weight": "3.1000",
    "product_price": "250.0000",
    "product_price_incl_tax": "250.0000",
    "qty": 1,
    "final_price": "250.0000",
    "final_price_incl_tax": "250.0000",
    "tax_percent": "0.0000",
    "tax_amount": "0.0000",
    "discount_amount": "0.0000",
    "total": "250.0000",
    "variant_group_id": 82,
    "variant_options": "[{"attribute_code":"color","attribute_name":"Color","attribute_id":3,"option_id":14,"option_text":"Black"},{"attribute_code":"size","attribute_name":"Size","attribute_id":2,"option_id":26,"option_text":"XL"}]",
    "product_custom_options": null,
    "requested_data": null
    }
  ],
  "shipping_address": {
    "order_address_id": 4145,
    "uuid": "ceb7598c-fc8e-4a6b-bf22-0dce57b8d733",
    "full_name": "David",
    "postcode": "70000",
    "telephone": "1231434535",
    "country": "US",
    "province": "US_CA",
    "city": "Englewood",
    "address_1": "12 street",
    "address_2": null,
    "country_name": "United States",
    "province_name": "California"
  },
  "billing_address": {
    "order_address_id": 4146,
    "uuid": "ceb7598c-fc8e-4a6b-bf22-0dce57b8d733",
    "full_name": "David",
    "postcode": "70000",
    "telephone": "1231434535",
    "country": "US",
    "province": "US_CA",
    "city": "Englewood",
    "address_1": "12 street",
    "address_2": null,
    "country_name": "United States",
    "province_name": "California"
  }
}

Reset password

Below is the data you can use in your email template

{
  "reset_password_url": "https://demo.evershop.io/reset-password?token=3NedZnEvEMCuLU1x1IHT684B"
}

Customer registered

Below is the data you can use in your email template

{
  "full_name": "David",
  "email": "[email protected]"
}