Node Javascript SDK wrapping the Adobe Campaign Standard APIs.
$ npm install
- 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
- 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
- init(tenantId, apiKey, accessToken) ⇒
Promise.<CampaignStandardCoreAPI>
Returns a Promise that resolves with a new CampaignStandardCoreAPI object.
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)
the tenant id (your personal organization in Campaign Standard)
Kind: instance property of CampaignStandardCoreAPI
the api key from your Adobe I/O Campaign Standard integration
Kind: instance property of CampaignStandardCoreAPI
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
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 |
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) |
Create a Profile record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
profileObject | Object |
see profile properties |
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. |
Get a Profile record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
profilePKey | string |
the PKey property of a Profile record |
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) |
Create a Service record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
serviceObject | Object |
see service properties |
Get a Service record
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
servicePKey | string |
the PKey property of a Service record |
Get the marketing history of a Profile
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
profilePKey | string |
the PKey property of a Profile record |
Get the metadata information for a resource.
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
resource | string |
one of profile, service, history |
Retrieve custom resource linked to the Profile table
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
resource | string |
any custom resource |
Get all the custom resource collections linked to the Profile table.
Kind: instance method of CampaignStandardCoreAPI
Create a new GDPR request.
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
gdprRequest | Object |
see the properties that are needed. |
Get data about the current GDPR request.
Kind: instance method of CampaignStandardCoreAPI
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 |
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. |
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. |
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) |
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) |
Gets the properties of a workflow.
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
workflowId | string |
the id of the workflow |
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) |
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 |
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) |
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 |
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 |
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. |
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 |
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) |
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) |
Get all Custom Resource records
Kind: instance method of CampaignStandardCoreAPI
Param | Type | Description |
---|---|---|
resource | string |
one of profile, service, history |
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. |
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 |
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 |
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.
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.