# @redsuperadmin/sendgrid

> A SendGrid extension for RedWireless.

Latest version **1.0.0** (published 2023-08-17) · GNU GENERAL PUBLIC LICENSE 3.0 license · 0 weekly downloads

## Install

```sh
npm install @redsuperadmin/sendgrid
pnpm add @redsuperadmin/sendgrid
yarn add @redsuperadmin/sendgrid
bun add @redsuperadmin/sendgrid
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-08-17 |
| First published | 2023-08-17 |
| Weekly downloads | 0 |
| License | GNU GENERAL PUBLIC LICENSE 3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 14.0.0 |
| Dependencies | 1 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Karan Singh Gill |
| Maintainers | redsuperadmin |
| Keywords | RedWireless email, RedWireless SendGrid |

## Links

- npm: https://www.npmjs.com/package/@redsuperadmin/sendgrid
- Repository: https://github.com/RedWirelessDev/redwireless.git#main
- Homepage: https://github.com/RedWirelessDev/redwireless/tree/main/packages/sendgrid
- Issues: https://github.com/RedWirelessDev/redwireless/issues
- npm.io page: https://npm.io/package/@redsuperadmin/sendgrid

## Dependencies (1)

- [@sendgrid/mail](https://npm.io/package/@sendgrid/mail.md) ^7.7.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-08-17

## README

# SendGrid emailing for RedWireless

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

> **Note**: This extension requires RedWireless version 1.0.0-rc.6 or higher.

## Installation

### Step 1: Install the extension package

```javascript
npm install @redsuperadmin/sendgrid
```
### Step 2: Register the extension by adding it to the config file

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

### Step 3: Configure the extension

```javascript
// config/config.json
{
  ...,
  "sendgrid": {
    "apiKey": "<Your sendGrid API Key>",
    "from": "Customer Service <Your email>",
    "fromName": "Redwireless",
    "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
      }
    }
  }
}
```

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

```json
{
  "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": "evetwo@yopmail.com",
  "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

```json
{
  "reset_password_url": "https://demo.redwireless.ca/reset-password?token=3NedZnEvEMCuLU1x1IHT684B"
}
```

### Customer registered

Below is the data you can use in your email template

```json
{
  "full_name": "David",
  "email": "david@redwireless.ca"
}
```

---
_Source: https://npm.io/package/@redsuperadmin/sendgrid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
