GithubHelp home page GithubHelp logo

bolajiayodeji / cl-twilio-webhooks-demo Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 3.14 MB

A minimal demo for sending an SMS notification to customers when an SKU that had finished is back in stock using Commerce Layer Webhooks and Twilio SMS.

JavaScript 100.00%
commercelayer twilio twilio-sms-api webhooks

cl-twilio-webhooks-demo's Introduction

cl-twilio-webhooks-demo

A minimal demo for sending an SMS notification to customers when an SKU that had finished is back in stock using Commerce Layer Webhooks and Twilio SMS. To get started, kindly read the comprehensive tutorial on Commerce Layer's blog.


Add your credentials in .env:

TWILIO_ACCOUNT_SID=""
TWILIO_AUTH_TOKEN=""
TWILIO_PHONE_NUMBER=""
CL_SHARED_SECRET=""

Start the local server:

node server.js

Start a ngrok HTTP tunnel listening for HTTP/HTTPS traffic on port 9000:

ngrok http 9000

Create a new in_stock_subscriptions.notify webhook using the CLI:

cl webhooks:create \
   -n "Back In Stock Notifications" \
   -t "in_stock_subscriptions.notify" \
   -u "https://39cb-8-21-8-251.eu.ngrok.io/callback" \
   -i "sku"

Create a new stock subscription associated with some custom metadata (telephone number and customer name) and required relationships (market ID, customer’s ID, and SKU ID).

cl resources:create in_stock_subscriptions -m \
   customer_telephone="+12345678910" \
   customer_name="Bolaji Ayodeji" -r \
   market="VgKNLhKGBj" \
   customer="OwyehaRvJX" \
   sku="ZrxeSKVNRB

cl-twilio-webhooks-demo's People

Contributors

bolajiayodeji avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.