登入註冊

Overview

電子豹推出的群發(Campaign)型 API,讓開發者可透過 API 操作的方式,自動完成與在電子豹後台一樣的操作,提供更彈性的選擇。詳情請參閱本篇內文,有任何問題皆歡迎來信詢問。

電子豹 API 主要分成三個部分:

  1. Report 報表相關

  2. Contacts 名單相關

  3. Campaign 活動相關

驗證

申請 API KEY 流程:

  1. 註冊 電子豹帳號

  2. 寄信至 service@newsleopard.com,信件請註名 申請 API KEY,並附上註冊之 mail address

  3. 開通後將會回信通知

進行 API 連線,必須在 request header 中帶入驗證資訊

key value
x-api-key 金鑰內容

若沒有帶入驗證資訊,或是金鑰內容有誤。將會回傳:

Status: 403
  {
    "message": "Forbidden"
  }

寄信流程教學

按照下面步驟流程,即可進行自動化寄信:

(若要匯入名單至既有群組則可跳過 步驟 1. 建立群組

  1. 建立群組

    使用 新增群組 API 可以得到 群組代碼

  2. 匯入名單至指定群組

    使用 匯入名單至特定群組 API 將名單匯入至指定的群組內

  3. 建立活動進行寄送

    使用 建立活動並且寄送 API
    使用時,需要先準備好信件內容 (html 格式),並確認 request payload (json 格式) 的內容設定是否正確無誤

取得報表流程教學

按照下面步驟流程,即可進行匯出報表並取得下載連結:

  1. 取得活動代碼

    使用 查詢活動代碼 API 可以得到 活動代碼

  2. 產生報表明細內容

    使用 匯出報表 API,產生報表檔案

  3. 取得報表下載連結

    使用 查詢報表連結 API,得到報表檔案下載連結,下載後即可作後續的處理

速率限制

針對 API 調用的速率限制 ( rate limit ),可以參考下面的規範:

  1. 10 requests / 1 sec

  2. 10000 requests / 1 day

若超出此限制,會得到下列回應訊息:

{"message":"Limit Exceeded"}

Addressbook

電子豹平台的名單管理機制,以 Email address 當作唯一識別的欄位

  • 一個聯絡人 ( contact ) 可以隸屬於多個群組 ( list ) 中

  • 當群組被刪除時,聯絡人只是從此群組移出,並不會跟著被刪除

  • 當聯絡人被刪除時,所有包含此聯絡人的群組將會移除此聯絡人

自訂變數

自訂變數是個非常方便的功能,每個聯絡人可以動態新增多個自訂變數的值,提供寄送信件時自動地將自訂變數帶入到信件內容中。或是可以於後台介面篩選搜尋聯絡人使用

  • 自訂變數主要分成 3 種資料型別 ( 字串、數字、日期 ),會於匯入時自動依照匯入資料的內容自動判定

  • 當某個欄位因為第一次匯入自動判定為 數字 型別後,之後匯入的內容如果 非數字 的型別,此筆資料將會被判定在匯入失敗的筆數中

  • 若有需要修改自訂變數的內容或是聯絡人的 NAME,只需要修改匯入的資料內容 ( email 需相同 ) 重新再匯入即可更新資料

附件參考

config.schedule.type

代碼 說明
0 立即寄送
1 排程寄送

config.schedule.timezone

代碼 區域名稱
0 KIRITIMATI
1 CHATHAM
2 AUCKLAND
3 ENDERBURY
4 TONGATAPU
5 KAMCHATKA
6 FIJI
7 LORD_HOWE
8 SYDNEY
9 GUADALCANAL
10 NORFOLK
11 ADELAIDE
12 BRISBANE
13 DARWIN
14 SEOUL
15 TOKYO
16 HONG_KONG
17 KUALA_LUMPUR
18 MANILA
19 SHANGHAI
20 SINGAPORE
21 TAIPEI
22 PERTH
23 BANGKOK
24 HO_CHI_MINH
25 JAKARTA
26 RANGOON
27 DHAKA
28 KATHMANDU
29 COLOMBO
30 KOLKATA
31 KARACHI
32 TASHKENT
33 YEKATERINBURG
34 KABUL
35 TEHRAN
36 DUBAI
37 TBILISI
38 NAIROBI
39 BAGHDAD
40 JERUSALEM
41 KUWAIT
42 RIYADH
43 ATHENS
44 BUCHAREST
45 HELSINKI
46 ISTANBUL
47 MINSK
48 MOSCOW
49 CAIRO
50 JOHANNESBURG
51 AMSTERDAM
52 BERLIN
53 BRUSSELS
54 PARIS
55 PRAGUE
56 ROME
57 ALGIERS
58 DUBLIN
59 LISBON
60 LONDON
61 GMT
62 CAPE_VERDE
63 SOUTH_GEORGIA
64 ST_JOHNS
65 BUENOS_AIRES
66 HALIFAX
67 SANTIAGO
68 SAO_PAULO
69 BERMUDA
70 CARACAS
71 INDIANAPOLIS
72 NEW_YORK
73 PUERTO_RICO
74 BOGOTA
75 CHICAGO
76 LIMA
77 PANAMA
78 DENVER
79 EL_SALVADOR
80 MEXICO_CITY
81 LOS_ANGELES
82 PHOENIX
83 TIJUANA
84 ANCHORAGE
85 HONOLULU
86 NIUE
87 PAGO_PAGO

錯誤代碼對照表

呼叫 Campaign API 時,若發生錯誤可參考此表

錯誤代碼 說明
40001 欄位錯誤
40003 無效的 EMAIL
40004 不允許的 DOMAIN
40007 無效的 SN
40008 不支援的檔案格式
40009 檔案內容為空
40010 檔案大小超過限制
40011 未驗證寄件人地址
40012 餘額不足
40013 沒有可寄送的名單
40014 無效的活動內容
40015 無效的傳送資訊
40017 餘額不足無法測試
40019 錯誤的排程時間
40020 無效的日期格式

報表 - Report

報表相關 API

查詢活動代碼

GET https://api.newsleopard.com/v1/report/campaigns?startDate=&endDate=
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: `Your API Key`
Responses200
Headers
Content-Type: application/json
Body
{
  "sn": "402810c26cb86ad7016cb8b2414a0003",
  "name": "活動名稱",
  "sentBeginDate": "2019-04-01T08:38:32.569Z",
  "sentEndDate": "2019-08-27T08:08:54.09Z"
}
Schema
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "sn": {
        "type": "string",
        "description": "活動代碼",
        "examples": [
          "活動代碼"
        ]
      },
      "name": {
        "type": "string",
        "description": "活動名稱",
        "examples": [
          "活動名稱"
        ]
      },
      "sentBeginDate": {
        "type": "string",
        "description": "活動寄送時間",
        "format": "date-time",
        "examples": [
          "2019-04-01T08:38:32.569Z"
        ]
      },
      "sentEndDate": {
        "type": "string",
        "description": "活動寄送完成時間",
        "format": "date-time"
      }
    }
  }
}

查詢活動代碼
GET/v1/report/campaigns{?startDate,endDate}

功能說明

寄信時間區間,查詢活動代碼 日期參數非必需,查詢結果可參照注意事項之說明

注意事項:
  1. 無傳入日期參數,預設回傳最近10筆已寄送完成的活動資料

  2. 有傳入日期參數 (startDate, endDate 皆有傳入且符合格式規範),回傳此區間內所有已寄送完成的活動資料

  3. 有傳入日期參數 (只有 startDate 或 endDate) 將視同無效的時間區間,預設回傳最近10筆已寄送完成的活動資料

URI Parameters
HideShow
startDate
string (optional) 

開始日期
格式: 2019-04-01T08:38:32.00Z
備註: 請確認日期時間為 UTC+0

endDate
string (optional) 

結束日期
格式: 2019-04-05T05:30:30.00Z
備註: 請確認日期時間為 UTC+0


匯出報表

POST https://api.newsleopard.com/v1/report/campaign_sn/export
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "webhookUrl": "https://yours.webhook.com.tw"
}
Schema
{
  "type": "object",
  "properties": {
    "webhookUrl": {
      "type": "string",
      "description": "webhook 連結",
      "examples": [
        "https://yours.webhook.com.tw"
      ]
    }
  }
}
Responses200403
Headers
Content-Type: application/json
Headers
Content-Type: application/json
Body
{
  "code": "40303",
  "message": "bad operation with invalid user state"
}
Schema
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "錯誤代碼",
      "examples": [
        "40303"
      ]
    },
    "message": {
      "type": "string",
      "description": "訊息",
      "examples": [
        "bad operation with invalid user state"
      ]
    }
  }
}

匯出報表
POST/v1/report/{campaign_sn}/export

功能說明

因系統匯出活動報表會需要一段處理時間,故匯出報表功能採非同步的處理機制

流程步驟:
  1. 匯出活動報表檔案

  2. 匯出報表後,以POST的方式,將下載連結回傳至webhookUrl

  3. 若無提供 webhookUrl, 亦可利用 查詢報表連結 API 取得下載報表連結

使用限制:
  1. 呼叫頻率最多1次/1小時,重複呼叫系統將視為無效的呼叫
URI Parameters
HideShow
campaign_sn
string (required) 

活動代碼


查詢報表連結

GET https://api.newsleopard.com/v1/report/campaign_sn/link
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Responses200403
Headers
Content-Type: application/json
Body
{
  "Reports": [
    {
      "reportType": "delivery",
      "link": "https://sample.domain/filename-delivery.cs",
      "createdDate": "2019-04-01T08:38:32.569Z"
    }
  ]
}
Schema
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "reportType": {
        "type": "string",
        "description": "報表類型",
        "enum": [
          "delivery",
          "open",
          "click",
          "bounce",
          "unsubscribe",
          "complain"
        ],
        "examples": [
          "delivery"
        ]
      },
      "link": {
        "type": "string",
        "description": "檔案連結",
        "examples": [
          "https://sample.domain/filename-reportType.csv"
        ]
      },
      "createdDate": {
        "type": "string",
        "description": "報表建立日期",
        "format": "date-time"
      }
    }
  },
  "examples": [
    [
      {
        "reportType": "delivery",
        "link": ":https://sample.domain/filename-delivery.csv",
        "createdDate": "2019-04-01T08:38:32.569Z"
      },
      {
        "reportType": "open",
        "link": ":https://sample.domain/filename-open.csv",
        "createdDate": "2019-04-01T08:38:32.569Z"
      },
      {
        "reportType": "click",
        "link": ":https://sample.domain/filename-click.csv",
        "createdDate": "2019-04-01T08:38:32.569Z"
      },
      {
        "reportType": "bounce",
        "link": ":https://sample.domain/filename-bounce.csv",
        "createdDate": "2019-04-01T08:38:32.569Z"
      },
      {
        "reportType": "unsubscribe",
        "link": ":https://sample.domain/filename-unsubscribe.csv",
        "createdDate": "2019-04-01T08:38:32.569Z"
      },
      {
        "reportType": "complain",
        "link": ":https://sample.domain/filename-complain.csv",
        "createdDate": "2019-04-01T08:38:32.569Z"
      }
    ]
  ]
}

40303 傳入無效的 campaign_sn

Headers
Content-Type: application/json
Body
{
  "code": "40303",
  "message": "bad operation with invalid user state"
}
Schema
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "錯誤代碼",
      "examples": [
        "40303"
      ]
    },
    "message": {
      "type": "string",
      "description": "訊息",
      "examples": [
        "bad operation with invalid user state"
      ]
    }
  }
}

查詢報表連結
GET/v1/report/{campaign_sn}/link

功能說明

查詢活動報表下載連結

注意事項:
  1. 若欲更新下載的資料,請先使用 匯出報表 API,重新產生報表檔案

  2. 重新產生報表時,會先檢查有沒有新的資料,有新的資料時才會產生新的報表內容

報表種類分類:
  • delivery - 到達

  • open - 開信

  • click - 點擊

  • bounce - 退信

  • unsubscribe - 取消訂閱

  • complain - 抱怨

URI Parameters
HideShow
campaign_sn
string (required) 

活動代碼


名單 - Contacts

名單相關 API

匯入名單檔案 - 取得檔案上傳連結

POST https://api.newsleopard.com/v1/contacts/imports/file
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "webhookUrl": "https://yours.webhook.com.tw"
}
Schema
{
  "type": "object",
  "properties": {
    "webhookUrl": {
      "type": "string",
      "description": "webhook 連結",
      "examples": [
        "https://yours.webhook.com.tw"
      ]
    }
  }
}
Responses200
Headers
Content-Type: application/json
Body
{
  "import_sn": "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6",
  "url": "https://s3.amazonaws.com/..."
}
Schema
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "匯入名單連結",
      "examples": [
        "https://s3.amazonaws.com/..."
      ]
    },
    "import_sn": {
      "type": "string",
      "description": "匯入代碼",
      "examples": [
        "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6"
      ]
    }
  }
}

匯入名單檔案 - 取得檔案上傳連結
POST/v1/contacts/imports/file

寄送名單限制

免費會員提供 50 封/天 的限制,付費會員則無限制

功能說明:

取得檔案上傳的連結,用來上傳名單檔案 ( 建議筆數 > 100 )

  • 因匯入大量名單需要一段處理時間,故採非同步方式回傳匯入狀態

  • 匯入結束後,系統將以POST的方式,將匯入狀態回傳至webhookUrl

  • 若無提供 webhookUrl, 亦可利用 查詢匯入狀態 API 取得匯入狀態

重要!!! 欲完成匯入名單,必須依序完成下面步驟

檔案匯入流程:
  1. 呼叫此 API 取得上傳檔案的 url

  2. 使用 PUT method 將檔案以二進位的格式,上傳至 步驟1. 所得到的 url

  3. 檔案上傳成功後,即開始進行匯入動作 (若已存在相同EMAIL,則更新資料 ; 反之若不存在,則新增資料)

匯入檔案格式 (.csv) 說明
  • 純文字格式且不同欄位以逗號 (,) 分隔,建議 utf-8 編碼

  • 第一行請放置欄位名稱,順序為【EMAIL,NAME,欄位名稱1,欄位名稱2,欄位名稱3…】以此類推。

  • 第二行開始請放置各欄位名稱的對應值。前兩欄位 EMAILNAME必要欄位


匯入名單檔案 - 取得檔案上傳連結 (指定群組)

POST https://api.newsleopard.com/v1/contacts/imports/list_sn/file
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "webhookUrl": "https://yours.webhook.com.tw"
}
Schema
{
  "type": "object",
  "properties": {
    "webhookUrl": {
      "type": "string",
      "description": "webhook 連結",
      "examples": [
        "https://yours.webhook.com.tw"
      ]
    }
  }
}
Responses200500
Headers
Content-Type: application/json
Body
{
  "import_sn": "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6",
  "url": "https://s3.amazonaws.com/..."
}
Schema
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "匯入名單連結",
      "examples": [
        "https://s3.amazonaws.com/..."
      ]
    },
    "import_sn": {
      "type": "string",
      "description": "匯入代碼",
      "examples": [
        "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6"
      ]
    }
  }
}
This response has no content.

匯入名單檔案 - 取得檔案上傳連結 (指定群組)
POST/v1/contacts/imports/{list_sn}/file

功能說明:

取得檔案上傳的連結,用來上傳名單檔案 ( 建議筆數 > 100 )

  • 因匯入大量名單需要一段處理時間,故採非同步方式回傳匯入狀態

  • 匯入結束後,系統將以POST的方式,將匯入狀態回傳至webhookUrl

  • 若無提供 webhookUrl, 亦可利用查詢匯入狀態 API 取得匯入狀態

群組代碼取得方式:

群組代碼可以參考 群組查詢 API

重要!!! 欲完成匯入名單,必須依序完成下面步驟

檔案匯入流程:
  1. 呼叫此 API 取得上傳檔案的 url

  2. 使用 PUT method 將檔案以二進位的格式,上傳至 步驟1. 所得到的 url

  3. 檔案上傳成功後,即開始進行匯入動作 (若已存在相同EMAIL,則更新資料 ; 反之若不存在,則新增資料)

匯入檔案格式 (.csv) 說明
  • 純文字格式且不同欄位以逗號 (,) 分隔,建議 utf-8 編碼

  • 第一行請放置欄位名稱,順序為【EMAIL,NAME,欄位名稱1,欄位名稱2,欄位名稱3…】以此類推。

  • 第二行開始請放置各欄位名稱的對應值。前兩欄位 EMAILNAME必要欄位

URI Parameters
HideShow
list_sn
string (required) 

群組代碼


匯入名單

POST https://api.newsleopard.com/v1/contacts/imports/text
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "contacts": "EMAIL,NAME\nuser1@newsleopard.com,會員1\nuser2@newsleopard.com,會員2"
}
Schema
{
  "type": "object",
  "properties": {
    "contacts": {
      "type": "string",
      "description": "匯入名單內容",
      "examples": [
        "EMAIL,NAME\nuser1@newsleopard.com,會員1\nuser2@newsleopard.com,會員2"
      ]
    }
  }
}
Responses200
Headers
Content-Type: application/json
Body
{
  "import_sn": "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6"
}
Schema
{
  "type": "object",
  "properties": {
    "import_sn": {
      "type": "string",
      "description": "匯入代碼",
      "examples": [
        "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6"
      ]
    }
  }
}

匯入名單
POST/v1/contacts/imports/text

功能說明:

匯入名單 ( payload 大小不得超過 10 mb,若要上傳大量名單資料,建議使用匯入名單檔案 API )

匯入流程:
  1. 呼叫此 API,並帶入名單內容 (參閱下面的contacts 內容說明)

  2. 開始進行匯入動作 (若已存在相同EMAIL,則更新資料 ; 反之若不存在,則新增資料)

