Newsleopard API 文件
API Endpoint
https://api.newsleopard.comOverview ¶
電子豹 Newleopard 推出的群發(Campaign)型 API,讓開發者可透過 API 操作的方式,自動完成與在電子豹後台一樣的操作,提供更彈性的選擇。 Newsleopard API 主要分成三個部分:
-
名單 - Contacts
-
活動 - Campaign
-
報表 - Report
各項 API 的使用說明,請參閱章節內文,有任何問題皆歡迎來信詢問。
-
Email:service@newsleopard.com
-
客服時間:週一~五 09:30-12:00 / 13:30-18:00
身份驗證
-
進行 API 連線時,必須在 request header 中帶入驗證資訊
key value x-api-key
金鑰內容 -
若沒有帶入驗證資訊,或是金鑰內容有誤,將會回傳:
{"message": "Forbidden"}
-
如何申請 API KEY?
- Step1:註冊電子豹帳號
- Step2:寄信至 service@newsleopard.com ,信件請註名
申請 Newsleopard API KEY
,並附上註冊帳號
,開通後將會回信通知
寄信流程概要
Newsleopard 提供下列兩種方式,可以讓你完成基本的群發寄信需求。
方法一
-
Step1:建立群組
-
Step2:匯入名單至指定群組
若是新群組,直接使用 匯入名單(上傳檔案) 或 匯入名單(純文字) 將名單匯入至新群組中;若是舊有群組,可視需求自行判斷是否直接匯入名單,或使用 移出群組名單 將舊有群組名單先清空,再行匯入
-
Step3:確認匯入狀態
透過上述匯入取得之匯入代碼,使用 查詢匯入狀態 確認上述匯入動作是否完畢
-
Step4:建立活動進行寄送
使用 建立活動寄信,完成上述群組的群發寄信;若寄送的過程,亦需進行A/B 測試,以提升整體成效,則可使用 建立 A/B Testing 活動寄信
適用對象:
- 需要透過 Newsleopard 管理名單寄送狀態,例如:永久退信、連續暫退、取消訂閱、抱怨等無效名單,以避免後續濫發或誤發觸法者
- 需要透過 Newsleopard 協助檢核檔案是否有重複EMAIL或格式有誤之情況,以避免後續濫發或重複寄信者
方法二
-
Step1:單次上傳名單並建立活動寄信
使用 單次上傳名單並建立活動寄信 或 單次上傳名單並建立 A/B Testing 活動寄信,直接建立活動並附上名單進行群發寄信或 A/B 測試
適用對象:
- 因特殊情境,寄送對象會有重複 EMAIL 皆需寄信之情況者
- 因規定無法將名單儲存至 Newsleopard 者
數據取得流程概要
當建立活動並寄信後,你可透過下列步驟取得活動的相關數據,包括:到達、開信、點擊、退信、抱怨、取消訂閱等,以 CSV 檔的型式提供載取。
-
Step1:取得活動代碼
使用 查詢活動代碼 取得已完成寄送的活動代碼
-
Step2:產生活動報表
使用 產出報表 產生活動報表
-
Step3:下載活動報表
使用 查詢報表連結 取得報表檔案的載點位置以下載檔案
呼叫頻率限制
Newsleopard 有針對 API 的呼叫頻率( rate limit ) 及當日呼叫總量進行限制,分別為 2 requests / 秒 和 300,000 requests / 天。
此外,針對產出報表 API,有額外限制 1 request / 10 秒 的呼叫頻率。
若超過呼叫頻率時,會得到下列回應訊息
{"message":"too many requests"}
若超過當日呼叫總量時,會得到下列回應訊息。
{"message":"Limit Exceeded"}
名單 - Contacts ¶
機制說明
-
存放機制:
Newsleopard 的存放機制,以 Email address 當作唯一識別的欄位,一個名單 (contact) 可以隸屬於多個群組 (list) 中,當群組被刪除時,名單只是從此群組移出,並不會跟著被刪除,當名單被刪除時,則包含該名單的所有群組皆會移除該名單
-
匯入機制:
- 有兩種方式可將名單匯入,一種是透過純文字的方式匯入,另一種是透過上傳檔案的方式匯入(建議筆數>100),匯入時,是用比對欄位名稱的方式,判斷是否需更新既有欄位資料或新增一欄。匯入的名單格式如下說明:
- 純文字格式且不同欄位以逗號 (,) 分隔,建議 utf-8 編碼
- 第一行請放置欄位名稱,順序為【EMAIL,NAME,自訂欄位名稱1,自訂欄位名稱2,自訂欄位名稱3…】以此類推,前兩欄 EMAIL 及 NAME 為必要欄位,固定放置在第一及第二欄,故即便沒有要匯入 NAME 的資訊,亦得保留 NAME 的欄位
- 第二行開始請放置各欄位名稱的對應值
- 名單中的自訂欄位即為該名單的變數,變數可於寄信時放入主旨或內容中,於寄出前替換每個名單的變數值,以達到個人化信件的效果。使用方式請參考:信件變數使用說明章節
- 自訂欄位分成 3 種資料型別 ( 字串、數字、日期 ),型別判定是於匯入時,依據該欄的資料內容自動判定
- 當某個欄位於第一次匯入時,自動判定為某個型別後,之後匯入的資料若非符合該型別者,則該筆資料將會被列入匯入失敗的筆數
- 若需更新欄位內容,只需再次執行匯入動作,即可覆蓋相同 EMAIL 之相同欄位名稱項下的值,請注意,不用更新的欄位,匯入時不用放置其欄位名稱,避免覆蓋其欄位內容
- 有兩種方式可將名單匯入,一種是透過純文字的方式匯入,另一種是透過上傳檔案的方式匯入(建議筆數>100),匯入時,是用比對欄位名稱的方式,判斷是否需更新既有欄位資料或新增一欄。匯入的名單格式如下說明:
-
匯入偵錯機制:
名單匯入時,系統分兩段進行檢核,第一段檢核上傳的檔案結構,不符合規則的檔案直接不予處理,失敗原因整理如下:
- 檔案格式錯誤 (第一行需放置欄位名稱)
- 檔案內有重複的欄位名稱
通過第一段檢核後,則會再進行第二段的內容檢核,不符合規則的資料會計入失敗筆數中,並提供匯入失敗檔案下載連結,失敗原因整理如下:
- EMAIL 格式不符
- 檔案內 EMAIL 重複
- 自訂欄位內容格式或型別有誤
- NAME 超出長度限制
新增群組 ¶
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"
]
}
Headers
Content-Type: application/json
Body
{
"sn": "群組代碼"
}
Schema
{
"type": "object",
"properties": {
"sn": {
"type": "string",
"description": "群組代碼",
"examples": [
"群組代碼"
]
}
}
}
新增群組POST/v1/contacts/lists/insert
用途說明
透過 Newsleopard 進行活動群發寄信前,需透過本服務建立一群組,取得其群組代碼,作為後續 匯入名單(上傳檔案) 或 匯入名單(純文字) 使用,而後續建立活動寄信時,亦以群組為單位進行群發寄送。
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
name * |
string |
群組名稱 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
sn |
string |
群組代碼 |
查詢群組 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Headers
Content-Type: application/json
Body
[
{
"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"
}
]
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
Parameters | 型別 | 說明 |
---|---|---|
size |
string |
一頁要呈現的資料筆數 |
page |
string |
頁數的index,0 表示第一頁,以此類推 |
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
sn |
string |
群組代碼 |
name |
string |
群組名稱 |
subscribedCnt |
number |
群組的有效會員數 |
excludeCnt |
number |
群組的無效會員數 |
openedRate |
number |
群組的平均開信率,以群組內有寄信紀錄的有效會員進行計算:全部開信數 / 全部到達數 |
clickedRate |
number |
群組的平均開信率,以群組內有寄信紀錄的有效會員進行計算:全部點擊數 / 全部到達數 |
status |
string |
群組狀態,用以識別當前群組是否處於名單正在匯入的情況,包括:GENERAL(正常)及PROCESSING(匯入中),匯入中的群組無法選作為寄送用 |
type |
number |
群組類型,0 表示一般群組;1 表示自動分眾群組 (尚未開放) |
createDate |
string |
建立時間 |
updateDate |
string |
更新時間 |
- size
string
(optional)一頁要呈現的資料筆數
- page
string
(optional)頁數的index,從0開始 (ex. page=0 表示第一頁、page=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"
]
}
}
}
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/{list_sn}/file
用途說明
若手上的名單筆數 > 100 時,建議可使用本服務,將名單以檔案的型式,匯入至 新增群組 取得的群組代碼 或 查詢群組 取得的舊有群組代碼中。
流程
-
Step1:呼叫此 API 取得上傳名單檔案的 url
-
Step2:檔案格式請參照:匯入機制說明章節
-
Step3:使用 PUT method 將檔案以二進位的格式,上傳至 Step1 所得到的 url
-
Step4:檔案上傳成功後,於建立活動寄信前,請確認匯入狀態是否完畢
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
list_sn * |
string |
群組代碼 |
* 必填欄位
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
webhookUrl |
string |
匯入結束後,系統將以 POST method 回傳至 webhookUrl,回傳格式如同 查詢匯入狀態 回傳值 |
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
import_sn |
string |
匯入代碼,提供後續查詢匯入狀態使用 |
url |
string |
上傳名單檔案的連結 |
備註
-
因匯入大量名單需處理一段時間,故本服務採非同步之方式回傳匯入狀態
-
若無提供 webhookUrl,亦可利用 查詢匯入狀態 取得匯入狀態
- list_sn
string
(required) Example: 40280a3c6a0cb8c5016a10142a230002群組代碼
匯入名單(純文字) ¶
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"
]
}
}
}
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/{list_sn}/text
用途說明
若手上的名單筆數 < 100 時,建議可使用本服務,將名單以純文字之方式,匯入至 新增群組 取得的群組代碼 或 查詢群組 取得的舊有群組代碼中。
流程
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
list_sn * |
string |
群組代碼 |
* 必填欄位
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
contacts * |
string |
匯入的名單內容 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
import_sn |
string |
匯入代碼,提供後續查詢匯入狀態使用 |
備註
payload 大小不得超過 10 mb
- list_sn
string
(required) Example: 40280a3c6a0cb8c5016a10142a230002群組代碼
查詢匯入狀態 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
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"
]
}
}
}
查詢匯入狀態GET/v1/contacts/imports/result/{import_sn}
用途說明
當透過 匯入名單(上傳檔案) 或 匯入名單(純文字) 將名單匯入至指定群組後,本服務提供以匯入代碼查詢目前的匯入狀態,以確認名單是否已處理完畢。
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
import_sn * |
string |
匯入代碼 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
import_sn |
string |
匯入代碼 |
status |
string |
匯入狀態,分為以下幾種: |
- PROCESSING:處理中 | ||
- COMPLETE:匯入完成 | ||
- DUPLICATE_HEADER:檔案內有重複欄位名稱,無法匯入 | ||
- ERROR:匯入失敗 | ||
- MISSING_REQUIRED_DATA:缺少匯入需要的檔案 | ||
fileCnt |
number |
檔案總筆數 |
insertCnt |
number |
成功新增或更新的筆數 |
duplicateCnt |
number |
檔案內重複的筆數,將列入匯入失敗檔案中,請參考:機制說明章節 |
errCnt |
number |
無法匯入的筆數,將列入匯入失敗檔案中,請參考:機制說明章節 |
createDate |
string |
建立時間 |
completedDate |
string |
完成時間 |
errorDownloadLink |
string |
匯入失敗檔案下載連結,提供匯入失敗的名單及其失敗原因 |
備註
僅開放查詢近 30 天之匯入狀態
- import_sn
string
(required)匯入代碼 (由
名單匯入 API
取得)
移出群組名單 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"filters": [
{
"columnName": "DOMAIN",
"operator": "EQ",
"value": "gmail.com"
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"filters": {
"type": "array"
}
}
}
Body
0 (updated_count)
Headers
Content-Type: application/json
Body
{
"code": 40050304
"message": "invalid params"
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"keys": [
"user1@newsleopard.com",
"user2@newsleopard.com"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"keys": {
"type": "array"
}
},
"required": [
"keys"
]
}
Body
0 (updated_count)
移出群組名單DELETE/v1/contacts/{list_sn}
用途說明
本服務提供透過篩選條件之方式或指定名單的方式,將名單從特定群組中移出,以整理舊有群組內的名單組成。
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
list_sn * |
string |
群組代碼 |
* 必填欄位
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
columnName |
string |
可篩選的條件,包括: ・NAME:名單的NAME ・MAIL_ADDRESS:EMAIL地址 ・DOMAIN:Email Domain ・LISTSN:群組代碼 ・自訂欄位名稱:匯入時自定義的欄位名稱 |
operator |
string |
比較運算子,包括: ・EQ:相等 ・NOT_EQ:不相等 ・LIKE: 相似 ・NOT_LIKE:不相似 |
value |
string |
篩選值 |
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
updated_count |
number |
移出群組的名單筆數 |
錯誤訊息說明
錯誤代碼 | 說明 |
---|---|
40050304 |
自訂欄位名錯誤 |
40050305 |
缺少filters or keys |
40050306 |
欄位名錯誤 |
40050307 |
比較運算子錯誤 |
40050308 |
欲移出的群組不存在 |
備註
暫未提供針對日期及數字型別自訂欄位的比較運算,使用上請留意
- list_sn
string
(required) Example: 40280a3c6a0cb8c5016a10142a230002群組代碼
活動 - Campaign ¶
信件變數使用說明
用途說明
Newsleopard 可以讓你於信件主旨或內容中放置變數,並於寄出前自動替換變數的值,以達到個人化信件的效果,變數的使用方式為 ${自訂欄位名稱},有關變數的詳細說明,請參考:機制說明。
建立活動寄信 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱",
"selectedLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230003"
],
"excludeLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230001"
]
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": "boolean",
"utmCampaign": "spring_sale",
"utmContent": "logolink"
}
},
"content": {
"preheader": "主旨預覽文字",
"subject": "信件主旨",
"fromName": "寄件人名稱",
"fromAddress": "name@example.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": "boolean",
"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": {
"preheader": {
"type": "string",
"description": "主旨預覽文字"
},
"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"
]
}
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
Body
{
"code": "40001",
"invalidFields": "欄位相關錯誤訊息"
}
Schema
{
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "錯誤代碼",
"examples": [
"40001"
]
},
"invalidFields": {
"type": "string",
"description": "訊息",
"examples": [
"欄位相關錯誤訊息"
]
}
}
}
建立活動寄信POST/v1/campaign/normal/submit
用途說明
本服務提供一般的活動群發寄信,使用前,請先確認是否已完成群組建立及名單匯入。若活動寄送時,需額外進行 A/B 測試,則可參考:建立 A/B Testing 活動寄信。
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
form.name * |
string |
活動名稱,可自定義,不會顯示於信件中 |
form.selectedLists * |
array |
寄送的群組代碼,1 組以上 |
form.excludeLists * |
array |
排除寄送的群組代碼,1 組以上,在 excludeLists 群組的名單,即便存在 selectedLists 群組中,亦不會寄出 |
content.preheader |
string |
主旨預覽文字,長度不得超過 60 字 |
content.subject * |
string |
信件主旨,長度不得超過 150 字 |
content.fromName * |
string |
寄件人名稱,長度不得超過 50 字 |
content.fromAddress * |
string |
寄件人地址,寄件人地址需通過 Newsleopard 後台進行寄件人email 驗證 |
content.htmlContent * |
string |
信件內容 |
content.footerLang * |
number |
頁尾訊息語言,0:英文;1:中文 |
config.schedule.type * |
number |
寄送類型,0:立即寄送;1:排程寄送 |
config.schedule.timezone |
number |
參照附件 時區代碼對照表 |
config.schedule.scheduleDate |
string |
排程寄送時間,格式範例: 2019-04-01T08:38:32.00Z 請確認日期時間為 UTC+0,以及不得為過去的日期時間 |
config.ga.enable * |
boolean |
是否開啟 GA 流量追蹤,若為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.ecommerceEnable * |
boolean |
是否開啟 GA 電子商務分析,若為 true,GA 追蹤需一併為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.utmCampaign |
string |
utm_campaign 內容 |
config.ga.utmContent |
string |
utm_content 內容 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
sn |
string |
活動代碼 |
錯誤訊息說明
錯誤代碼 | 說明 |
---|---|
40001 |
欄位錯誤 |
40003 |
無效的 EMAIL |
40004 |
不允許的 DOMAIN |
40007 |
無效的 SN |
40008 |
不支援的檔案格式 |
40009 |
檔案內容為空 |
40010 |
檔案大小超過限制 |
40011 |
未驗證寄件人地址 |
40012 |
餘額不足 |
40013 |
沒有可寄送的名單 |
40014 |
無效的活動內容 |
40015 |
無效的傳送資訊 |
40017 |
餘額不足無法測試 |
40019 |
錯誤的排程時間 |
40020 |
無效的日期格式 |
單次上傳名單並建立活動寄信 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱"
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": false,
"utmCampaign": "spring_sale",
"utmContent": "logolink"
}
},
"content": {
"preheader": "主旨預覽文字",
"subject": "信件主旨",
"fromName": "寄件人名稱",
"fromAddress": "name@example.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": "活動名稱"
}
},
"required": [
"name"
]
},
"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": "boolean",
"description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
},
"ecommerceEnable": {
"type": "boolean",
"description": "開啟 GA 電子商務分析"
},
"utmCampaign": {
"type": "string",
"description": "utmCampaign內容"
},
"utmContent": {
"type": "string",
"description": "utmContent內容"
}
},
"required": [
"enable",
"ecommerceEnable"
]
}
},
"required": [
"schedule",
"ga"
]
},
"content": {
"type": "object",
"properties": {
"preheader": {
"type": "string",
"description": "主旨預覽文字"
},
"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"
]
}
Headers
Content-Type: application/json
Body
{
"sn": "活動代碼",
"preSignedUrl": "檔案上傳網址"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"sn": {
"type": "string",
"description": "活動代碼"
},
"preSignedUrl": {
"type": "string",
"description": "檔案上傳網址"
}
},
"required": [
"sn",
"preSignedUrl"
]
}
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/once
用途說明
針對不想將名單儲存至電子豹 Newaleopard 平台的會員,電子豹亦提供單次上傳名單並建立活動寄信之功能,上傳後即寄信,名單不留存,後續仍可用活動代碼進行相關報表的查閱。
流程
-
Step1:建立活動 (請參照 建立活動寄信,無需提供form.selectedLists 及 form.excludeLists)
-
Step2:依據 Response 的 preSignedUrl,上傳該次的名單檔案 (上傳方式如同 匯入名單(上傳檔案))
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
form.name * |
string |
活動名稱,可自定義,不會顯示於信件中 |
content.preheader |
string |
主旨預覽文字,長度不得超過 60 字 |
content.subject * |
string |
信件主旨,長度不得超過 150 字 |
content.fromName * |
string |
寄件人名稱,長度不得超過 50 字 |
content.fromAddress * |
string |
寄件人地址,寄件人地址需通過 Newsleopard 後台進行寄件人email 驗證 |
content.htmlContent * |
string |
信件內容 |
content.footerLang * |
number |
頁尾訊息語言,0:英文;1:中文 |
config.schedule.type * |
number |
寄送類型,0:立即寄送;1:排程寄送 |
config.schedule.timezone |
number |
參照附件 時區代碼對照表 |
config.schedule.scheduleDate |
string |
排程寄送時間,格式範例: 2019-04-01T08:38:32.00Z 請確認日期時間為 UTC+0,以及不得為過去的日期時間 |
config.ga.enable * |
boolean |
是否開啟 GA 流量追蹤,若為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.ecommerceEnable * |
boolean |
是否開啟 GA 電子商務分析,若為 true,GA 追蹤需一併為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.utmCampaign |
string |
utm_campaign 內容 |
config.ga.utmContent |
string |
utm_content 內容 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
sn |
string |
活動代碼 |
preSignedUrl |
string |
上傳該次名單檔案的網址 |
錯誤訊息說明
錯誤代碼 | 說明 |
---|---|
40001 |
欄位錯誤 |
40003 |
無效的 EMAIL |
40004 |
不允許的 DOMAIN |
40007 |
無效的 SN |
40008 |
不支援的檔案格式 |
40009 |
檔案內容為空 |
40010 |
檔案大小超過限制 |
40011 |
未驗證寄件人地址 |
40014 |
無效的活動內容 |
40015 |
無效的傳送資訊 |
40019 |
錯誤的排程時間 |
40020 |
無效的日期格式 |
備註
-
單次上傳的檔案名單,系統不會檢核格式或 EMAIL 是否有重複情況,請留意
-
單次上傳的檔案名單,不會匯入至系統中
建立 A/B Testing 活動寄信 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱",
"selectedLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230003"
],
"excludeLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230001"
]
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": false,
"utmCampaign": "spring_sale",
"utmContent": "logolink"
}
},
"content": {
"preheaderA": "主旨預覽文字",
"preheaderB": "主旨預覽文字",
"subjectA": "信件主旨A",
"subjectB": "信件主旨B",
"fromName": "寄件人名稱",
"fromAddress": "name@example.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": "boolean",
"description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
},
"ecommerceEnable": {
"type": "boolean",
"description": "開啟 GA 電子商務分析"
},
"utmCampaign": {
"type": "string",
"description": "utmCampaign內容"
},
"utmContent": {
"type": "string",
"description": "utmContent內容"
}
},
"required": [
"enable",
"ecommerceEnable"
]
}
},
"required": [
"schedule",
"ga"
]
},
"content": {
"type": "object",
"properties": {
"preheaderA": {
"type": "string",
"description": "主旨預覽文字A - 當 testingOn = 1"
},
"preheaderB": {
"type": "string",
"description": "主旨預覽文字B - 當 testingOn = 1"
},
"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"
]
}
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
Body
{
"code": "40001",
"invalidFields": "欄位相關錯誤訊息"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {}
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱",
"selectedLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230003"
],
"excludeLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230001"
]
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": false,
"utmCampaign": "spring_sale",
"utmContent": "logolink"
}
},
"content": {
"preheader": "主旨預覽文字",
"subject": "信件主旨",
"fromNameA": "寄件人名稱A",
"fromNameB": "寄件人名稱B",
"fromAddressA": "nameA@example.com",
"fromAddressB": "nameB@example.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": "boolean",
"description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
},
"ecommerceEnable": {
"type": "boolean",
"description": "開啟 GA 電子商務分析"
},
"utmCampaign": {
"type": "string",
"description": "utmCampaign內容"
},
"utmContent": {
"type": "string",
"description": "utmContent內容"
}
},
"required": [
"enable",
"ecommerceEnable"
]
}
},
"required": [
"schedule",
"ga"
]
},
"content": {
"type": "object",
"properties": {
"preheader": {
"type": "string",
"description": "主旨預覽文字"
},
"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"
]
}
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
Body
{
"code": "40001",
"invalidFields": "欄位相關錯誤訊息"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {}
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱",
"selectedLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230003"
],
"excludeLists": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230001"
]
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": false,
"utmCampaign": "spring_sale",
"utmContent": "logolink"
},
"content": {
"preheader": "主旨預覽文字",
"subject": "信件主旨",
"fromName": "寄件人名稱",
"fromAddress": "name@example.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": "boolean",
"description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
},
"ecommerceEnable": {
"type": "boolean",
"description": "開啟 GA 電子商務分析"
},
"utmCampaign": {
"type": "string",
"description": "utmCampaign內容"
},
"utmContent": {
"type": "string",
"description": "utmContent內容"
}
},
"required": [
"enable",
"ecommerceEnable"
]
},
"content": {
"type": "object",
"properties": {
"preheader": {
"type": "string",
"description": "主旨預覽文字"
},
"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"
]
}
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
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
用途說明
Newsleopard 提供 主旨、寄件人、內容等三種 A/B 測試功能,可於活動寄送的同時,依據設定的測試比例,將寄送名單分成A、B兩組,分別寄送A、B兩種版本信件,並依據設定的測試時間,確認成效較佳的版本,並寄給尚未分組的剩餘名單,讓活動的整體成效進而提升。
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
form.name * |
string |
活動名稱,可自定義,不會顯示於信件中 |
form.selectedLists * |
array |
寄送的群組代碼,1 組以上 |
form.excludeLists * |
array |
排除寄送的群組代碼,1 組以上,在 excludeLists 群組的名單,即便存在 selectedLists 群組中,亦不會寄出 |
content.preheaderA |
string |
A版本主旨預覽文字,長度不得超過 60 字 |
content.preheaderB |
string |
B版本主旨預覽文字,長度不得超過 60 字 |
content.subjectA * |
string |
A版本信件主旨,長度不得超過 150 字 |
content.subjectB * |
string |
B版本信件主旨,長度不得超過 150 字 |
content.fromNameA * |
string |
A版本寄件人名稱,長度不得超過 50 字 |
content.fromNameB * |
string |
B版本寄件人名稱,長度不得超過 50 字 |
content.fromAddressA * |
string |
A版本寄件人地址,寄件人地址需通過 Newsleopard 後台進行寄件人email 驗證 |
content.fromAddressB * |
string |
B版本寄件人地址,寄件人地址需通過 Newsleopard 後台進行寄件人email 驗證 |
content.htmlContentA * |
string |
A版信件內容 |
content.htmlContentB * |
string |
B版信件內容 |
content.footerLang * |
number |
頁尾訊息語言,0:英文;1:中文 |
content.testingOn * |
number |
A/B測試類型,1:主旨A/B測試;2:寄件人名稱及地址A/B測試;3:內容A/B測試 |
content.testing.proportion * |
number |
A/B測試比例,0~100,單位為%,系統將依據設定的比例,自動抓取 selectedLists 群組名單進行A、B分組 |
content.testing.time * |
number |
A/B測試時間長度,時間到將自動判斷A/B版本的成效,並將較佳的版本寄送給尚未分組的剩餘名單 |
content.testing.unit * |
number |
A/B測試時間單位,0:小時;1:天 |
config.schedule.type * |
number |
寄送類型,0:立即寄送;1:排程寄送 |
config.schedule.timezone |
number |
參照附件 時區代碼對照表 |
config.schedule.scheduleDate |
string |
排程寄送時間,格式範例: 2019-04-01T08:38:32.00Z 請確認日期時間為 UTC+0,以及不得為過去的日期時間 |
config.ga.enable * |
boolean |
是否開啟 GA 流量追蹤,若為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.ecommerceEnable * |
boolean |
是否開啟 GA 電子商務分析,若為 true,GA 追蹤需一併為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.utmCampaign |
string |
utm_campaign 內容 |
config.ga.utmContent |
string |
utm_content 內容 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
sn |
string |
活動代碼 |
錯誤訊息說明
錯誤代碼 | 說明 |
---|---|
40001 |
欄位錯誤 |
40003 |
無效的 EMAIL |
40004 |
不允許的 DOMAIN |
40007 |
無效的 SN |
40008 |
不支援的檔案格式 |
40009 |
檔案內容為空 |
40010 |
檔案大小超過限制 |
40011 |
未驗證寄件人地址 |
40012 |
餘額不足 |
40013 |
沒有可寄送的名單 |
40014 |
無效的活動內容 |
40015 |
無效的傳送資訊 |
40017 |
餘額不足無法測試 |
40019 |
錯誤的排程時間 |
40020 |
無效的日期格式 |
單次上傳名單並建立 A/B Testing 活動寄信 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱"
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": false,
"utmCampaign": "spring_sale",
"utmContent": "logolink"
}
},
"content": {
"preheaderA": "主旨預覽文字A",
"preheaderB": "主旨預覽文字B",
"subjectA": "信件主旨A",
"subjectB": "信件主旨B",
"fromName": "寄件人名稱",
"fromAddress": "name@example.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": "活動名稱"
}
},
"required": [
"name"
]
},
"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": "boolean",
"description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
},
"ecommerceEnable": {
"type": "boolean",
"description": "開啟 GA 電子商務分析"
},
"utmCampaign": {
"type": "string",
"description": "utmCampaign內容"
},
"utmContent": {
"type": "string",
"description": "utmContent內容"
}
},
"required": [
"enable",
"ecommerceEnable"
]
}
},
"required": [
"schedule",
"ga"
]
},
"content": {
"type": "object",
"properties": {
"preheaderA": {
"type": "string",
"description": "主旨預覽文字A - 當 testingOn = 1"
},
"preheaderB": {
"type": "string",
"description": "主旨預覽文字A - 當 testingOn = 1"
},
"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"
]
}
Headers
Content-Type: application/json
Body
{
"sn": "活動代碼",
"preSignedUrl": "檔案上傳網址"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"sn": {
"type": "string",
"description": "活動代碼"
},
"preSignedUrl": {
"type": "string",
"description": "檔案上傳網址"
}
},
"required": [
"sn",
"preSignedUrl"
]
}
Headers
Content-Type: application/json
Body
{
"code": "40001",
"invalidFields": "欄位相關錯誤訊息"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {}
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱"
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": false,
"utmCampaign": "spring_sale",
"utmContent": "logolink"
}
},
"content": {
"preheader": "主旨預覽文字",
"subject": "信件主旨",
"fromNameA": "寄件人名稱A",
"fromNameB": "寄件人名稱B",
"fromAddressA": "nameA@example.com",
"fromAddressB": "nameB@example.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": "活動名稱"
}
},
"required": [
"name"
]
},
"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": "boolean",
"description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
},
"ecommerceEnable": {
"type": "boolean",
"description": "開啟 GA 電子商務分析"
},
"utmCampaign": {
"type": "string",
"description": "utmCampaign內容"
},
"utmContent": {
"type": "string",
"description": "utmContent內容"
}
},
"required": [
"enable",
"ecommerceEnable"
]
}
},
"required": [
"schedule",
"ga"
]
},
"content": {
"type": "object",
"properties": {
"preheader": {
"type": "string",
"description": "主旨預覽文字"
},
"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"
]
}
Headers
Content-Type: application/json
Body
{
"sn": "活動代碼",
"preSignedUrl": "檔案上傳網址"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"sn": {
"type": "string",
"description": "活動代碼"
},
"preSignedUrl": {
"type": "string",
"description": "檔案上傳網址"
}
},
"required": [
"sn",
"preSignedUrl"
]
}
Headers
Content-Type: application/json
Body
{
"code": "40001",
"invalidFields": "欄位相關錯誤訊息"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {}
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"form": {
"name": "活動名稱"
},
"config": {
"schedule": {
"type": 0,
"timezone": 21,
"scheduleDate": "2019-07-05T06:00:28.000Z"
},
"ga": {
"enable": true,
"ecommerceEnable": false,
"utmCampaign": "spring_sale",
"utmContent": "logolink"
},
"content": {
"preheader": "主旨預覽文字",
"subject": "信件主旨",
"fromName": "寄件人名稱",
"fromAddress": "name@example.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": "活動名稱"
}
},
"required": [
"name"
]
},
"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": "boolean",
"description": "開啟GA分析 true / false,若為 true,utmCampaign 與 utmContent 需帶入值"
},
"ecommerceEnable": {
"type": "boolean",
"description": "開啟 GA 電子商務分析"
},
"utmCampaign": {
"type": "string",
"description": "utmCampaign內容"
},
"utmContent": {
"type": "string",
"description": "utmContent內容"
}
},
"required": [
"enable",
"ecommerceEnable"
]
},
"content": {
"type": "object",
"properties": {
"preheader": {
"type": "string",
"description": "主旨預覽文字"
},
"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"
]
}
Headers
Content-Type: application/json
Body
{
"sn": "活動代碼",
"preSignedUrl": "檔案上傳網址"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"sn": {
"type": "string",
"description": "活動代碼"
},
"preSignedUrl": {
"type": "string",
"description": "檔案上傳網址"
}
},
"required": [
"sn",
"preSignedUrl"
]
}
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/once
用途說明
針對不想將名單儲存至電子豹 Newaleopard 平台的會員,電子豹亦提供單次上傳名單並建立 A/B Testing 活動寄信之功能,有關細節說明,請再另外參考 單次上傳名單並建立活動寄信 及 建立 A/B Testing 活動寄信 介紹。
流程
-
Step1:建立活動 (請參照 建立 A/B Testing 活動寄信,無需提供form.selectedLists 及 form.excludeLists)
-
Step2:依據 Response 的 preSignedUrl,上傳該次的名單檔案 (上傳方式如同 匯入名單(上傳檔案) )
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
form.name * |
string |
活動名稱,可自定義,不會顯示於信件中 |
content.preheaderA |
string |
A版本主旨預覽文字,長度不得超過 60 字 |
content.preheaderB |
string |
B版本主旨預覽文字,長度不得超過 60 字 |
content.subjectA * |
string |
A版本信件主旨,長度不得超過 150 字 |
content.subjectB * |
string |
B版本信件主旨,長度不得超過 150 字 |
content.fromNameA * |
string |
A版本寄件人名稱,長度不得超過 50 字 |
content.fromNameB * |
string |
B版本寄件人名稱,長度不得超過 50 字 |
content.fromAddressA * |
string |
A版本寄件人地址,寄件人地址需通過 Newsleopard 後台進行寄件人email 驗證 |
content.fromAddressB * |
string |
B版本寄件人地址,寄件人地址需通過 Newsleopard 後台進行寄件人email 驗證 |
content.htmlContentA * |
string |
A版信件內容 |
content.htmlContentB * |
string |
B版信件內容 |
content.footerLang * |
number |
頁尾訊息語言,0:英文;1:中文 |
content.testingOn * |
number |
A/B測試類型,1:主旨A/B測試;2:寄件人名稱及地址A/B測試;3:內容A/B測試 |
content.testing.proportion * |
number |
A/B測試比例,0~100,單位為%,系統將依據設定的比例,自動抓取該次上傳的名單進行A、B分組 |
content.testing.time * |
number |
A/B測試時間長度,時間到將自動判斷A/B版本的成效,並將較佳的版本寄送給尚未分組的剩餘名單 |
content.testing.unit * |
number |
A/B測試時間單位,0:小時;1:天 |
config.schedule.type * |
number |
寄送類型,0:立即寄送;1:排程寄送 |
config.schedule.timezone |
number |
參照附件 時區代碼對照表 |
config.schedule.scheduleDate |
string |
排程寄送時間,格式範例:2019-04-01T08:38:32.00Z 請確認日期時間為 UTC+0,以及不得為過去的日期時間 |
config.ga.enable * |
boolean |
是否開啟 GA 流量追蹤,若為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.ecommerceEnable * |
boolean |
是否開啟 GA 電子商務分析,若為 true,GA 追蹤需一併為 true,utmCampaign 與 utmContent 需帶入值 |
config.ga.utmCampaign |
string |
utm_campaign 內容 |
config.ga.utmContent |
string |
utm_content 內容 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
sn |
string |
活動代碼 |
preSignedUrl |
string |
上傳該次名單檔案的網址 |
錯誤訊息說明
錯誤代碼 | 說明 |
---|---|
40001 |
欄位錯誤 |
40003 |
無效的 EMAIL |
40004 |
不允許的 DOMAIN |
40007 |
無效的 SN |
40008 |
不支援的檔案格式 |
40009 |
檔案內容為空 |
40010 |
檔案大小超過限制 |
40011 |
未驗證寄件人地址 |
40014 |
無效的活動內容 |
40015 |
無效的傳送資訊 |
40019 |
錯誤的排程時間 |
40020 |
無效的日期格式 |
備註
-
單次上傳的檔案名單,系統不會檢核格式或 EMAIL 是否有重複情況,請留意
-
單次上傳的檔案名單,不會匯入至系統中
刪除活動 API ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Body
{
"campaignSnList": [
"40280a3c6a0cb8c5016a10142a230001",
"40280a3c6a0cb8c5016a10142a230001"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"campaignSnList": {
"type": "array",
"description": "欲刪除的活動"
}
}
}
Headers
Content-Type: application/json
Body
{
"success": [
"40280a3c6a0cb8c5016a10142a230001"
],
"sendingCampaign": [
"40280a3c6a0cb8c5016a10142a230003"
],
"badCampaigns": [
"40290a3c1a0cb8c5fdaa10142a230001"
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "array"
},
"sendingCampaign": {
"type": "array"
},
"badCampaigns": {
"type": "array"
}
}
}
刪除活動 APIDELETE/v1/campaign/normal
用途說明
本服務讓你可以透過活動代碼直接刪除已寄送、排程中或已暫停的活動。
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
campaignSnList * |
array |
欲刪除的活動代碼 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
success |
array |
成功刪除的活動代碼 |
sendingCampaign |
array |
無法刪除準備寄送或寄送中的活動代碼 |
badCampaigns |
array |
不合法的活動代碼 |
暫停活動 API ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Headers
Content-Type: application/json
Headers
Content-Type: application/json
Body
{
"code": "40001"
}
Schema
{
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "錯誤代碼",
"examples": [
"40001"
]
}
}
}
暫停活動 APIPATCH/v1/campaign/normal/{campaign_sn}
用途說明
你可以透過本服務暫停排程中的活動。
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
campaign_sn * |
string |
活動代碼 |
* 必填欄位
- campaign_sn
string
(required) Example: 40280a3c6a0cb8c5016a10142a230001活動代碼
報表 - Report ¶
查詢活動代碼 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: `Your API Key`
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}
用途說明
本服務讓你可透過活動寄信的時間區間之條件,查詢已完成寄送的活動代碼,提供後續產出報表使用。
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
startDate |
string |
開始日期,格式範例: 2019-04-01T08:38:32.00Z,請確認日期時間為 UTC+0 |
endDate |
string |
結束日期,格式範例: 2019-04-05T05:30:30.00Z,請確認日期時間為 UTC+0 |
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
sn |
string |
活動代碼 |
name |
string |
活動名稱 |
sentBeginDate |
string |
活動寄送日期 |
sentEndDate |
string |
活動寄送完成日期 |
備註
-
URI 無帶日期參數,預設回傳最近 10 筆已寄送完成的活動代碼
-
URI 有帶 startDate 及 endDate 日期參數,回傳此區間內所有已寄送完成的活動代碼
-
URI 只帶 startDate 或 endDate 日期參數,將視同無效的時間區間,預設回傳最近 10 筆已寄送完成的活動代碼
- startDate
string
(optional)開始日期
格式:2019-04-01T08:38:32.00Z
備註: 請確認日期時間為UTC+0
- endDate
string
(optional)結束日期
格式:2019-04-05T05:30:30.00Z
備註: 請確認日期時間為 `UTC+0
產出報表 ¶
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"
]
}
}
}
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
用途說明
本服務可以讓你透過 查詢活動代碼 所取得之活動代碼,產出其活動的相關報表,包括:到達、開信、點擊、退信、抱怨、取消訂閱等。
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
campaign_sn * |
string |
活動代碼 |
* 必填欄位
Request 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
webhookUrl |
string |
產出報表後,系統將以 POST method 回傳至 webhookUrl,回傳格式如同 查詢報表連結 回傳值 |
備註
-
因產出報表需處理一段時間,故本服務採非同步之方式回傳報表下載連結
-
若無提供 webhookUrl,亦可利用 查詢報表連結 取得下載連結
-
呼叫頻率為 1 request / 10 秒
-
相同活動報表的產出時間需間隔 1 hr,1 hr 內多餘的呼叫將被忽略
- campaign_sn
string
(required) Example: 40280a3c6a0cb8c5016a10142a230001活動代碼
查詢報表連結 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: 金鑰內容
Headers
Content-Type: application/json
Body
{
"Reports": [
{
"reportType": "delivery",
"link": "https://sample.domain/filename-delivery.csv",
"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
用途說明
當透過 產出報表 產出活動的報表後,本服務提供以活動代碼取得報表檔案的載點位置以下載檔案。
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
campaign_sn * |
string |
活動代碼 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
reportType |
string |
報表類型,包括: |
- 到達(delivery) | ||
- 開信(open) | ||
- 點擊(click) | ||
- 退信(bounce) | ||
- 取消訂閱(unsubscribe) | ||
- 抱怨(complain) | ||
link |
string |
報表下載網址 |
createdDate |
string |
報表產出時間 |
備註
-
若欲更新下載的資料,請先使用 產出報表,重新產出報表
-
重新產出報表時,會先檢查有沒有新的資料,有新的資料時才會產出新的報表,否則沿用原報表
- campaign_sn
string
(required) Example: 40280a3c6a0cb8c5016a10142a230001活動代碼
模版 - Template ¶
查詢全部模版內容 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: `Your API Key`
Headers
Content-Type: application/json
Body
{
"capacity": 3,
"templates": [
{
"id": "template_id",
"name": "template_name",
"template": "<html><body><div>模版內容</div></body></html>",
"updateDate": "2022-07-22T08:08:50Z"
}
]
}
Schema
{
"type": "object",
"capacity": {
"type": "number",
"description": "帳號允許建立的模版數量上限",
"examples": [
3
]
},
"templates": {
"type": "array",
"description": "模板",
"properties": {
"id": {
"type": "string",
"description": "模版",
"examples": [
"模版"
]
},
"name": {
"type": "string",
"description": "模版名稱",
"examples": [
"模版名稱"
]
},
"template": {
"type": "string",
"description": "模版 html 內容",
"examples": [
"<html><body><div>模版內容</div></body></html>"
]
},
"updateDate": {
"type": "string",
"description": "活動寄送完成時間",
"format": "date-time",
"examples": [
"2022-01-01T00:00:00.000Z"
]
}
}
}
}
查詢全部模版內容GET/v1/templates
用途說明
本服務可以讓你一次查出帳號目前已建立的全部模版資料。
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
capacity |
number |
帳號允許建立的模版數量上限 |
id |
string |
模版代碼 |
name |
string |
模版名稱 |
template |
string |
模版 html 內容 |
updateDate |
string |
模版更新時間 |
查詢特定模版內容 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: `Your API Key`
Headers
Content-Type: application/json
Body
{
"id": "template_id",
"name": "template_name",
"template": "<html><body><div>模版內容</div></body></html>",
"updateDate": "2022-07-22T08:08:50Z"
}
Schema
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "模版",
"examples": [
"模版"
]
},
"name": {
"type": "string",
"description": "模版名稱",
"examples": [
"模版名稱"
]
},
"template": {
"type": "string",
"description": "模版 html 內容",
"examples": [
"<html><body><div>模版內容</div></body></html>"
]
},
"updateDate": {
"type": "string",
"description": "活動寄送完成時間",
"format": "date-time",
"examples": [
"2022-01-01T00:00:00.000Z"
]
}
}
}
Headers
Content-Type: application/json
Body
{
"code": "40007"
}
Schema
{
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "錯誤代碼",
"examples": [
"40007"
]
}
}
}
查詢特定模版內容GET/v1/templates/{template_id}
用途說明
本服務可以讓你透過模版 ID,取得特定模版的資料。
URI Parameters
Parameters | 型別 | 說明 |
---|---|---|
template_id * |
string |
模版代碼 |
* 必填欄位
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
id |
string |
模版代碼 |
name |
string |
模版名稱 |
template |
string |
模版 html 內容 |
updateDate |
string |
模版更新時間 |
錯誤訊息說明
錯誤代碼 | 說明 |
---|---|
40007 |
無效的模版代碼 |
- template_id
string
(required) Example: id模版代碼
自動化腳本 ¶
觸發或停止自動化腳本 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: Your API Key
Body
{
"workflow": "welcome-automation",
"event": "TRIGGER",
"recipients": [
{
"name": "Alice",
"address": "alice@gmail.com",
"variables": {
"signupDate": "2019-04-01"
}
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"workflow": {
"type": "string"
},
"event": {
"type": "string"
},
"recipients": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "收件人姓名"
},
"address": {
"type": "string",
"description": "收件人email"
},
"variables": {
"type": "object",
"properties": {
"signupDate": {
"type": "string"
}
}
}
},
"required": [
"address"
]
}
}
}
}
Headers
Content-Type: application/json
Body
{
"success": [
"alice@gmail.com"
],
"failure": []
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "array",
"items": {
"type": "string"
}
},
"failure": {}
}
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: Your API Key
Body
{
"workflow": "welcome-automation",
"event": "TERMINATE",
"recipients": [
{
"name": "bob",
"address": "bob@gmail.com",
"variables": {}
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"workflow": {
"type": "string"
},
"event": {
"type": "string"
},
"recipients": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "收件人姓名"
},
"address": {
"type": "string",
"description": "收件人email"
},
"variables": {
"type": "object",
"properties": {}
}
},
"required": [
"address"
]
}
}
}
}
Headers
Content-Type: application/json
Body
{
"success": [
"bob@gmail.com"
],
"failure": {}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "array"
},
"failure": {
"type": "object",
"properties": {}
}
}
}
Headers
Content-Type: application/json
Accept: application/json
x-api-key: Your API Key
Body
{
"workflow": "welcome-automation",
"event": "TRIGGER",
"recipients": [
{
"name": "Alice",
"address": "alice@gmail.com",
"variables": {
"signupDate": "2019-04-01"
}
},
{
"name": "bob",
"address": "bob@gmail.com",
"variables": {
"gender": "man"
}
},
{
"name": "iamnotanemail",
"address": "iamnotanemail",
"variables": {}
},
{
"name": "variable_too_long",
"address": "variable_too_long@gmail.com",
"variables": {
"description": [
"i_am_the_variable_whose_length_is_over_100_characeters_Lorem",
"ipsum dolor sit amet consectetur adipisicing elit. Quis quaerat quas",
"architecto magni id minima labore illum eligendi impedit numquam debitis. Recusandae eos placeat dolorum. Aliquam obcaecati delectus adipisci molestias?"
]
}
}
]
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"workflow": {
"type": "string"
},
"event": {
"type": "string"
},
"recipients": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "收件人姓名"
},
"address": {
"type": "string",
"description": "收件人email"
},
"variables": {
"type": "object",
"properties": {
"signupDate": {
"type": "string"
}
}
}
},
"required": [
"address"
]
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "收件人姓名"
},
"address": {
"type": "string",
"description": "收件人email"
},
"variables": {
"type": "object",
"properties": {
"gender": {
"type": "string"
}
}
}
},
"required": [
"address"
]
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "收件人姓名"
},
"address": {
"type": "string",
"description": "收件人email"
},
"variables": {
"type": "object",
"properties": {}
}
},
"required": [
"address"
]
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "收件人姓名"
},
"address": {
"type": "string",
"description": "收件人email"
},
"variables": {
"type": "object",
"properties": {
"description": {
"type": "array"
}
}
}
},
"required": [
"address"
]
}
]
}
}
}
Headers
Content-Type: application/json
Body
{
"success": [
"alice@gmail.com",
"bob@gmail.com"
],
"failure": {
"iamnotanemail": "Invalid: address is not a valid email format",
"variable_too_long@gmail.com": "Invalid: the value of recipient variables should under 100 characters"
}
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
},
"failure": {
"type": "object",
"properties": {
"iamnotanemail": {
"type": "string"
},
"variable_too_long@gmail.com": {
"type": "string"
}
}
}
}
}
Headers
Content-Type: application/json
Body
{
"message": "Invalid request body",
"errors": "[ array is too long: must have at most 100 elements ]"
}
觸發或停止自動化腳本POST/v1/automation/event
用途說明
本服務提供你自行傳入單筆或多筆名單,觸發已於 Newsleopard 後台創建好的腳本,進行行銷自動化流程。或中斷已在自動化流程中的對象,為其提前結束腳本。
Request 欄位說明 * 必填欄位
欄位 | 型別 | 說明 |
---|---|---|
workflow * |
string |
自動化腳本 ID,於後台創建自動化腳本時自動產出,或者於創建時自行定義(注意:創建後即無法更改) |
event * |
string |
事件類型,可使用 TRIGGER 進行腳本觸發或使用 TERMINATE 將已在自動化流程中的特定對象提前結束 |
recipients * |
array |
收件人,最多放置 100 recipient / request |
recipients.name * |
string |
收件人姓名 |
recipients.address * |
string |
收件人Email |
recipients.variables |
object |
收件人的變數,自定義,每個 variables 內容長度最長 100,不得用數學運算式且開頭不得為數字。 |
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
success.address |
string |
收件人Email |
failure |
object |
收件人錯誤,類型如下: ・Email 格式不符:Invalid: address is not a valid email format ・收件人變數內容過長:Invalid: the value of recipient variables should under 100 characters |
帳戶相關資料 ¶
查詢現有餘額 ¶
Headers
Content-Type: application/json
Accept: application/json
x-api-key: `Your API Key`
Headers
Content-Type: application/json
Body
{
"email": "10",
"sms": "20"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string"
},
"sms": {
"type": "string"
}
}
}
查詢現有餘額GET/v1/balance
用途說明
在寄送信件或簡訊前,可先透過本支 API 查詢目前現有餘額,以避免因餘額不足而造成寄送失敗
Response 欄位說明
欄位 | 型別 | 說明 |
---|---|---|
email |
number |
目前帳號所擁有的 Email 剩餘封數 |
sms |
number |
目前帳號所擁有的簡訊剩餘則數 |
附件 ¶
時區代碼對照表
代碼 | 區域名稱 |
---|---|
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 |