https://github.com/bolajiayodeji/cl-sendgrid-webhooks
Sample code and templates for sending emails to customers using Commerce Layer Webhooks, Zapier Code Runner, Nodejs, and SendGrid API.
https://github.com/bolajiayodeji/cl-sendgrid-webhooks
commercelayer ecommerce sendgrid sendgrid-mail zapier
Last synced: 3 months ago
JSON representation
Sample code and templates for sending emails to customers using Commerce Layer Webhooks, Zapier Code Runner, Nodejs, and SendGrid API.
- Host: GitHub
- URL: https://github.com/bolajiayodeji/cl-sendgrid-webhooks
- Owner: BolajiAyodeji
- Created: 2022-09-30T09:30:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-18T11:34:43.000Z (about 2 years ago)
- Last Synced: 2025-01-21T00:36:36.696Z (over 1 year ago)
- Topics: commercelayer, ecommerce, sendgrid, sendgrid-mail, zapier
- Language: HTML
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cl-sendgrid-webhooks
Sample code and templates for sending emails to customers using Commerce Layer Webhooks, Zapier Code Runner, Nodejs, and SendGrid API. To get started, kindly read [this comprehensive tutorial](https://commercelayer.io/blog/how-to-send-templated-emails-with-commerce-layer-and-sendgrid) on Commerce Layer's blog.
---
1. Add your credentials in `.env`:
```text
SENDGRID_API_KEY=""
SENDGRID_TEMPLATE_ID=""
CL_SHARED_SECRET=""
```
2. Start the local server:
```bash
node server.js
```
3. Start a ngrok HTTP tunnel listening for HTTP/HTTPS traffic on port 9000:
```bash
ngrok http 9000
```
4. Create a new `orders.place` webhook using the CLI:
```bash
cl webhooks:create \
-n "Order Confirmation Emails" \
-t "orders.place" \
-u "https://98ec-104-28-230-121.eu.ngrok.io/callback" \
-i "customer,line_items,shipping_address,billing_address,shipments.shipping_method,payment_method,payment_source,market"
```
5. Place a new order using Commerce Layer [Demo Stores](https://github.com/commercelayer/demo-store), [Hosted Microstore](https://github.com/commercelayer/commercelayer-microstore), or the [CLI Checkout Plugin](https://github.com/commercelayer/commercelayer-cli-plugin-checkout).
```bash
cl plugins:install checkout
```
```bash
commercelayer checkout -O
or
cl checkout -S -S -m -e
```