Skip to content

.Net Console App that publishes Platform Events to SFDC (Salesforce)

Notifications You must be signed in to change notification settings

MatthewKosloski/sfdc-injector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sfdc-injector

This is a CLI console application built with .Net core that publishes events to Salesforce.

Prerequisites

Before using this application, please complete the following software and Salesforce configuration prerequisites.

Software Prerequisites

Please download the following software before using this application.

Salesforce Configuration Prerequisites

Before using this application, you must create a connected app in your Salesforce development org:

  1. From Setup, search for "app manager" in the Quick Find search box.
  2. Click on Apps > App Manager.
  3. Click on New Connected App.
  4. Give your app a Connected App Name, API Name, and Contact Email.
  5. Make sure Enable OAuth Settings is checked.
  6. Make sure Enable for Device Flow is checked.
  7. Make sure the Callback URL is https://login.salesforce.com/services/oauth2/success.
  8. Select the "Access and manage your data (api)" OAuth Scope is selected.
  9. Make sure Require Secret for Web Server Flow is checked.
  10. Take note of your Consumer Key and Consumer Secret. Copy and paste these into App.config.

Usage

Follow the below instructions to use this application on your computer.

  1. Download this repo's .ZIP folder or clone the repo.
  2. From the root directory, build the binary files using the subsequent command. After running the command, you should see two new folders, bin and obj.
    dotnet build
    
  3. From the root directory, create an App.config file to house your API credentials. Paste the subsequent contents into the file, modifying it to suit your credentials. The API version for ApiEndpoint may need to be modified. Note: This file is ignored by Git version control to avoid exposing your credentials.
    <?xml version="1.0" encoding="utf-8" ?>  
    <configuration>  
        <startup>   
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />  
        </startup>  
        <appSettings>
            <add key="LoginEndpoint" value="https://login.salesforce.com/services/oauth2/token" />
            <add key="ApiEndpoint" value="/services/data/v43.0/" />
            <add key="ClientId" value="<YOUR_CLIENT_ID>" />  
            <add key="ClientSecret" value="<YOUR_CLIENT_SECRET>" />  
            <add key="Username" value="<YOUR_USERNAME>" />
            <add key="Password" value="<YOUR_PASSWORD_AND_SECURITY_TOKEN>" />
        </appSettings>  
    </configuration>
    
  4. Run the application using the subsequent command:
    dotnet run
    

Testing

To run the tests, change your directory to SFDCInjector.Tests and use this command:

dotnet test

To generate code coverage report files in a SFDCInjector.Tests/coverage directory, run:

dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=\"json,lcov\" -p:CoverletOutput='./coverage/'

Resources

Salesforce

C# and .Net

Testing

About

.Net Console App that publishes Platform Events to SFDC (Salesforce)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages