智能营销活动
使用Smart Campaign REST API查询、创建、克隆和删除智能营销活动。 您还可以计划批量营销活动、请求触发营销活动和管理营销活动激活。
查询
按Id
按ID获取Smart Campaign端点将单个Smart Campaign id作为路径参数并返回单个Smart Campaign记录。
GET /rest/asset/v1/smartCampaign/{id}.json
{
"success": true,
"errors": [],
"requestId": "7883#169838a32f0",
"warnings": [],
"result": [
{
"id": 1001,
"name": "Process Bounced Emails",
"description": "System smart campaign for processing bounced email events",
"createdAt": "2016-09-10T23:16:19Z+0000",
"updatedAt": "2016-09-10T23:16:19Z+0000",
"status": "Never Run",
"type": "batch",
"isSystem": false,
"isActive": false,
"isRequestable": false,
"isCommunicationLimitEnabled": false,
"recurrence": {
"weekdayOnly": false
},
"qualificationRuleType": "once",
"workspace": "Default",
"smartListId": 1001,
"flowId": 1001,
"computedUrl": "https://app-sjqe.marketo.com/#SC1001A1"
}
]
}
终结点在result数组的第一个位置返回一个记录。
按名称
按名称获取Smart Campaign端点将单个智能营销活动name作为参数并返回单个智能营销活动记录。
GET /rest/asset/v1/smartCampaign/byName.json?name=Test Trigger Campaign
{
"success": true,
"errors": [],
"requestId": "14494#16c886ffa44",
"warnings": [],
"result": [
{
"id": 1069,
"name": "Test Trigger Campaign",
"description": "",
"createdAt": "2018-02-16T01:34:39Z+0000",
"updatedAt": "2019-08-13T00:45:21Z+0000",
"folder": {
"id": 327,
"type": "Folder"
},
"status": "Inactive",
"type": "trigger",
"isSystem": false,
"isActive": false,
"isRequestable": false,
"isCommunicationLimitEnabled": false,
"recurrence": {
"weekdayOnly": false
},
"qualificationRuleType": "once",
"workspace": "Default",
"smartListId": 2747,
"flowId": 1088,
"computedUrl": "https://app-sjqe.marketo.com/#SC1069A1"
}
]
}
终结点在result数组的第一个位置返回一个记录。
浏览
获取智能营销活动端点支持用于筛选和分页的可选查询参数。
earliestUpdatedAt和latestUpdatedAt参数接受ISO-8601格式的datetimes(不含毫秒)。 如果同时设置了两者,则learestUpdatedAt必须在latestUpdatedAt之前。
folder参数指定要浏览的父文件夹。 将其作为包含id和type的JSON对象传递。
maxReturn整数指定最大条目数。 默认值为20,最大值为200。
offset整数指定开始检索条目的位置。 将它与maxReturn一起使用。 默认值为0。
设置isActive布尔值参数以仅返回活动的触发器营销活动。
GET /rest/asset/v1/smartCampaigns.json?earliestUpdatedAt=2016-09-10T23:15:00-00:00&latestUpdatedAt=2016-09-10T23:17:00-00:00
{
"success": true,
"errors": [],
"requestId": "626#16983a92965",
"warnings": [],
"result": [
{
"id": 1001,
"name": "Process Bounced Emails",
"description": "System smart campaign for processing bounced email events",
"createdAt": "2016-09-10T23:16:19Z+0000",
"updatedAt": "2016-09-10T23:16:19Z+0000",
"status": "Never Run",
"type": "batch",
"isSystem": false,
"isActive": false,
"isRequestable": false,
"isCommunicationLimitEnabled": false,
"recurrence": {
"weekdayOnly": false
},
"qualificationRuleType": "once",
"workspace": "Default",
"smartListId": 1001,
"flowId": 1001,
"computedUrl": "https://app-sjqe.marketo.com/#SC1001A1"
},
{
"id": 1002,
"name": "Process Unsubscribes",
"description": "System smart campaign for processing unsubscribe events",
"createdAt": "2016-09-10T23:16:19Z+0000",
"updatedAt": "2016-09-10T23:16:19Z+0000",
"status": "Never Run",
"type": "batch",
"isSystem": false,
"isActive": false,
"isRequestable": false,
"isCommunicationLimitEnabled": false,
"recurrence": {
"weekdayOnly": false
},
"qualificationRuleType": "once",
"workspace": "Default",
"smartListId": 1002,
"flowId": 1002,
"computedUrl": "https://app-sjqe.marketo.com/#SC1002A1"
}
]
}
终结点在result数组中返回一个或多个记录。
创建
向创建Smart Campaign终结点发送application/x-www-form-urlencoded个POST请求。 name和folder参数是必需的。 将folder作为包含id和type的JSON对象传递。
或者,您可以使用description参数(最多2,000个字符)描述智能营销活动。
POST /rest/asset/v1/smartCampaigns.json
Content-Type: application/x-www-form-urlencoded
name=Smart Campaign 02&folder={"type": "folder","id": 640}&description=This is a smart campaign creation test.
{
"success": true,
"errors": [],
"requestId": "25bc#16c9138f148",
"warnings": [],
"result": [
{
"id": 1076,
"name": "Smart Campaign 02",
"description": "This is a smart campaign creation test.",
"createdAt": "2019-08-14T17:42:04Z+0000",
"updatedAt": "2019-08-14T17:42:04Z+0000",
"folder": {
"id": 640,
"type": "Folder"
},
"status": "Never Run",
"type": "batch",
"isSystem": false,
"isActive": false,
"isRequestable": false,
"isCommunicationLimitEnabled": true,
"recurrence": {
"weekdayOnly": false
},
"qualificationRuleType": "once",
"workspace": "Default",
"smartListId": 5132,
"flowId": 1095,
"computedUrl": "https://app-sjqe.marketo.com/#SC1076A1"
}
]
}
更新
向更新Smart Campaign终结点发送application/x-www-form-urlencoded个POST请求。 smart-campaign id路径参数是必需的。 使用name更改名称,或使用description更改描述。
POST /rest/asset/v1/smartCampaign/{id}.json
Content-Type: application/x-www-form-urlencoded
name=Smart Campaign 02 Update&description=This is a smart campaign update test.
{
"success": true,
"errors": [],
"requestId": "14b6a#16c924b992f",
"warnings": [],
"result": [
{
"id": 1076,
"name": "Smart Campaign 02 Update",
"description": "This is a smart campaign update test.",
"createdAt": "2019-08-14T17:42:04Z+0000",
"updatedAt": "2019-08-14T22:42:04Z+0000",
"folder": {
"id": 640,
"type": "Folder"
},
"status": "Never Run",
"type": "batch",
"isSystem": false,
"isActive": false,
"isRequestable": false,
"isCommunicationLimitEnabled": true,
"recurrence": {
"weekdayOnly": false
},
"qualificationRuleType": "once",
"workspace": "Default",
"smartListId": 5132,
"flowId": 1095,
"computedUrl": "https://app-sjqe.marketo.com/#SC1076A1"
}
]
}
克隆
向克隆智能营销活动端点发送application/x-www-form-urlencoded个POST请求。 id、name和folder参数是必需的。 它们指定源营销活动、新营销活动名称和父文件夹。 将folder作为包含id和type的JSON对象传递。
或者,您可以使用description参数(最多2,000个字符)描述智能营销活动。
POST /rest/asset/v1/smartCampaign/{id}/clone.json
Content-Type: application/x-www-form-urlencoded
name=Test Trigger Campaign Clone&folder={"type": "folder","id": 640}&description=This is a smart campaign clone test.
{
"success": true,
"errors": [],
"requestId": "681d#16c9339499b",
"warnings": [],
"result": [
{
"id": 1077,
"name": "Test Trigger Campaign Clone",
"description": "This is a smart campaign clone test.",
"createdAt": "2019-08-15T03:01:41Z+0000",
"updatedAt": "2019-08-15T03:01:41Z+0000",
"folder": {
"id": 640,
"type": "Folder"
},
"status": "Inactive",
"type": "trigger",
"isSystem": false,
"isActive": false,
"isRequestable": false,
"isCommunicationLimitEnabled": false,
"recurrence": {
"weekdayOnly": false
},
"qualificationRuleType": "once",
"workspace": "Default",
"smartListId": 5135,
"flowId": 1096,
"computedUrl": "https://app-sjqe.marketo.com/#SC1077A1"
}
]
}
删除
删除Smart Campaign终结点将单个Smart Campaign id作为路径参数。
POST /rest/asset/v1/smartCampaign/{id}/delete.json
{
"success": true,
"errors": [],
"requestId": "d757#16c934216ac",
"warnings": [],
"result": [
{
"id": 1077
}
]
}
批次
在指定的时间批量运行智能营销活动,并将定义的潜在客户集一起处理。
计划
使用计划营销活动来计划批次营销活动。 活动id路径参数是必需的。 在JSON请求正文中传递可选的tokens、runAt和cloneToProgram参数。
tokens数组将覆盖此运行的现有程序“我的令牌”。 在营销策划运行后,Marketo会放弃覆盖。 每个项目都包含一个名称/值对,并且令牌名称必须使用{{my.name}}格式。
runAt日期时间参数指定运行营销活动的时间。 如果忽略,则营销活动将在请求后五分钟运行。 该值以后不能超过两年。
通过此API计划的营销活动始终在运行时至少等待五分钟。
cloneToProgram字符串参数包含生成程序的名称。 设置后,这将导致使用生成的新名称创建营销活动、父项目及其所有资产。 克隆了父项目,并将计划新创建的营销策划。 生成的项目将在父项目下创建。 包含代码片段、推送通知、应用程序内消息、静态列表、报表和社交资产的程序可能无法以这种方式克隆。 在使用时,此端点限制每天最多20次调用。 克隆程序端点是推荐的替代项。
POST /rest/v1/campaigns/{id}/schedule.json
{
"input":
{
"runAt": "2018-03-28T18:05:00+0000",
"tokens": [
{
"name": "{{my.message}}",
"value": "Updated message"
},
{
"name": "{{my.other token}}",
"value": "Value for other token"
}
]
}
}
{
"requestId": "52b#161d90e1743",
"result": [
{
"id": 3713
}
],
"success": true
}
触发器
触发智能营销活动每次处理一个人以响应事件。
请求
使用请求营销活动通过触发器营销活动流程传递潜在客户。 营销活动必须使用将Web服务API用作其源的Campaign is Requested触发器。
市场活动id路径参数和leads商机ID的整数数组是必需的。 每个调用最多接受100个潜在客户。
(可选)可以使用tokens数组参数覆盖营销活动父项目本地的“我的令牌”。 tokens最多接受100个令牌。 每个tokens数组项都包含一个名称/值对。 令牌的名称必须格式化为“{{my.name}}”。 如果您使用添加系统令牌作为电子邮件方法中的链接来添加“viewAsWebPageLink”系统令牌,则无法使用tokens覆盖它。 请改为使用将视图作为网页链接添加到电子邮件方法,此方法允许您使用tokens覆盖“viewAsWebPageLink”。
在JSON请求正文中传递leads和tokens参数。
POST /rest/v1/campaigns/{id}/trigger.json
{
"input":
{
"leads" : [
{
"id" : 318592
},
{
"id" : 318593
}
],
"tokens" : [
{
"name": "{{my.message}}",
"value": "Updated message"
},
{
"name": "{{my.other token}}",
"value": "Value for other token"
}
]
}
}
{
"requestId": "9e01#161d922f1aa",
"result": [
{
"id": 3712
}
],
"success": true
}
激活
激活Smart Campaign终结点很简单。 id路径参数是必需的。 要使激活成功,营销活动必须满足以下条件:
- 营销活动已停用。
- 营销活动至少具有一个触发器和一个流程步骤。
- 营销活动具有无错误的触发器、过滤器和流程步骤。
POST /rest/asset/v1/smartCampaign/{id}/activate.json
{
"success": true,
"errors": [],
"requestId": "a33a#161d9c0dcf3",
"result": [
{
"id": 1069
}
]
}
停用
停用智能营销活动很简单。 id路径参数是必需的。 要成功停用,必须激活营销活动。
POST /rest/asset/v1/smartCampaign/{id}/deactivate.json
{
"success": true,
"errors": [],
"requestId": "6228#161d9c29fbf",
"result": [
{
"id": 1069
}
]
}