Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@basetime/bldr-sfmc-sdk

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@basetime/bldr-sfmc-sdk

SDK for BLDR SFMC Core Functionality

latest
Source
npmnpm
Version
1.2.9
Version published
Weekly downloads
180
520.69%
Maintainers
3
Weekly downloads
 
Created
Source

bldr-sdk

SDK for core BLDR functionality

Install

Initiate

Reference package

const bldrSDK = require('@basetime/bldr-sfmc-sdk')

// OR

Import { bldrSDK } from '@basetime/bldr-sfmc-sdk'

Setup Client

const authObject = {
  client_id: 'xxxxxxxxxx',
  client_secret: 'xxxxxxxxxx',
  auth_url: 'https://xxxxxxxxxx-xxxxxxxxx.auth.marketingcloudapis.com/',
  account_id: 'xxxxxxxxx'
}

const bldr = new bldrSDK(authObject)
const { sfmc } = bldr

Usage

Folders

Folder functionality is based on the DataFolder SOAP API object unless otherwise documented.

 const request = await sfmc.folder.search({
     contentType: 'asset',
     searchKey: 'Name',
     searchTerm: 'bldr-sfmc'
 })

getFolder

const request = await sfmc.folder.getFolder({
    contentType: 'asset',
    categoryId: 3134
})

getSubfolders

const request = await sfmc.folder.getSubfolders({
    contentType: 'dataextension',
    parentId: 3134
})

createFolder

 const request = await sfmc.folder.createFolder({
     contentType: 'dataextension';
     name: 'new bldr folder';
     parentId: 3134;
 })

_updateAllowChildren

 const request = await sfmc.folder._updateAllowChildren({
     contentType: 'dataextension';
     categoryId: 3134;
 });

Content Builder

getByAssetId

const request = await sfmc.asset.getByAssetId(8272);

getAssetByLegacyId

const request = await sfmc.asset.getAssetByLegacyId(8272);

getAssetsByFolderArray

const request = await sfmc.asset.getAssetsByFolderArray([3134, 8373, 8727]);

getAssetByNameAndFolder

const request = await sfmc.asset.getAssetByNameAndFolder({
     assetName: 'bldr_api';
     assetFolderName: 'ssjs_functions';
 });

searchAsset

const request = await sfmc.asset.searchAsset({
     searchKey: 'name';
     searchTerm: 'bldr_api';
 });

postAsset

const request = await sfmc.asset.postAsset({
    "name": "Asset Name",
    "data": {
                "email": {
                    "options": {
                        "characterEncoding": "utf-8"
                    }
                }
            },
    "views": {
        "html": {
            "content": "<!DOCTYPE html>.....</html>"
        }
    },
    "text": {},
    "subjectline": {
    	"content": "%%First_Name%% this is my subject line"
    },
    "preheader": {
    	"content": "updated the preheader too!"
    },
    "assetType": {
        "name": "htmlemail",
        "id": 208
    }
})

putAsset

const request = await sfmc.asset.putAsset({
    "name": "Asset Name",
    "data": {
                "email": {
                    "options": {
                        "characterEncoding": "utf-8"
                    }
                }
            },
    "views": {
        "html": {
            "content": "<!DOCTYPE html>.....</html>"
        }
    },
    "text": {},
    "subjectline": {
    	"content": "%%First_Name%% this is my subject line"
    },
    "preheader": {
    	"content": "updated the preheader too!"
    },
    "assetType": {
        "name": "htmlemail",
        "id": 208
    }
})

getImageData

const request = await sfmc.asset.getImageData(3837)

Keywords

sfmc

FAQs

Package last updated on 21 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts