Adobe I/O Campaign Standard SDK
npm install @adobe/aio-lib-campaign-standard

!Node.js CI


``bash`
$ npm install
`javascript
const sdk = require('@adobe/aio-lib-campaign-standard')
async function sdkTest() {
//initialize sdk
const campaignStandardClient = await sdk.init('
}
`
Init method returns an instance of the Class CampaignStandardCoreAPI
2) Call methods using the initialized SDK
`javascript
const sdk = require('@adobe/aio-lib-campaign-standard')
async function sdkTest() {
//initialize sdk
const campaignStandardClient = await sdk.init('
// 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
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
Promise.<CampaignStandardCoreAPI>Returns a Promise that resolves with a new CampaignStandardCoreAPI object.
method on it
with valid values for tenantId, apiKey and accessTokenKind: global class
* CampaignStandardCoreAPI
* .tenantId
* .apiKey
* .accessToken
* .init(tenantId, apiKey, accessToken) ⇒ CampaignStandardCoreAPI
* [.getAllProfiles([parameters])](#CampaignStandardCoreAPI+getAllProfiles)
* .createProfile(profileObject)
* .updateProfile(profilePKey, profileObject)
* .getProfile(profilePKey)
* [.getAllServices([parameters])](#CampaignStandardCoreAPI+getAllServices)
* .createService(serviceObject)
* .getService(servicePKey)
* .getHistoryOfProfile(profilePKey)
* .getMetadataForResource(resource)
* .getMetadataForResourceExt(resource)
* .getCustomResources()
* .createGDPRRequest(gdprRequest)
* .getGDPRRequest()
* .getGDPRDataFile(privacyRequestDataUrl, requestInternalName)
* ~~.sendTransactionalEvent(eventId, eventBody)~~
* .sendTransactionalEventForMacTenantId(macTenantId, eventId, eventBody)
* ~~.getTransactionalEvent(eventId, eventPKey)~~
* .getTransactionalEventForMacTenantId(macTenantId, eventId, eventPKey)
* .getWorkflow(workflowId)
* [.triggerSignalActivity(workflowTriggerUrl, [workflowParameters])](#CampaignStandardCoreAPI+triggerSignalActivity)
* .controlWorkflow(workflowId, command)
* [.getAllOrgUnits([parameters])](#CampaignStandardCoreAPI+getAllOrgUnits)
* .getProfileWithOrgUnit(profilePKey)
* .updateProfileOrgUnit(profilePKey, orgUnitPKey)
* .updateOrgUnit(orgUnitPKey, orgUnitObject)
* .postDataToUrl(url, body)
* .getDataFromRelativeUrl(relativeUrl)
* ~~[.getAllCustomResources(customResource, [parameters])](#CampaignStandardCoreAPI+getAllCustomResources)~~
* .getAllBasicCustomResources(resource)
* [.getAllProfileAndServicesExt(customResource, [parameters])](#CampaignStandardCoreAPI+getAllProfileAndServicesExt)
* .updateCustomResource(customResource, customResourcePKey, customResourceObject)
* .createCustomResource(customResource, customResourceObject)
* .deleteCustomResource(customResource, customResourcePKey, customResourceObject)
$3
the tenant id (your personal organization in Campaign Standard)Kind: instance property of CampaignStandardCoreAPI
$3
the api key from your Adobe I/O Campaign Standard integrationKind: instance property of CampaignStandardCoreAPI
$3
the access token from your Adobe I/O Campaign Standard integrationKind: instance property of CampaignStandardCoreAPI
$3
Initializes this object.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| tenantId | string | the tenant id (your personal organization in Campaign Standard) |
| apiKey | string | the API key for your Adobe I/O Campaign Standard Integration |
| accessToken | string | the access token for your Adobe I/O Campaign Standard Integration |
$3
Get all Profile recordsKind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [parameters] | Object | {} | parameters to pass |
| [parameters.filters] | Array | [] | apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call |
| [parameters.hasCustomFilter] | Boolean | false | set to true if you have a custom filter. Defaults to false. |
| [parameters.lineCount] | integer | 25 | limit the number of records to return (default is 25) |
| [parameters.order] | string | | the field to order your records by (see the fields of a Profile) |
| [parameters.descendingSort] | boolean | false | set to true to get results in descending order (default is ascending) |
$3
Create a Profile recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| profileObject | Object | see profile properties |
$3
Update a Profile recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| profilePKey | string | the PKey property of a Profile record |
| profileObject | Object | see profile properties. Only set the properties you want to update. |
$3
Get a Profile recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| profilePKey | string | the PKey property of a Profile record |
$3
Get all Service recordsKind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [parameters] | Object | {} | parameters to pass |
| [parameters.filters] | Array | [] | apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call |
| [parameters.hasCustomFilter] | Boolean | false | set to true if you have a custom filter. Defaults to false. |
| [parameters.lineCount] | integer | 25 | limit the number of records to return (default is 25) |
| [parameters.order] | string | | the field to order your records by (see the fields of a Service) |
| [parameters.descendingSort] | descendingSort | false | set to true to get results in descending order (default is ascending) |
$3
Create a Service recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| serviceObject | Object | see service properties |
$3
Get a Service recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| servicePKey | string | the PKey property of a Service record |
$3
Get the marketing history of a ProfileKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| profilePKey | string | the PKey property of a Profile record |
$3
Get the metadata information for a resource.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| resource | string | one of profile, service, history |
$3
Retrieve custom resource linked to the Profile tableKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| resource | string | any custom resource |
$3
Get all the custom resource collections linked to the Profile table.Kind: instance method of CampaignStandardCoreAPI
$3
Create a new GDPR request.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| gdprRequest | Object | see the properties that are needed. |
$3
Get data about the current GDPR request.Kind: instance method of CampaignStandardCoreAPI
$3
Get the GDPR data file.Kind: instance method of CampaignStandardCoreAPI
See: getGDPRRequest
| Param | Type | Description |
| --- | --- | --- |
| privacyRequestDataUrl | string | this is acquired from a getGDPRRequest call |
| requestInternalName | string | the request internal name |
$3
DeprecatedSend a transactional event.
Deprecated since 2.1.0. use sendTransactionalEventForMacTenantId instead.
Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| eventId | string | the type of event you want to send. This depends on the event definition. |
| eventBody | Object | the event data to send. This depends on the event definition. |
$3
Send a transactional event for a Marketing Cloud Tenant IDKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| macTenantId | string | the Marketing Cloud Tenant ID |
| eventId | string | the type of event you want to send. This depends on the event definition. |
| eventBody | Object | the event data to send. This depends on the event definition. |
$3
DeprecatedGets data about a transactional event (status, properties)
Deprecated since 2.1.0. use getTransactionalEventForMacTenantId instead.
Kind: instance method of CampaignStandardCoreAPI
See: sendTransactionalEvent
| Param | Type | Description |
| --- | --- | --- |
| eventId | string | the type of event you want to send |
| eventPKey | string | the PKey of an event (you get this from a sendTransactionalEvent call) |
$3
Gets data about a transactional event for a Marketing Cloud Tenant ID (status, properties)Kind: instance method of CampaignStandardCoreAPI
See: sendTransactionalEvent
| Param | Type | Description |
| --- | --- | --- |
| macTenantId | string | the Marketing Cloud Tenant ID |
| eventId | string | the type of event you want to send |
| eventPKey | string | the PKey of an event (you get this from a sendTransactionalEvent call) |
$3
Gets the properties of a workflow.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| workflowId | string | the id of the workflow |
$3
Trigger a workflow.Kind: instance method of CampaignStandardCoreAPI
See: getWorkflow
| Param | Type | Description |
| --- | --- | --- |
| workflowTriggerUrl | string | the trigger url for a workflow. You can get this from a call to getWorkflow |
| [workflowParameters] | Object | workflow parameters object. see the payload in the docs |
| workflowParameters.source | string | the triggering request source |
| workflowParameters.parameters | Object | the parameters to send to the workflow (paramater name, and parameter value pairs) |
$3
Controls execution of a workflow.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| workflowId | string | the id of the workflow |
| command | string | the command to execute for the workflow. one of start, pause, resume, stop |
$3
Get all available orgUnitsKind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [parameters] | Object | {} | parameters to pass |
| [parameters.filters] | Array | [] | apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call |
| [parameters.lineCount] | integer | 25 | limit the number of records to return (default is 25) |
| [parameters.order] | string | | the field to order your records by (see the fields of a OrgUnitBase) |
| [parameters.descendingSort] | descendingSort | false | set to true to get results in descending order (default is ascending) |
$3
Gets a Profile record (with it's orgUnit property)Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| profilePKey | string | the PKey property of a Profile record |
$3
Update the orgUnit of a ProfileKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| profilePKey | string | the PKey property of a Profile record |
| orgUnitPKey | string | the PKey property of a OrgUnitBase record |
$3
Update the properties of an OrgUnitBase.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| orgUnitPKey | string | the PKey property of a OrgUnitBase record |
| orgUnitObject | Object | see orgUnitBase properties. Only set the properties you want to update. |
$3
Post to an absolute url.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| url | string | the url to POST to |
| body | Object | the POST body |
$3
Gets data from a relative url. Helper function.Kind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| relativeUrl | string | the relative url (returned from some ACS API calls) |
$3
DeprecatedGet 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
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| customResource | string | | the custom resource to get records from |
| [parameters] | Object | {} | parameters to pass |
| [parameters.filters] | Array | [] | apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call |
| [parameters.hasCustomFilter] | Boolean | false | set to true if you have a custom filter. Defaults to false. |
| [parameters.lineCount] | integer | 25 | limit the number of records to return (default is 25) |
| [parameters.order] | string | | the field to order your records by (see the fields of a Profile) |
| [parameters.descendingSort] | boolean | false | set to true to get results in descending order (default is ascending) |
$3
Get all Custom Resource recordsKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| resource | string | one of profile, service, history |
$3
Get all Custom Resource recordsKind: instance method of CampaignStandardCoreAPI
See: getMetadataForResource
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| customResource | string | | the custom resource to get records from |
| [parameters] | Object | {} | parameters to pass |
| [parameters.filters] | Array | [] | apply the filters to the results. List of filters for a resource can be retrieved via a getMetadataForResource call |
| [parameters.hasCustomFilter] | Boolean | false | set to true if you have a custom filter. Defaults to false. |
| [parameters.lineCount] | integer | 25 | limit the number of records to return (default is 25) |
| [parameters.order] | string | | the field to order your records by (see the fields of a Profile) |
| [parameters.descendingSort] | boolean | false | set to true to get results in descending order (default is ascending) |
$3
Update a Custom Resource recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| customResource | string | the custom resource |
| customResourcePKey | string | the PKey property of a Custom Resource record |
| customResourceObject | Object | A Custom Resource object. Only set the properties you want to update. |
$3
Create a Custom Resource recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| customResource | string | the custom resource |
| customResourceObject | Object | a Custom Resource object |
$3
Delete a Custom Resource recordKind: instance method of CampaignStandardCoreAPI
| Param | Type | Description |
| --- | --- | --- |
| customResource | string | the custom resource |
| customResourcePKey | string | the PKey property of a Custom Resource record |
| customResourceObject | Object | a Custom Resource object |
init(tenantId, apiKey, accessToken) ⇒ Promise.<CampaignStandardCoreAPI>
Returns a Promise that resolves with a new CampaignStandardCoreAPI object.Kind: global function
| Param | Type | Description |
| --- | --- | --- |
| tenantId | string | the tenant id (your personal organization in Campaign Standard) |
| apiKey | string | the API key for your Adobe I/O Campaign Standard Integration |
| accessToken | string | the access token for your Adobe I/O Campaign Standard Integration |
$3
`bash
LOG_LEVEL=debug
`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.Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.