4.0.1 • Published 3 months ago

@adobe/aio-lib-campaign-standard v4.0.1

Weekly downloads
212
License
Apache-2.0
Repository
github
Last release
3 months ago

Version Downloads/week Node.js CI License Codecov Coverage

Adobe I/O Adobe Campaign Standard SDK

Node Javascript SDK wrapping the Adobe Campaign Standard APIs.

Installing

$ npm install

Usage

1) Initialize the SDK

const sdk = require('@adobe/aio-lib-campaign-standard')

async function sdkTest() {
  //initialize sdk
  const campaignStandardClient = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')
}

Init method returns an instance of the Class CampaignStandardCoreAPI

2) Call methods using the initialized SDK

const sdk = require('@adobe/aio-lib-campaign-standard')

async function sdkTest() {
  //initialize sdk
  const campaignStandardClient = await sdk.init('<tenant>', 'x-api-key', '<valid auth token>')

  // call methods
  try {
    // get profiles by custom filters
    result = await campaignStandardClient.getAllProfiles({
      filters: [
        'byCRMId'
      ],
      hasCustomFilter: true
    })
    console.log(result)

    // get a workflow
    result = await campaignStandardClient.getWorkflow('myWkfId')
    console.log(result)

  } catch (e) {
    console.error(e)
  }
}

All methods available under the SDK are documented here

Classes

Functions

CampaignStandardCoreAPI

This class provides methods to call Adobe Campaign Standard APIs. Before calling any method initialize the instance by calling the init method on it with valid values for tenantId, apiKey and accessToken

Kind: global class

campaignStandardCoreAPI.tenantId

the tenant id (your personal organization in Campaign Standard)

Kind: instance property of CampaignStandardCoreAPI

campaignStandardCoreAPI.apiKey

the api key from your Adobe I/O Campaign Standard integration

Kind: instance property of CampaignStandardCoreAPI

campaignStandardCoreAPI.accessToken

the access token from your Adobe I/O Campaign Standard integration

Kind: instance property of CampaignStandardCoreAPI

campaignStandardCoreAPI.init(tenantId, apiKey, accessToken) ⇒ CampaignStandardCoreAPI

Initializes this object.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
tenantIdstringthe tenant id (your personal organization in Campaign Standard)
apiKeystringthe API key for your Adobe I/O Campaign Standard Integration
accessTokenstringthe access token for your Adobe I/O Campaign Standard Integration

campaignStandardCoreAPI.getAllProfiles(parameters)

Get all Profile records

Kind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource

ParamTypeDefaultDescription
parametersObject{}parameters to pass
parameters.filtersArray[]apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call
parameters.hasCustomFilterBooleanfalseset to true if you have a custom filter. Defaults to false.
parameters.lineCountinteger25limit the number of records to return (default is 25)
parameters.orderstringthe field to order your records by (see the fields of a Profile)
parameters.descendingSortbooleanfalseset to true to get results in descending order (default is ascending)

campaignStandardCoreAPI.createProfile(profileObject)

Create a Profile record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
profileObjectObjectsee profile properties

campaignStandardCoreAPI.updateProfile(profilePKey, profileObject)

Update a Profile record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
profilePKeystringthe PKey property of a Profile record
profileObjectObjectsee profile properties. Only set the properties you want to update.

campaignStandardCoreAPI.getProfile(profilePKey)

Get a Profile record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
profilePKeystringthe PKey property of a Profile record

campaignStandardCoreAPI.getAllServices(parameters)

Get all Service records

Kind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource

ParamTypeDefaultDescription
parametersObject{}parameters to pass
parameters.filtersArray[]apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call
parameters.hasCustomFilterBooleanfalseset to true if you have a custom filter. Defaults to false.
parameters.lineCountinteger25limit the number of records to return (default is 25)
parameters.orderstringthe field to order your records by (see the fields of a Service)
parameters.descendingSortdescendingSortfalseset to true to get results in descending order (default is ascending)

campaignStandardCoreAPI.createService(serviceObject)

Create a Service record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
serviceObjectObjectsee service properties

campaignStandardCoreAPI.getService(servicePKey)

Get a Service record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
servicePKeystringthe PKey property of a Service record

campaignStandardCoreAPI.getHistoryOfProfile(profilePKey)

Get the marketing history of a Profile

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
profilePKeystringthe PKey property of a Profile record

campaignStandardCoreAPI.getMetadataForResource(resource)

Get the metadata information for a resource.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
resourcestringone of profile, service, history

campaignStandardCoreAPI.getMetadataForResourceExt(resource)

Retrieve custom resource linked to the Profile table

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
resourcestringany custom resource

campaignStandardCoreAPI.getCustomResources()

Get all the custom resource collections linked to the Profile table.

Kind: instance method of CampaignStandardCoreAPI

campaignStandardCoreAPI.createGDPRRequest(gdprRequest)

Create a new GDPR request.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
gdprRequestObjectsee the properties that are needed.

campaignStandardCoreAPI.getGDPRRequest()

Get data about the current GDPR request.

Kind: instance method of CampaignStandardCoreAPI

campaignStandardCoreAPI.getGDPRDataFile(privacyRequestDataUrl, requestInternalName)

Get the GDPR data file.

Kind: instance method of CampaignStandardCoreAPI
See: getGDPRRequest

ParamTypeDescription
privacyRequestDataUrlstringthis is acquired from a getGDPRRequest call
requestInternalNamestringthe request internal name

campaignStandardCoreAPI.sendTransactionalEvent(eventId, eventBody)

Deprecated

Send a transactional event. Deprecated since 2.1.0. use sendTransactionalEventForMacTenantId instead.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
eventIdstringthe type of event you want to send. This depends on the event definition.
eventBodyObjectthe event data to send. This depends on the event definition.

campaignStandardCoreAPI.sendTransactionalEventForMacTenantId(macTenantId, eventId, eventBody)

Send a transactional event for a Marketing Cloud Tenant ID

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
macTenantIdstringthe Marketing Cloud Tenant ID
eventIdstringthe type of event you want to send. This depends on the event definition.
eventBodyObjectthe event data to send. This depends on the event definition.

campaignStandardCoreAPI.getTransactionalEvent(eventId, eventPKey)

Deprecated

Gets data about a transactional event (status, properties) Deprecated since 2.1.0. use getTransactionalEventForMacTenantId instead.

Kind: instance method of CampaignStandardCoreAPI
See: sendTransactionalEvent

ParamTypeDescription
eventIdstringthe type of event you want to send
eventPKeystringthe PKey of an event (you get this from a sendTransactionalEvent call)

campaignStandardCoreAPI.getTransactionalEventForMacTenantId(macTenantId, eventId, eventPKey)

Gets data about a transactional event for a Marketing Cloud Tenant ID (status, properties)

Kind: instance method of CampaignStandardCoreAPI
See: sendTransactionalEvent

ParamTypeDescription
macTenantIdstringthe Marketing Cloud Tenant ID
eventIdstringthe type of event you want to send
eventPKeystringthe PKey of an event (you get this from a sendTransactionalEvent call)

campaignStandardCoreAPI.getWorkflow(workflowId)

Gets the properties of a workflow.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
workflowIdstringthe id of the workflow

campaignStandardCoreAPI.triggerSignalActivity(workflowTriggerUrl, workflowParameters)

Trigger a workflow.

Kind: instance method of CampaignStandardCoreAPI
See: getWorkflow

ParamTypeDescription
workflowTriggerUrlstringthe trigger url for a workflow. You can get this from a call to getWorkflow
workflowParametersObjectworkflow parameters object. see the payload in the docs
workflowParameters.sourcestringthe triggering request source
workflowParameters.parametersObjectthe parameters to send to the workflow (paramater name, and parameter value pairs)

campaignStandardCoreAPI.controlWorkflow(workflowId, command)

Controls execution of a workflow.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
workflowIdstringthe id of the workflow
commandstringthe command to execute for the workflow. one of start, pause, resume, stop

campaignStandardCoreAPI.getAllOrgUnits(parameters)

Get all available orgUnits

Kind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource

ParamTypeDefaultDescription
parametersObject{}parameters to pass
parameters.filtersArray[]apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call
parameters.lineCountinteger25limit the number of records to return (default is 25)
parameters.orderstringthe field to order your records by (see the fields of a OrgUnitBase)
parameters.descendingSortdescendingSortfalseset to true to get results in descending order (default is ascending)

campaignStandardCoreAPI.getProfileWithOrgUnit(profilePKey)

Gets a Profile record (with it's orgUnit property)

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
profilePKeystringthe PKey property of a Profile record

campaignStandardCoreAPI.updateProfileOrgUnit(profilePKey, orgUnitPKey)

Update the orgUnit of a Profile

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
profilePKeystringthe PKey property of a Profile record
orgUnitPKeystringthe PKey property of a OrgUnitBase record

campaignStandardCoreAPI.updateOrgUnit(orgUnitPKey, orgUnitObject)

Update the properties of an OrgUnitBase.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
orgUnitPKeystringthe PKey property of a OrgUnitBase record
orgUnitObjectObjectsee orgUnitBase properties. Only set the properties you want to update.

campaignStandardCoreAPI.postDataToUrl(url, body)

Post to an absolute url.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
urlstringthe url to POST to
bodyObjectthe POST body

campaignStandardCoreAPI.getDataFromRelativeUrl(relativeUrl)

Gets data from a relative url. Helper function.

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
relativeUrlstringthe relative url (returned from some ACS API calls)

campaignStandardCoreAPI.getAllCustomResources(customResource, parameters)

Deprecated

Get all Custom Resource records Either use getAllBasicCustomResources() to get custom resources or getAllProfileAndServicesExt() to get extended resource data

Kind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource

ParamTypeDefaultDescription
customResourcestringthe custom resource to get records from
parametersObject{}parameters to pass
parameters.filtersArray[]apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call
parameters.hasCustomFilterBooleanfalseset to true if you have a custom filter. Defaults to false.
parameters.lineCountinteger25limit the number of records to return (default is 25)
parameters.orderstringthe field to order your records by (see the fields of a Profile)
parameters.descendingSortbooleanfalseset to true to get results in descending order (default is ascending)

campaignStandardCoreAPI.getAllBasicCustomResources(resource)

Get all Custom Resource records

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
resourcestringone of profile, service, history

campaignStandardCoreAPI.getAllProfileAndServicesExt(customResource, parameters)

Get all Custom Resource records

Kind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource

ParamTypeDefaultDescription
customResourcestringthe custom resource to get records from
parametersObject{}parameters to pass
parameters.filtersArray[]apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call
parameters.hasCustomFilterBooleanfalseset to true if you have a custom filter. Defaults to false.
parameters.lineCountinteger25limit the number of records to return (default is 25)
parameters.orderstringthe field to order your records by (see the fields of a Profile)
parameters.descendingSortbooleanfalseset to true to get results in descending order (default is ascending)

campaignStandardCoreAPI.updateCustomResource(customResource, customResourcePKey, customResourceObject)

Update a Custom Resource record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
customResourcestringthe custom resource
customResourcePKeystringthe PKey property of a Custom Resource record
customResourceObjectObjectA Custom Resource object. Only set the properties you want to update.

campaignStandardCoreAPI.createCustomResource(customResource, customResourceObject)

Create a Custom Resource record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
customResourcestringthe custom resource
customResourceObjectObjecta Custom Resource object

campaignStandardCoreAPI.deleteCustomResource(customResource, customResourcePKey, customResourceObject)

Delete a Custom Resource record

Kind: instance method of CampaignStandardCoreAPI

ParamTypeDescription
customResourcestringthe custom resource
customResourcePKeystringthe PKey property of a Custom Resource record
customResourceObjectObjecta Custom Resource object

init(tenantId, apiKey, accessToken) ⇒ Promise.<CampaignStandardCoreAPI>

Returns a Promise that resolves with a new CampaignStandardCoreAPI object.

Kind: global function

ParamTypeDescription
tenantIdstringthe tenant id (your personal organization in Campaign Standard)
apiKeystringthe API key for your Adobe I/O Campaign Standard Integration
accessTokenstringthe access token for your Adobe I/O Campaign Standard Integration

Debug Logs

LOG_LEVEL=debug <your_call_here>

Prepend the LOG_LEVEL environment variable and debug value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.

Contributing

Contributions are welcome! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

4.0.1

3 months ago

4.0.0

4 months ago

3.0.1

10 months ago

3.0.0

2 years ago

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.0.5

4 years ago

2.1.0

4 years ago

2.0.3

4 years ago

2.0.4

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago