Built with ❤️ by John Turner
Small POC of subscribing to Salesforce Platform Events via the NodeJS CometD library.
Utilizes the OAuth 2.0 JWT Bearer flow for authenticating to Salesforce.
- Node 16+ & NPM
- OpenSSL
- Access to a Salesforce Org with a Platform Event created
Note: The following (at this time) has been tested on a macOS machine. I can't vouch for the Certificate Generation section working on Linux or Windows environments running WSL.
- Clone this repo to your local machine
- Duplicate
./scripts/generate-certificate.sh.example
into./scripts/generate-certificate.sh
- Fill in your correct information in
generate-certificate.sh
- Run
cd scripts/ && chmod +x generate-certificate.sh && cd ..
- Generate the certificate:
npm run create-cert
Example Connected App Setup
- Set up Connected App with the
.crt
that was generated via the shell script - Navigate to Setup > Manage Connected Apps > Your newly-created App
- Edit the app and switch the App's "Permitted Users" option to
Admin approved users are pre-authorized
- Create a new Permission Set that allows access to this Connected App
- Assign your user to the Permission Set
- Duplicate
config.json.example
intoconfig.json
- Set up the
config.json
according to the information from your Connected App and SFDC instance - Install dependencies
npm i
- Run:
npm run start