contacts 內容說明:
  1. 第一行請放置欄位名稱,順序為【EMAIL,NAME,欄位名稱1,欄位名稱2,欄位名稱3…】以此類推

  2. 第二行開始請放置各欄位名稱的對應值。前兩欄位 EMAIL 及 NAME 為 必要欄位

  3. 使用 \n 當作換行符號


匯入名單 (指定群組)

POST https://api.newsleopard.com/v1/contacts/imports/list_sn/text
Requestsexample 1example 2
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "contacts": "EMAIL,NAME\nuser1@newsleopard.com,會員1\nuser2@newsleopard.com,會員2"
}
Schema
{
  "type": "object",
  "properties": {
    "contacts": {
      "type": "string",
      "description": "匯入名單內容",
      "examples": [
        "EMAIL,NAME\nuser1@newsleopard.com,會員1\nuser2@newsleopard.com,會員2"
      ]
    }
  }
}
Responses200
Headers
Content-Type: application/json
Body
{
  "import_sn": "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6"
}
Schema
{
  "type": "object",
  "properties": {
    "import_sn": {
      "type": "string",
      "description": "匯入代碼",
      "examples": [
        "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6"
      ]
    }
  }
}
Headers
Content-Type: application/json
x-api-key: 金鑰內容
Body
{
  "contacts": "EMAIL,NAME\nuser1@newsleopard.com,會員1\nuser2@newsleopard.com,會員2"
}
Schema
{
  "type": "object",
  "properties": {
    "contacts": {
      "type": "string",
      "description": "匯入名單內容",
      "examples": [
        "EMAIL,NAME\nuser1@newsleopard.com,會員1\nuser2@newsleopard.com,會員2"
      ]
    }
  }
}
Responses500
This response has no content.

匯入名單 (指定群組)
POST/v1/contacts/imports/{list_sn}/text

功能說明:

匯入名單 ( payload 大小不得超過 10 mb,若要上傳大量名單資料,建議使用匯入名單檔案 API )

群組代碼取得方式:

群組代碼可以參考 群組查詢 API

匯入流程:
  1. 呼叫此 API,並帶入名單內容 (參閱下面的contacts 內容說明)

  2. 開始進行匯入動作 (若已存在相同EMAIL,則更新資料 ; 反之若不存在,則新增資料)

contacts 內容說明:
  1. 第一行請放置欄位名稱,順序為【EMAIL,NAME,欄位名稱1,欄位名稱2,欄位名稱3…】以此類推

  2. 第二行開始請放置各欄位名稱的對應值。前兩欄位 EMAIL 及 NAME 為 必要欄位

  3. 使用 \n 當作換行符號

URI Parameters
HideShow
list_sn
string (required) 

群組代碼


查詢匯入狀態

GET https://api.newsleopard.com/v1/contacts/imports/result/import_sn
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Responses200400
Headers
Content-Type: application/json
Body
{
  "import_sn": "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6",
  "status": "PROCESSING",
  "fileCnt": 100,
  "insertCnt": 85,
  "duplicateCnt": 5,
  "errCnt": 10,
  "createDate": "2019-03-05T08:19:26Z",
  "completedDate": "2019-03-05T08:19:26Z",
  "errorDownloadLink": "https://s3.amazonaws.com/prod-member-upload/import/xxx/error-file.csv"
}
Schema
{
  "type": "object",
  "properties": {
    "import_sn": {
      "type": "string",
      "description": "匯入代碼",
      "examples": [
        "45093ba5-4bb5-47b2-a2c7-40ae4ff646b6"
      ]
    },
    "status": {
      "type": "string",
      "description": "匯入狀態",
      "enum": [
        "處理中 = PROCESSING",
        "匯入完成 = COMPLETE",
        "標頭重複 = DUPLICATE_HEADER",
        "匯入失敗 = ERROR",
        "缺少需要的檔案 = MISSING_REQUIRED_DATA"
      ],
      "examples": [
        "COMPLETE"
      ]
    },
    "fileCnt": {
      "type": "integer",
      "description": "檔案筆數",
      "examples": [
        100
      ]
    },
    "insertCnt": {
      "type": "integer",
      "description": "新增筆數",
      "examples": [
        85
      ]
    },
    "duplicateCnt": {
      "type": "integer",
      "description": "重複筆數",
      "examples": [
        5
      ]
    },
    "errCnt": {
      "type": "integer",
      "description": "錯誤筆數",
      "examples": [
        10
      ]
    },
    "createDate": {
      "type": "string",
      "description": "建立時間",
      "examples": [
        "2019-03-05T08:19:26Z"
      ]
    },
    "completedDate": {
      "type": "string",
      "description": "完成時間",
      "examples": [
        "2019-03-05T08:19:26Z"
      ]
    },
    "errorDownloadLink": {
      "type": "string",
      "description": "錯誤名單下載連結",
      "examples": [
        "https://s3.amazonaws.com/prod-member-upload/import/xxx/error-file.csv"
      ]
    }
  }
}
This response has no content.

查詢匯入狀態
GET/v1/contacts/imports/result/{import_sn}

功能說明:

以匯入代碼來查詢匯入狀態 (開放查詢近30天之匯入狀態)

狀態值:

  • 處理中 = PROCESSING

  • 匯入完成 = COMPLETE

  • 重複標頭 = DUPLICATE_HEADER

  • 匯入失敗 = ERROR

  • 缺少需要的檔案 = MISSING_REQUIRED_DATA

URI Parameters
HideShow
import_sn
string (required) 

匯入代碼 (由名單匯入 API 取得)


新增群組

POST https://api.newsleopard.com/v1/contacts/lists/insert
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "name": "VIP會員名單"
}
Schema
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "群組名稱",
      "examples": [
        "VIP會員名單"
      ]
    }
  },
  "required": [
    "name"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "sn": "群組代碼"
}
Schema
{
  "type": "object",
  "properties": {
    "sn": {
      "type": "string",
      "description": "群組代碼",
      "examples": [
        "群組代碼"
      ]
    }
  }
}

新增群組
POST/v1/contacts/lists/insert

功能說明:

傳入欲新增的群組名稱,成功新增後會得到群組的代碼。 可以將群組代碼做為匯入名單至特定群組使用。


查詢群組

GET https://api.newsleopard.com/v1/contacts/lists?size=&page=
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Responses200
Headers
Content-Type: application/json
Body
{
  "Lists": [
    {
      "clickedRate": 0,
      "createDate": "2019-04-12T05:45:18Z",
      "excludeCnt": 5,
      "name": "2019-04-01T08:38:32.569Z",
      "openedRate": 66.6667,
      "sn": "40280a3c6a0cb8c5016a10142a230002",
      "status": "GENERAL",
      "subscribedCnt": "4963",
      "type": 0,
      "updateDate": "2019-04-12T05:45:18Z"
    }
  ]
}
Schema
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "sn": {
        "type": "string",
        "description": "群組代碼"
      },
      "name": {
        "type": "string",
        "description": "群組名稱"
      },
      "type": {
        "type": "number",
        "description": "群組類型"
      },
      "status": {
        "type": "string",
        "description": "狀態"
      },
      "subscribedCnt": {
        "type": "number",
        "description": "有效會員數"
      },
      "excludeCnt": {
        "type": "number",
        "description": "無效會員數"
      },
      "openedRate": {
        "type": "number",
        "description": "開信率"
      },
      "clickedRate": {
        "type": "number",
        "description": "點擊率"
      },
      "createDate": {
        "type": "string",
        "description": "建立時間",
        "format": "date-time"
      },
      "updateDate": {
        "type": "string",
        "description": "更新時間",
        "format": "date-time"
      }
    }
  },
  "examples": [
    [
      {
        "clickedRate": 0,
        "createDate": "2019-04-12T05:45:18Z",
        "excludeCnt": 2,
        "name": "0412",
        "openedRate": 0,
        "segVersion": -1,
        "sn": "40280a3c6a0cb8c5016a10142a230002",
        "status": "GENERAL",
        "subscribedCnt": 4963,
        "type": 0,
        "updateDate": "2019-04-12T05:45:18Z"
      },
      {
        "clickedRate": 0,
        "createDate": "2019-03-05T08:19:26Z",
        "excludeCnt": 0,
        "name": "0305",
        "openedRate": 0,
        "segVersion": -1,
        "sn": "4028d2596923c2fe01694cef9f540000",
        "status": "GENERAL",
        "subscribedCnt": 5,
        "type": 0,
        "updateDate": "2019-03-05T08:19:26Z"
      },
      {
        "clickedRate": 0,
        "createDate": "2019-02-22T10:13:28Z",
        "excludeCnt": 1,
        "name": "測試用",
        "openedRate": 66.6667,
        "segVersion": -1,
        "sn": "40283c54690f9e63016914b2104d0001",
        "status": "GENERAL",
        "subscribedCnt": 3,
        "type": 0,
        "updateDate": "2019-02-22T10:13:28Z"
      }
    ]
  ]
}

查詢群組
GET/v1/contacts/lists{?size,page}

功能說明:

列出群組資料

URI Parameters
HideShow
size
string (optional) 

一頁要呈現的資料筆數

page
string (optional) 

頁數的index,從0開始 (ex. page=0 表示第一頁、page=1 表示第二頁)


寄信 - Campaign

寄信相關 API

建立活動並且寄信

POST https://api.newsleopard.com/v1/campaign/normal/submit
Requestsexample 1
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "form": {
    "name": "活動名稱",
    "selectedLists": [
      "40280a3c6a0cb8c5016a10142a230001",
      "40280a3c6a0cb8c5016a10142a230003"
    ],
    "excludeLists": [
      "Hello, world!"
    ]
  },
  "config": {
    "schedule": {
      "type": 0,
      "timezone": 21,
      "scheduleDate": "2019-07-05T06:00:28.000Z"
    },
    "ga": {
      "enable": "true",
      "ecommerceEnable": "false",
      "utmCampaign": "spring_sale",
      "utmContent": "logolink"
    }
  },
  "content": {
    "subject": "信件主旨",
    "fromName": "寄件人名稱",
    "fromAddress": "service@newsleopard.com",
    "htmlContent": "<!DOCTYPE html><html><head></head><body><p>Hello ${NAME},</p><p>信件內容</p></body></html>",
    "footerLang": 1
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "form": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "活動名稱"
        },
        "selectedLists": {
          "type": "array",
          "description": "欲寄送的群組列表 [1組以上]"
        },
        "excludeLists": {
          "type": "array",
          "description": "排除寄送的群組列表"
        }
      },
      "required": [
        "name",
        "selectedLists",
        "excludeLists"
      ]
    },
    "config": {
      "type": "object",
      "properties": {
        "schedule": {
          "type": "object",
          "properties": {
            "type": {
              "type": "number",
              "description": "寄送類型"
            },
            "timezone": {
              "type": "number",
              "description": "時區代碼"
            },
            "scheduleDate": {
              "type": "string",
              "description": "排程寄送時間 UTC+0"
            }
          },
          "required": [
            "type",
            "timezone",
            "scheduleDate"
          ]
        },
        "ga": {
          "type": "object",
          "properties": {
            "enable": {
              "type": "string",
              "description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
            },
            "ecommerceEnable": {
              "type": "string",
              "description": "開啟 GA 電子商務分析"
            },
            "utmCampaign": {
              "type": "string",
              "description": "utmCampaign內容"
            },
            "utmContent": {
              "type": "string",
              "description": "utmContent內容"
            }
          },
          "required": [
            "enable",
            "ecommerceEnable"
          ]
        }
      },
      "required": [
        "schedule",
        "ga"
      ]
    },
    "content": {
      "type": "object",
      "properties": {
        "subject": {
          "type": "string",
          "description": "信件主旨"
        },
        "fromName": {
          "type": "string",
          "description": "寄件人名稱"
        },
        "fromAddress": {
          "type": "string",
          "description": "寄件人地址"
        },
        "htmlContent": {
          "type": "string",
          "description": "信件內容"
        },
        "footerLang": {
          "type": "number",
          "description": "頁尾語言 0 = 英文, 1 = 中文"
        }
      },
      "required": [
        "subject",
        "fromName",
        "fromAddress",
        "htmlContent",
        "footerLang"
      ]
    }
  },
  "required": [
    "form",
    "config",
    "content"
  ]
}
Responses200400
Headers
Content-Type: application/json
Body
{
  "sn": "活動代碼"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "sn": {
      "type": "string",
      "description": "活動代碼"
    }
  },
  "required": [
    "sn"
  ]
}
錯誤代碼 說明
40001 欄位錯誤
40003 無效的 EMAIL
40004 不允許的 DOMAIN
40007 無效的 SN
40008 不支援的檔案格式
40009 檔案內容為空
40010 檔案大小超過限制
40011 未驗證寄件人地址
40012 餘額不足
40013 沒有可寄送的名單
40014 無效的活動內容
40015 無效的傳送資訊
40017 餘額不足無法測試
40019 錯誤的排程時間
40020 無效的日期格式
  • code: 40001 欄位相關錯誤訊息

    • 範例:
      "invalidFields": {
      "content.subjectA": [
          "InvalidTestingOnFields"
      ],
      "form.name": [
          "NotEmpty",
          "NotNull"
      ],
      "content": [
          "InvalidTestingOnFields"
      ]}
    • content 內有無效的欄位
    • content.subjectA: 不符合傳入值規定 (缺少or為空值)
    • form.name: 不符合傳入值規定 (缺少or為空值)
  • code: 40012 餘額不足

    • 回傳結構說明:
      {
        "code": 40012
        "recipients": 預計寄出封數
        "remaining": 剩餘可寄封數
      }
