This repo contains the CometD .NET Core implementation for Salesforce Platform events.
These events can be subscribed to and listened to by your custom Event Listener
. The sample application of this library can be found here.
The solution contains the following:
-
CometD.NetCore2.Salesforce
Project- A Salesforce Platform Events implementation based Even Bus idea of eShopOnContainers.
- Reusable Building Blocks and sample application that listens to Salesforce push events.
-
DotNet Cli tool
salesforce
Project- This dotnet cli tool allows for retrieval of
Access Token
andRefresh Token
to be used by any other application. Please refer to How Are Apps Authenticated with the Web Server OAuth Authentication Flow
- This dotnet cli tool allows for retrieval of
- To include this library inside of your project run nuget package installation
PM> Install-Package CometD.NetCore2.Salesforce
Or
dotnet add package CometD.NetCore.Salesforce
- To Install Salesforce Cli tool globally run the following command:
dotnet tool install salesforce -g
To verify the installation run:
dotnet tool list -g
There are several ways to run this cli tool.
- From any location with Consumer Key and Secret provided
salesforce get-tokens --key:{key} --secret:{secret} --login:https://login.salesforce.com --verbose:information
- Running the tool in the directory that contains
appsettings.json
file
salesforce get-tokens --section Salesforce
Note: required configurations are as follows:
"Salesforce": {
"ClientId": "",
"ClientSecret": "",
"LoginUrl": ""
}
- Running with Azure Vault
`appsettings.json
"AzureVault": {
"BaseUrl": "https://{name}.vault.azure.net/"
},
Then run:
salesforce get-tokens --verbose:debug
Or specify url within the dotnet cli tool like so:
salesforce get-tokens --azure https://{name}.vault.azure.net/"
This tool will open web browser and will require you to log in with your credentials to Salesforce portal in order to retrieve the tokens.
- Sing up for development sandbox with Saleforce: https://developer.salesforce.com/signup.
- Create Connected App in Salesforce.
- Create a Platform Event.
- Setup -> Quick Find -> manage -> App Manager -> New Connected App.
- Basic Info:
-
Retrieve
Consumer Key
andConsumer Secret
to be used within the Test App
- Setup -> Quick Find -> Events -> Platform Events -> New Platform Event:
- Add Custom Field
(note: use sandbox custom domain for the login to workbench in order to install this app within your production)
Use workbench to test the Event workbench
Use login instead of test
Simple application that provides with Web Server OAuth Authentication Flow to retrieve
Access Token
and Refresh Token
to be used within the application.