Coder Social home page Coder Social logo

commerce-event-viewer's Introduction

Salesforce Commerce Diagnostics Viewer

A simple TypeScript application that:

  • uses the nforce library to connect and authorize to a Salesforce org
  • uses the faye library to connect to the Salesforce Streaming API and subscribe to the CommerceDiagnosticEvent platform event
  • serves a webpage that dynamically displays the received CommerceDiagnosticEvents as they are emitted

Setup Your Org

  1. Make sure you have an active B2B Commerce webstore
  2. In your org, create a connected app: https://help.salesforce.com/articleView?id=connected_app_create.htm
  3. Make sure to follow the steps for OAuth 2.0 authentication in the section Enable OAuth Settings for API Integration
  4. OAuth should point to this app's URL like so http://localhost:5000/oauth/_callback or https://app-name.herokuapp.com/oauth/_callback

Setup Heroku

  1. Create a heroku account at https://heroku.com (only necessary if hosting on heroku)
  2. Get the CLI: https://devcenter.heroku.com/articles/heroku-cli

Configuration Variables Reference

  • SF_CLIENT_ID, enter the Consumer Key of your Salesforce Connected App
  • SF_CLIENT_SECRET, enter the Consumer Secret of your Salesforce Connected App
  • SF_USER_NAME, enter the the username of your Salesforce user
  • SF_USER_PASSWORD, enter the the password of your Salesforce user
  • (OPTIONAL) SF_LOGIN_SRV, enter the login server name (optional, defaults to login.salesforce.com, if you want sandbox set this to test.salesforce.com)
  • (OPTIONAL) REDIRECT_URL to the URL of the app itself (optional, defaults to https://app-name.herokuapp.com/oauth/_callback)

Running locally

  1. Run npm install to get dependencies
  2. Run npm run build to compile TypeScript files
  3. Copy .env.tmpl to .env
  4. Edit .env and set the configuration values (see above). Set REDIRECT_URL to http://localhost:5000/oauth/_callback
  5. Start the app:
    heroku local

Running on Heroku

  1. Run these commands (do not fill in the config values)
    heroku apps:create <your-app-name>
    heroku labs:enable runtime-dyno-metadata
    heroku config:set SF_CLIENT_ID=foo SF_CLIENT_SECRET=bar [email protected] SF_USER_PASSWORD=xyz
  1. Go to the settings page on heroku for your app, and update the configuration settings for SF_CLIENT_ID, etc..
  2. Now run:
    git push heroku master
    heroku open

Based on

Code is based on these two repos:

commerce-event-viewer's People

Contributors

smolynsf avatar dependabot[bot] 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.