Settings

There are two main places, where the extension is set. Some settings are global (and available via VSCode’s Settings). Other settings are project-specific and are stored in a file in your project (.vscode/ssjs-setup.json).

However, before you dive into the settings, you might want to set up your project (Workspace). This is done by opening a folder within VSCode, which VSCode will keep prompting you. This is a necessary step to use the extension to its full (e.g.: File > Open Folder). We recommend a folder per connected Business Unit.

Extension Settings

Extension allows you to do some global extension settings:

Code Provider:

To link your VSCode to SFMC, you have three options:

Here’s a closer look at each option:

Asset Provider: This option uses the API to deploy your script as a Content Builder Code Snippet, either on demand or on save. It’s the default setting and offers more security. However, it’s slightly slower and requires an Installed Package. Deployed scripts are always available.

Server Provider: This option utilizes a local server to provide your scripts via HTTPS. It’s faster and doesn’t always require an Installed Package (only for setup creation, which will be updated later). However, it’s less secure as it exposes your computer to potential hackers. Scripts are accessible only when you need them. To set this up, you’ll need a reverse tunneling tool such as NGROK, Expose, Local Tunnel, or Cloud Flare Tunnels.

Preferences

Autosave: Upload script automatically when using Asset Provider?

Get Url Handling: How to handle the URL when using ‘Get Dev Path’ command?

Templating Tags Let’s you set the tags for templating in case the classic {{TAGS}} would be your thing.

AMPscript settings These preferences let you set how would you like to format your AMPscript code.

Project Settings - v0.4.3 and onwards

From version 0.4.3, you can use the new UI to set up your project. The UI will guide you through the process and help you set up the extension correctly. The UI opens automatically when you open the extension for the first time or when the extension is not configured. You can also open it manually by running the SSJS: Show Config command.

Unfinished Config

Project Settings - via commands

Settings for an individual project is set in a file. .vscode/ssjs-setup.json to be precise. Create it either by SSJS: Create Config command (CMD/CTRL + Shift + P). You can also copy following JSON and set it yourself (remove commands and set only your required parameters). However, this could be used only for Server Provider and without API access.

API Client Secret is always stored in a secure way (in OS Key management).

Example:

Explanation of settings for 0.3.7 and onwards.

{
  // SFMC settings:
  "sfmc-domain": "<< sfmc-subdomain from AUTH URL: https://sfmc-subdomain.auth.marketingcloudapis.com/ >>",
  "sfmc-client-id": "<< client-id of installed package >>",
  "sfmc-mid": "<< optional: only if MID is needed >>",
	"sfmc-user-id": 0, // to identify who deployed which asset
	"dev-folder-path": "",
  // templating tokens:
  "dev-tokens": { // for DEV in Cloud Pages
    "IS_PROD": "true",
    "token-name": "use {{Mustache}} syntax in your files to fill your dev files"
  },
  "prod-tokens": { // for Production deployment
    "IS_PROD": "false",
    "token-name": "use {{Mustache}} syntax in your files to fill your prod files"
  },
  // Where are your assets stored?
	"asset-folder-id": 0, // Content Builder folder ID
	"asset-folder": "<< asset-folder >>", // Content Builder folder
  // Settings for your Cloud Page
	"dev-page": {
		"url": "<< dev page url >>", // URL of the Cloud Page
		"snippet-id": "<< asset ID of the code snippet >>", // id of the Content Snippet
		"use-auth": true, // in case you do not want to use auth - run the "SSJS: Install Dev Page" command to set this.
		"auth-type": "<<token|basic|none>>", // which auth-type is used?
    "dev-token": "<< dev-token-comes-here >>", // token, if in use
		"dev-username": "<< dev-username-comes-here >>", // user, if used
    "dev-password": "<< dev-password-comes-here >>" // password, if used
	},
  // Settings for your Cloud Text Resources
	"dev-resource": {
		"url": "<< dev page url >>", // URL of the Cloud Text Resources
		"snippet-id": "<< asset ID of the code snippet >>", // id of the Content Snippet
		"use-auth": true, // in case you do not want to use auth - run the "SSJS: Install Dev Page" command to set this.
		"auth-type": "<<token|basic|none>>", // which auth-type is used?
    "dev-token": "<< dev-token-comes-here >>", // token, if in use
		"dev-username": "<< dev-username-comes-here >>", // user, if used
    "dev-password": "<< dev-password-comes-here >>" // password, if used
	},
  // Server provider settings
  "proxy-any-file": {
    "public-domain": "<< publicly accessible domain, e.g. NGROK forwarding domain >>",
    "port": 4000, // PORT of to locally serve the data on
    "main-path": "/all-in-dev", // which URL is used to provide files?
    // HTTP Basic Auth login to project the server (Header: "ssjs-authorization")
    "auth-username": "<< dev-username-comes-here >>",
    "auth-password": "<< dev-password-comes-here >>"
  },
  "extension-version": "0.0.0"
}

For older versions:

{
  // SFMC settings:
  "sfmc-domain": "<< sfmc-subdomain from AUTH URL: https://sfmc-subdomain.auth.marketingcloudapis.com/ >>",
  "sfmc-client-id": "<< client-id of installed package >>",
  "sfmc-mid": "<< optional: only if MID is needed >>",

  // Server provider settings:
  "public-domain": "<< publicly accessible domain, e.g. NGROK forwarding domain >>",
  "port": 4000, // PORT of to locally serve the data on
	"proxy-any-file": {
    "main-path": "/all-in-dev",
    "enabled": true, // disable providing files but keep server on - future use
    "use-token": true, // use token on the Cloud Page
    "dev-token": "<< dev-token-comes-here >>", // token to be used
		 // HTTP Basic Auth login to project the server (Header: "ssjs-authorization")
    "auth-username": "<< dev-username-comes-here >>",
    "auth-password": "<< dev-password-comes-here >>"
  },
  // Asset provider settings:
	"asset-provider": {
    "use-token": true, // use token on the Cloud Page
    "dev-token": "<< dev-token-comes-here >>", // token to be used
    "folder-id": 0, // Content Builder folder ID
    "folder": "<< asset-folder >>" // Content Builder folder
  },
  // If you need to tokenize your file, just set a token.
  // Any key you set here can be used in your .ssjs file using {{ token-name }} syntax.
  // It will be automatically assigned whenever you deploy your file.
  "dev-tokens": { // when developing
    "IS_PROD": "true",
    "token-name": "use {{Mustache}} syntax in your files to fill your dev files"
  },
  "prod-tokens": { // Future use: when deploying for production.
    "IS_PROD": "false",
    "token-name": "use {{Mustache}} syntax in your files to fill your prod files"
  },
	
  "dev-folder-path": "", // legacy
  // Version of the extension:
  "extension-version": "0.1.0"
}