Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.37 KB

README.md

File metadata and controls

49 lines (34 loc) · 1.37 KB

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 on Commerce Layer's blog.


  1. Add your credentials in .env:
SENDGRID_API_KEY=""
SENDGRID_TEMPLATE_ID=""
CL_SHARED_SECRET=""
  1. Start the local server:
node server.js
  1. Start a ngrok HTTP tunnel listening for HTTP/HTTPS traffic on port 9000:
ngrok http 9000
  1. Create a new orders.place webhook using the CLI:
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"
  1. Place a new order using Commerce Layer Demo Stores, Hosted Microstore, or the CLI Checkout Plugin.
cl plugins:install checkout
commercelayer checkout -O <order-id>

or

cl checkout -S <sku-code-1> -S <sku-code-2> -m <market-id> -e <email-address>