Headers
Content-Type: application/json
Body
{
  "code": "40001",
  "invalidFields": "欄位相關錯誤訊息"
}
Schema
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "錯誤代碼",
      "examples": [
        "40001"
      ]
    },
    "invalidFields": {
      "type": "string",
      "description": "訊息",
      "examples": [
        "欄位相關錯誤訊息"
      ]
    }
  }
}

建立活動並且寄信
POST/v1/campaign/normal/submit

建立活動並且寄信

payload 結構主要分成三大部分:

  1. form
  2. content
  3. config

以下針對不同部分需要帶入的資料做說明:

  1. form
    • name: 活動名稱
    • selectedLists: 欲寄送的群組列表,1組以上
    • excludeLists: 排除寄送的群組列表
    • 群組代碼可以參考 群組查詢 API
  2. content
    • subject: 主旨
    • fromName: 寄件人名稱
    • fromAddress: 寄件人地址 需使用電子豹後台通過寄件人驗證
    • htmlContent: 信件內容
    • footerLang: 頁尾語言 (0 = 英文, 1 = 中文)
  3. config
    • schedule:
      • type: 參考 config.schedule.type
      • timezone: 參考 config.schedule.timezone
      • scheduleDate: 排程寄送時間
        • 格式範例: 2019-04-01T08:38:32.00Z
        • 若為立即寄送,直接帶入現在日期時間
        • 備註: 請確認日期時間為 UTC+0
    • ga:
      • enable: true / false (若為 true,utmCampaign與utmContent 需帶入值)
      • utmCampaign: utm-campaign 內容
      • utmContent: utm-content 內容

建立A/B Testing 活動並且寄信

