智慧行銷活動

智慧行銷活動端點參考(資產)

行銷活動端點參考(銷售機會)

使用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端點將單一Smart Campaign name作為引數,並傳回單一Smart Campaign記錄。

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陣列的第一個位置傳回一個記錄。

瀏覽

Get Smart Campaigns端點支援用於篩選和分頁的選用查詢引數。

earliestUpdatedAtlatestUpdatedAt引數接受ISO-8601格式的datetimes (不含毫秒)。 如果兩者皆已設定,則earliestUpdatedAt必須在latestUpdatedAt之前。

folder引數指定要瀏覽的父資料夾。 將其傳遞為包含idtype的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陣列中的一或多個記錄。

建立

傳送application/x-www-form-urlencoded POST要求至建立Smart Campaign端點。 需要namefolder引數。 將folder傳遞為包含idtype的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"
        }
    ]
}

更新

傳送application/x-www-form-urlencoded POST要求至更新Smart Campaign端點。 必須有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要求至仿製智慧行銷活動端點。 需要idnamefolder引數。 它們會指定來源促銷活動、新促銷活動名稱和上層資料夾。 將folder傳遞為包含idtype的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要求內文中傳遞選用的tokensrunAtcloneToProgram引數。

tokens陣列會覆寫此回合的現有程式My Token。 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作為來源的「已要求行銷活動」觸發器。

行銷活動id路徑引數及leads潛在客戶ID的整數陣列是必要的。 每個呼叫最多接受100個銷售機會。

tokens陣列引數可選擇性用來覆寫促銷活動上層方案的本機My Token。 tokens接受最多100個權杖。 每個tokens陣列專案都包含一個名稱/值組。 權杖的名稱必須格式化為"{{my.name}}"。 如果您使用新增系統權杖作為電子郵件方法中的連結來新增「viewAsWebPageLink」系統權杖,則無法使用tokens覆寫它。 改為使用將檢視新增為網頁連結至電子郵件方法,可讓您使用tokens覆寫「viewAsWebPageLink」。

在JSON要求內文中傳遞leadstokens引數。

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
        }
    ]
}
recommendation-more-help
marketo-developer-help