bldr logo
Get Started

$ config

Getting setup with BLDR is straightforward and can be done in just a few minutes. New configurations require that an Installed Package be created within Salesforce Marketing Cloud following the permissions provided in the Getting Started documentation.

flagsdescription
-n, --newCreate New Configuration
[instance name]View Instance Configuration
-l, --listList all Configurations
-s --setSet Target Configuration to Use
>> -m, --midSet Target MID to Use
-r, --removeRemove Configuration
--verboseToggle Verbose Messaging
--debugToggle Debugging Mode
--analyticsToggle Analytics Capturing
--clear-sessionResets Session/Token Refresh

New Configuration

When setting up a new configuration, you will be provided the option to use either a Server-to-Server or a Web App Installed Package. The configuration is the same, aside from the selection of the Authentication Type.

Server-To-Server

bldr config -n | bldr config --new

  $ bldr config -n
  ? Installed Package/Authentication Type Server-to-Server
  ? SFMC Instance Name: BrandyMKTG
  ? Parent MID: 2928190
  ? API Client ID: ydnard9282zeuwo
  ? API Client Secret: ast3183alskdj282d
  ? Authentication URI: https://mcsfmc9380sk-0292.auth.marketingcloudapis.com/

Web App

bldr config -n | bldr config --new

  $ bldr config -n
  ? Installed Package/Authentication Type Web App
  ? SFMC Instance Name: BrandyMKTG
  ? Parent MID: 2928190
  ? API Client ID: ydnard9282zeuwo
  ? API Client Secret: ast3183alskdj282d
  ? Authentication URI: https://mcsfmc9380sk-0292.auth.marketingcloudapis.com/

Web App Installed Packages

Web App Configurations will use the oAuth 2 authentication flow which adds an extra layer of security for your organization and the instance you are connecting with. When using the Web App configuration, BLDR will still need to encrypt and store the credentials in your default credential vault as they are needed to initiate the oAuth process.

To facilitate this flow, BLDR will:

  • Use a localhost NodeJS server to open your web browser to the SFMC Authorization URL
  • Once logged in, SFMC will send the challenge code to https://bldr.io/cli/sfmc/authenticate/ which points to a Google Cloud function
  • The Google Cloud function will serve a basic HTML page which passes the challenge code back to the localhost server to validate and receive the access token
  • Once the process is complete, the server will close

Why do we need the Cloud Function

SFMC Web and Public App Installed Packages enforce that all Redirect URIs use the https protocol rather than http. This is to ensure that the connection with the Redirect URI is a trusted source. BLDR, being a CLI application, requires the use of a temporary localhost server to receive the oAuth challenge code; by nature a localhost server cannot have the required certificates to enforce https so the function simply passes it along.

View the Cloud Function code here.


Show Instance Details

bldr config <SFMC instance Name>

$ bldr config BrandyMKTG
Instance Details (showing first 5 characters of credentials)                    
----
{                                                                               
  "instance": "BrandyMKTG",                                                        
  "parentMID": "2928190",                                                     
  "apiClientId": "ydnar",                                                       
  "apiClientSecret": "ast31",                                                   
  "authURI": "https://mcsfmc9380sk-0292.auth.marketingcloudapis.com/",                                 
  "mids": [                                                                     
    {                                                                           
      "mid": 2928190,                                                         
      "name": "BrandyMKTG"                                                         
    }                                                                           
  ]                                                                             
}                                                  

Show Configured Instances

bldr config -l | bldr config --list

$ bldr config -l
Configured Instances                
----
BrandyMKTG                      
CodyDev                       
AstroB2C                      

Set Target Configuration

bldr config -s CodyDev | bldr config --set CodyDev

$ bldr config -s CodyDev
Configuration Set                                                               
----
{                                                                               
  "instance": "CodyDev",                                                       
  "parentMID": "992823772",                                                
  "activeMID": "992823772"                                                      
}      

Set Target MID

bldr config -s CodyDev -m 992822209 | bldr config --set CodyDev --mid 992822209

$ bldr config -s CodyDev -m 992822209
CodyDev has been set to target instance                                                               
----
{                                                                               
  "instance": "CodyDev",                                                       
  "parentMID": "992823772",                                                     
  "activeMID": "992822209"                                                      
}      

Remove Configuration

bldr config -r CodyDev | bldr config --remove CodyDev

$ bldr config -r CodyDev
Instance Details                                                                
----
{                                                                               
  "instance": "CodyDev",                                                       
  "parentMID": "992823772",                                                     
  "apiClientId": "codev",                                                       
  "apiClientSecret": "cd792",                                                   
  "authURI": "https://mcdev938-s9djskj.auth.marketingcloudapis.com/",                                 
  "mids": [                                                                     
    {                                                                           
      "mid": 992823772,                                                         
      "name": "CodyDev"                                                         
    },
    {                                                                           
      "mid": 992822209,                                                         
      "name": "Dev_Sandbox"                                                         
    }                                                                           
  ]                                                                             
}                                                                               
? Please confirm deletion of CodyDev (Y/n): y

CodyDev was Deleted Successfully.
Getting StartedStatus