POST https://api.newsleopard.com/v1/campaign/testing/submit
Requests使用主旨進行 A/B Testing使用寄件人進行 A/B Testing使用內容進行 A/B Testing
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "form": {
    "name": "活動名稱",
    "selectedLists": [
      "40280a3c6a0cb8c5016a10142a230001",
      "40280a3c6a0cb8c5016a10142a230003"
    ],
    "excludeLists": [
      "Hello, world!"
    ]
  },
  "config": {
    "schedule": {
      "type": 0,
      "timezone": 21,
      "scheduleDate": "2019-07-05T06:00:28.000Z"
    },
    "ga": {
      "enable": "true",
      "ecommerceEnable": "false",
      "utmCampaign": "spring_sale",
      "utmContent": "logolink"
    }
  },
  "content": {
    "subjectA": "信件主旨A",
    "subjectB": "信件主旨B",
    "fromName": "寄件人名稱",
    "fromAddress": "service@newsleopard.com",
    "htmlContent": "<!DOCTYPE html><html><head></head><body><p>Hello ${NAME},</p><p>信件內容</p></body></html>",
    "footerLang": 1,
    "testingOn": 1,
    "testing": {
      "proportion": 10,
      "time": 1,
      "unit": 0
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "form": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "活動名稱"
        },
        "selectedLists": {
          "type": "array",
          "description": "欲寄送的群組列表 [1組以上]"
        },
        "excludeLists": {
          "type": "array",
          "description": "排除寄送的群組列表"
        }
      },
      "required": [
        "name",
        "selectedLists",
        "excludeLists"
      ]
    },
    "config": {
      "type": "object",
      "properties": {
        "schedule": {
          "type": "object",
          "properties": {
            "type": {
              "type": "number",
              "description": "寄送類型"
            },
            "timezone": {
              "type": "number",
              "description": "時區代碼"
            },
            "scheduleDate": {
              "type": "string",
              "description": "排程寄送時間 UTC+0"
            }
          },
          "required": [
            "type",
            "timezone",
            "scheduleDate"
          ]
        },
        "ga": {
          "type": "object",
          "properties": {
            "enable": {
              "type": "string",
              "description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
            },
            "ecommerceEnable": {
              "type": "string",
              "description": "開啟 GA 電子商務分析"
            },
            "utmCampaign": {
              "type": "string",
              "description": "utmCampaign內容"
            },
            "utmContent": {
              "type": "string",
              "description": "utmContent內容"
            }
          },
          "required": [
            "enable",
            "ecommerceEnable"
          ]
        }
      },
      "required": [
        "schedule",
        "ga"
      ]
    },
    "content": {
      "type": "object",
      "properties": {
        "subjectA": {
          "type": "string",
          "description": "信件主旨A - 當 testingOn = 1 [required]"
        },
        "subjectB": {
          "type": "string",
          "description": "信件主旨B - 當 testingOn = 1 [required]"
        },
        "fromName": {
          "type": "string",
          "description": "寄件人名稱"
        },
        "fromAddress": {
          "type": "string",
          "description": "寄件人地址"
        },
        "htmlContent": {
          "type": "string",
          "description": "信件內容"
        },
        "footerLang": {
          "type": "number",
          "description": "頁尾語言 0 = 英文, 1 = 中文"
        },
        "testingOn": {
          "type": "number",
          "description": "測試類型"
        },
        "testing": {
          "type": "object",
          "properties": {
            "proportion": {
              "type": "number",
              "description": "測試會員比例 - 範圍: 0 ~ 100"
            },
            "time": {
              "type": "number",
              "description": "時間"
            },
            "unit": {
              "type": "number",
              "description": "單位小時 = 0, 天 = 1"
            }
          },
          "required": [
            "proportion",
            "time",
            "unit"
          ]
        }
      },
      "required": [
        "subjectA",
        "subjectB",
        "fromName",
        "fromAddress",
        "htmlContent",
        "footerLang",
        "testingOn"
      ]
    }
  },
  "required": [
    "form",
    "config",
    "content"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "sn": "活動代碼"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "sn": {
      "type": "string",
      "description": "活動代碼"
    }
  },
  "required": [
    "sn"
  ]
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "form": {
    "name": "活動名稱",
    "selectedLists": [
      "40280a3c6a0cb8c5016a10142a230001",
      "40280a3c6a0cb8c5016a10142a230003"
    ],
    "excludeLists": [
      "Hello, world!"
    ]
  },
  "config": {
    "schedule": {
      "type": 0,
      "timezone": 21,
      "scheduleDate": "2019-07-05T06:00:28.000Z"
    },
    "ga": {
      "enable": "true",
      "ecommerceEnable": "false",
      "utmCampaign": "spring_sale",
      "utmContent": "logolink"
    }
  },
  "content": {
    "subject": "信件主旨",
    "fromNameA": "寄件人名稱A",
    "fromNameB": "寄件人名稱B",
    "fromAddressA": "serviceA@newsleopard.com",
    "fromAddressB": "serviceB@newsleopard.com",
    "htmlContent": "<!DOCTYPE html><html><head></head><body><p>Hello ${NAME},</p><p>信件內容</p></body></html>",
    "footerLang": 1,
    "testingOn": 2,
    "testing": {
      "proportion": 10,
      "time": 1,
      "unit": 0
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "form": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "活動名稱"
        },
        "selectedLists": {
          "type": "array",
          "description": "欲寄送的群組列表 [1組以上]"
        },
        "excludeLists": {
          "type": "array",
          "description": "排除寄送的群組列表"
        }
      },
      "required": [
        "name",
        "selectedLists",
        "excludeLists"
      ]
    },
    "config": {
      "type": "object",
      "properties": {
        "schedule": {
          "type": "object",
          "properties": {
            "type": {
              "type": "number",
              "description": "寄送類型"
            },
            "timezone": {
              "type": "number",
              "description": "時區代碼"
            },
            "scheduleDate": {
              "type": "string",
              "description": "排程寄送時間 UTC+0"
            }
          },
          "required": [
            "type",
            "timezone",
            "scheduleDate"
          ]
        },
        "ga": {
          "type": "object",
          "properties": {
            "enable": {
              "type": "string",
              "description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
            },
            "ecommerceEnable": {
              "type": "string",
              "description": "開啟 GA 電子商務分析"
            },
            "utmCampaign": {
              "type": "string",
              "description": "utmCampaign內容"
            },
            "utmContent": {
              "type": "string",
              "description": "utmContent內容"
            }
          },
          "required": [
            "enable",
            "ecommerceEnable"
          ]
        }
      },
      "required": [
        "schedule",
        "ga"
      ]
    },
    "content": {
      "type": "object",
      "properties": {
        "subject": {
          "type": "string",
          "description": "信件主旨"
        },
        "fromNameA": {
          "type": "string",
          "description": "寄件人名稱A - 當 testingOn = 2 [required]"
        },
        "fromNameB": {
          "type": "string",
          "description": "寄件人名稱B - 當 testingOn = 2 [required]"
        },
        "fromAddressA": {
          "type": "string",
          "description": "寄件人地址A - 當 testingOn = 2 [required]"
        },
        "fromAddressB": {
          "type": "string",
          "description": "寄件人地址B - 當 testingOn = 2 [required]"
        },
        "htmlContent": {
          "type": "string",
          "description": "信件內容"
        },
        "footerLang": {
          "type": "number",
          "description": "頁尾語言 0 = 英文, 1 = 中文"
        },
        "testingOn": {
          "type": "number",
          "description": "測試類型"
        },
        "testing": {
          "type": "object",
          "properties": {
            "proportion": {
              "type": "number",
              "description": "測試會員比例 - 範圍: 0 ~ 100"
            },
            "time": {
              "type": "number",
              "description": "時間"
            },
            "unit": {
              "type": "number",
              "description": "單位小時 = 0, 天 = 1"
            }
          },
          "required": [
            "proportion",
            "time",
            "unit"
          ]
        }
      },
      "required": [
        "subject",
        "fromNameA",
        "fromNameB",
        "fromAddressA",
        "fromAddressB",
        "htmlContent",
        "footerLang",
        "testingOn"
      ]
    }
  },
  "required": [
    "form",
    "config",
    "content"
  ]
}
Responses200
Headers
Content-Type: application/json
Body
{
  "sn": "活動代碼"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "sn": {
      "type": "string",
      "description": "活動代碼"
    }
  },
  "required": [
    "sn"
  ]
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
  "form": {
    "name": "活動名稱",
    "selectedLists": [
      "40280a3c6a0cb8c5016a10142a230001",
      "40280a3c6a0cb8c5016a10142a230003"
    ],
    "excludeLists": [
      "Hello, world!"
    ]
  },
  "config": {
    "schedule": {
      "type": 0,
      "timezone": 21,
      "scheduleDate": "2019-07-05T06:00:28.000Z"
    },
    "ga": {
      "enable": "true",
      "ecommerceEnable": "false",
      "utmCampaign": "spring_sale",
      "utmContent": "logolink"
    },
    "content": {
      "subject": "信件主旨",
      "fromName": "寄件人名稱",
      "fromAddress": "service@newsleopard.com",
      "htmlContentA": "<!DOCTYPE html><html><head></head><body><p>Hello ${NAME},</p><p>信件內容A</p></body></html>",
      "htmlContentB": "<!DOCTYPE html><html><head></head><body><p>Hello ${NAME},</p><p>信件內容B</p></body></html>",
      "footerLang": 1,
      "testingOn": 3,
      "testing": {
        "proportion": 10,
        "time": 1,
        "unit": 0
      }
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "form": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "活動名稱"
        },
        "selectedLists": {
          "type": "array",
          "description": "欲寄送的群組列表 [1組以上]"
        },
        "excludeLists": {
          "type": "array",
          "description": "排除寄送的群組列表"
        }
      },
      "required": [
        "name",
        "selectedLists",
        "excludeLists"
      ]
    },
    "config": {
      "type": "object",
      "properties": {
        "schedule": {
          "type": "object",
          "properties": {
            "type": {
              "type": "number",
              "description": "寄送類型"
            },
            "timezone": {
              "type": "number",
              "description": "時區代碼"
            },
            "scheduleDate": {
              "type": "string",
              "description": "排程寄送時間 UTC+0"
            }
          },
          "required": [
            "type",
            "timezone",
            "scheduleDate"
          ]
        },
        "ga": {
          "type": "object",
          "properties": {
            "enable": {
              "type": "string",
              "description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
            },
            "ecommerceEnable": {
              "type": "string",
              "description": "開啟 GA 電子商務分析"
            },
            "utmCampaign": {
              "type": "string",
              "description": "utmCampaign內容"
            },
            "utmContent": {
              "type": "string",
              "description": "utmContent內容"
            }
          },
          "required": [
            "enable",
            "ecommerceEnable"
          ]
        },
        "content": {
          "type": "object",
          "properties": {
            "subject": {
              "type": "string",
              "description": "信件主旨"
            },
            "fromName": {
              "type": "string",
              "description": "寄件人名稱"
            },
            "fromAddress": {
              "type": "string",
              "description": "寄件人地址"
            },
            "htmlContentA": {
              "type": "string",
              "description": "信件內容A"
            },
            "htmlContentB": {
              "type": "string",
              "description": "信件內容B"
            },
            "footerLang": {
              "type": "number",
              "description": "頁尾語言 0 = 英文, 1 = 中文"
            },
            "testingOn": {
              "type": "number",
              "description": "測試類型"
            },
            "testing": {
              "type": "object",
              "properties": {
                "proportion": {
                  "type": "number",
                  "description": "測試會員比例 - 範圍: 0 ~ 100"
                },
                "time": {
                  "type": "number",
                  "description": "時間"
                },
                "unit": {
                  "type": "number",
                  "description": "單位小時 = 0, 天 = 1"
                }
              },
              "required": [
                "proportion",
                "time",
                "unit"
              ]
            }
          },
          "required": [
            "subject",
            "fromName",
            "fromAddress",
            "htmlContentA",
            "htmlContentB",
            "footerLang",
            "testingOn"
          ]
        }
      },
      "required": [
        "schedule",
        "ga",
        "content"
      ]
    }
  },
  "required": [
    "form",
    "config"
  ]
}
Responses200400
Headers
Content-Type: application/json
Body
{
  "sn": "活動代碼"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "sn": {
      "type": "string",
      "description": "活動代碼"
    }
  },
  "required": [
    "sn"
  ]
}
錯誤代碼 說明
40001 欄位錯誤
40003 無效的 EMAIL
40004 不允許的 DOMAIN
40007 無效的 SN
40008 不支援的檔案格式
40009 檔案內容為空
40010 檔案大小超過限制
40011 未驗證寄件人地址
40012 餘額不足
40013 沒有可寄送的名單
40014 無效的活動內容
40015 無效的傳送資訊
40017 餘額不足無法測試
40019 錯誤的排程時間
40020 無效的日期格式
  • code: 40001 欄位相關錯誤訊息

    • 範例:
      "invalidFields": {
      "content.subjectA": [
          "InvalidTestingOnFields"
      ],
      "form.name": [
          "NotEmpty",
          "NotNull"
      ],
      "content": [
          "InvalidTestingOnFields"
      ]}
    • content 內有無效的欄位
    • content.subjectA: 不符合傳入值規定 (缺少or為空值)
    • form.name: 不符合傳入值規定 (缺少or為空值)
  • code: 40012 餘額不足

    • 回傳結構說明:
      {
        "code": 40012
        "recipients": 預計寄出封數
        "remaining": 剩餘可寄封數
      }
