Socket
Socket
Sign inDemoInstall

@basetime/bldr-sfmc-sdk

Package Overview
Dependencies
11
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @basetime/bldr-sfmc-sdk

SDK for BLDR SFMC Core Functionality


Version published
Weekly downloads
5
Maintainers
2
Install size
3.33 MB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 03 Oct 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc