README
Adobe I/O Adobe Campaign Standard SDK
Node Javascript SDK wrapping the Adobe Campaign Standard APIs.
Installing
$ npm install
Usage
- 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
- 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
- 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
Functions
- init(tenantId, apiKey, accessToken) ⇒
Promise.<CampaignStandardCoreAPI>
Returns a Promise that resolves with a new CampaignStandardCoreAPI object.
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
- .apiKey
- .accessToken
- .init(tenantId, apiKey, accessToken) ⇒
CampaignStandardCoreAPI
- .getAllProfiles([parameters])
- .createProfile(profileObject)
- .updateProfile(profilePKey, profileObject)
- .getProfile(profilePKey)
- .getAllServices([parameters])
- .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])
- .controlWorkflow(workflowId, command)
- .getAllOrgUnits([parameters])
- .getProfileWithOrgUnit(profilePKey)
- .updateProfileOrgUnit(profilePKey, orgUnitPKey)
- .updateOrgUnit(orgUnitPKey, orgUnitObject)
- .postDataToUrl(url, body)
- .getDataFromRelativeUrl(relativeUrl)
.getAllCustomResources(customResource, [parameters])- .getAllBasicCustomResources(resource)
- .getAllProfileAndServicesExt(customResource, [parameters])
- .updateCustomResource(customResource, customResourcePKey, customResourceObject)
- .createCustomResource(customResource, customResourceObject)
- .deleteCustomResource(customResource, customResourcePKey, customResourceObject)
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
campaignStandardCoreAPI.init(tenantId, apiKey, accessToken) ⇒ 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 |
campaignStandardCoreAPI.getAllProfiles([parameters])
Get all Profile records
Kind: 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) |
campaignStandardCoreAPI.createProfile(profileObject)
Create a Profile record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
profileObject | Object |
see profile properties |
campaignStandardCoreAPI.updateProfile(profilePKey, profileObject)
Update a Profile record
Kind: 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. |
campaignStandardCoreAPI.getProfile(profilePKey)
Get a Profile record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
profilePKey | string |
the PKey property of a Profile record |
campaignStandardCoreAPI.getAllServices([parameters])
Get all Service records
Kind: 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) |
campaignStandardCoreAPI.createService(serviceObject)
Create a Service record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
serviceObject | Object |
see service properties |
campaignStandardCoreAPI.getService(servicePKey)
Get a Service record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
servicePKey | string |
the PKey property of a Service record |
campaignStandardCoreAPI.getHistoryOfProfile(profilePKey)
Get the marketing history of a Profile
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
profilePKey | string |
the PKey property of a Profile record |
campaignStandardCoreAPI.getMetadataForResource(resource)
Get the metadata information for a resource.
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
resource | string |
one of profile, service, history |
campaignStandardCoreAPI.getMetadataForResourceExt(resource)
Retrieve custom resource linked to the Profile table
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
resource | string |
any 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
Param | Type | Description |
---|---|---|
gdprRequest | Object |
see 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
Param | Type | Description |
---|---|---|
privacyRequestDataUrl | string |
this is acquired from a getGDPRRequest call |
requestInternalName | string |
the 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
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. |
campaignStandardCoreAPI.sendTransactionalEventForMacTenantId(macTenantId, eventId, eventBody)
Send a transactional event for a Marketing Cloud Tenant ID
Kind: 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. |
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
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) |
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
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) |
campaignStandardCoreAPI.getWorkflow(workflowId)
Gets the properties of a workflow.
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
workflowId | string |
the id of the workflow |
campaignStandardCoreAPI.triggerSignalActivity(workflowTriggerUrl, [workflowParameters])
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) |
campaignStandardCoreAPI.controlWorkflow(workflowId, command)
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 |
campaignStandardCoreAPI.getAllOrgUnits([parameters])
Get all available orgUnits
Kind: 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) |
campaignStandardCoreAPI.getProfileWithOrgUnit(profilePKey)
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 |
campaignStandardCoreAPI.updateProfileOrgUnit(profilePKey, orgUnitPKey)
Update the orgUnit of a Profile
Kind: 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 |
campaignStandardCoreAPI.updateOrgUnit(orgUnitPKey, orgUnitObject)
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. |
campaignStandardCoreAPI.postDataToUrl(url, body)
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 |
campaignStandardCoreAPI.getDataFromRelativeUrl(relativeUrl)
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) |
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
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) |
campaignStandardCoreAPI.getAllBasicCustomResources(resource)
Get all Custom Resource records
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
resource | string |
one of profile, service, history |
campaignStandardCoreAPI.getAllProfileAndServicesExt(customResource, [parameters])
Get all Custom Resource records
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) |
campaignStandardCoreAPI.updateCustomResource(customResource, customResourcePKey, customResourceObject)
Update a Custom Resource record
Kind: 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. |
campaignStandardCoreAPI.createCustomResource(customResource, customResourceObject)
Create a Custom Resource record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
customResource | string |
the custom resource |
customResourceObject | Object |
a Custom Resource object |
campaignStandardCoreAPI.deleteCustomResource(customResource, customResourcePKey, customResourceObject)
Delete a Custom Resource record
Kind: 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 |
Promise.<CampaignStandardCoreAPI>
init(tenantId, apiKey, accessToken) ⇒ 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 |
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.