Headers
Content-Type: application/json
Body
{
  "code": "40001",
  "invalidFields": "欄位相關錯誤訊息"
}
Schema
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "錯誤代碼",
      "examples": [
        "40001"
      ]
    },
    "invalidFields": {
      "type": "string",
      "description": "訊息",
      "examples": [
        "欄位相關錯誤訊息"
      ]
    }
  }
}

建立A/B Testing 活動並且寄信
POST/v1/campaign/testing/submit

建立A/B Testing 活動並且寄信

需要針對 payload 中的 content 帶入 A/B Testing 相關資料

必要欄位:

  • testingOn: 測試項目 (可參考下面的 testingOn 對照表)

    • 若 testingOn = 1, subjectA, subjectB (必要)
    • 若 testingOn = 2, fromNameA, fromNameB, fromAddressA,fromAddressB (必要)
    • 若 testingOn = 3, htmlContentA, htmlContentB (必要)
  • testing: 測試參數設定

    • proportion: 測試會員比例 (範圍 0 ~ 100)
    • time: 多久後寄出剩下的信
    • unit: 小時 = 0, 天 = 1

    EX. proportion = 50, time = 5, unit = 0,將所有信件的 50% 當作測試信,並將測試信平均分成A,B兩組寄送,在 5 個小時後,以成效最佳的方式寄送剩餘信件。

相關其餘參數可以參考 建立活動並且寄信 API