NAV Navbar

介紹

FirstLine 開放 api 串接文件

驗證

取得金鑰,可透過此金鑰執行各種對應帳號具備之系統權限之 api 操作

FIRST LINE 的 api 請求皆會取得後以下面兩種方式任一驗證 金鑰 (access token)

Authorization header Authorization: Bearer eyJhbGciOiJIUzI1NiI...

Query string parameter https://{API_HOST}/api/v1/some-what?token=eyJhbGciOiJIUzI1NiI...

Http Request

POST https://{API_HOST}/api/v1/auth

Post Parameters

Parameter Required Default Description
name true NULL 使用者帳號
password true NULL 使用者密碼
ttl false 60 金鑰過期時間,單位為分鐘,預設 60 分鐘過期

刷新權杖

curl -X PUT
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/auth

回傳 json 格式

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vYnNvLmxvY2FsaG9zdDo4MDAwL2FwaS92MS9hdXRoIiwiaWF0IjoxNTU0ODMxOTkyLCJleHAiOjE1NTUwNDgwNzksIm5iZiI6MTU1NDgzMjA3OSwianRpIjoiNzV2elE2cFVid2haTGU4UyIsInN1YiI6MSwicHJ2IjoiODdlMGFmMWVmOWZkMTU4MTJmZGVjOTcxNTNhMTRlMGIwNDc1NDZhYSIsImVtYWlsIjoib3JlaWxseS5zYWJyeW5hQGV4YW1wbGUub3JnIn0.-sQWox84CRUEtgTxKguPzDXe8kcZW4nArRDiveeiNt8",
    "token_type": "bearer",
    "expires_in": 216000
}

Http Request

PUT https://{API_HOST}/api/v1/auth

註銷權杖

curl -X POST
    -H "Accept: application/json"
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/auth/logout

回傳 json 格式

{
    "message": "Successfully logged out"
}

註銷當前使用之權杖,相當於登出此使用者

Http Request

POST https://{API_HOST}/api/v1/auth/logout

請求使用說明

FIRST LINE API 是使用 RESTful 風格設計的 API,使用到的 HTTP 請求方法共有四種:

請求示意圖

下方為使用 POST 請求新增一個客戶的 postman 示意圖:

請求主體

這邊 postman 的 Body 我們選用 raw 直接撰寫 json,避免 postman 誤將數字包裹為字串,造成部分欄位驗證時會發生錯誤。

{
    "membership_no":"R0000555",
    "identity_no":"A000000002",
    "gender":0,
    "first_name":"陳",
    "last_name":"大華",
    "birth_at":"1990-01-01"
}

表頭

{
    "Authorization":"YOUR_TOKEN",
    "Content-Type": "application/json",
    "Accept":"application/json",
}

表頭的部分有三個,下面逐一解釋:

Authorization

即 token,亦可使用 query string parameter 替代。

Content-Type

確保 server 端接收和回傳都會以 json 形式處理,因此這表頭是必要的。

Accept

為了確保 server 端接收和回傳都會以 json 形式處理,因此這表頭是必要的。

其他方法

GETDELETE 依此類推,選用對應的 postman 請求方法即可。

PUT 請求方法較為特殊,請參考下方區塊之說明。

PUT 請求示意圖

由於 FIRST LINE API 不支援直接使用 Http PUT 請求方法, 因此需要進行 PUT 請求時,請使用 POST 替代, 並且附帶參數 _method="put"

下方為 postman 示意圖:

{
    "membership_no":"R0000567",
    "identity_no":"A000000001",
    "gender":0,
    "first_name":"王",
    "last_name":"小明",
    "birth_at":"1999-09-09"
}

客戶

通用資料

此區為客戶欄位對應資料。

性別 gender

名稱
0
1

搜尋客戶

GET https://{API_HOST}/api/v1/contact?xxxx

考根據下方的 Query Parameters 表單的參數進行過濾篩選

curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/contact?xxxx

Response

Property Type Description
data Array of objects 客戶陣列
meta Object Pagination meta

回傳的 json 格式


{
    "data": [
        {
            "id": 1,
            "name": "Angelita D'Amore",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "membership_no": "8771639",
            "identity_no": "418099",
            "gender": 0,
            "birth_at": "1985-08-27",
            "profile_id": 1,
            "profile": {
                "id": 1,
                "phones": []
            },
            "email_contacts": []
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 10,
        "per_page": 1,
        "to": 1,
        "total": 10
    }
}

Query Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
id false NULL Number Array
gender false NULL Number 1: 女性, 0: 男性
birth_at__start false NULL Date 生日(開始)
birth_at__end false NULL Date 生日(結束)
search false NULL String 針對電話號碼,會員編號,身分證,姓名進行模糊搜尋
cz_cols false NULL Array 動態欄位,參數型態參考下方 CzCol 表格說明
phone_number false NULL String 電話號碼
email false NULL String 電子郵件地址
created_at__start false NULL DateTime 客戶建立時間(開始)
created_at__end false NULL DateTime 客戶建立時間(結束)
birth_months false NULL String 壽星月份,example: 1,2,3 表示查詢 1,2,3月的壽星
identity_no false NULL String 身分證

CzCol

此欄位為包含以下格式之陣列

Parameter Required Default Type Description
id true NULL Number 動態欄位的 id
op true NULL String 比較方式: '>', '<', '=', '>=', '<=', '<>', 'in', 'not_in', 'is_null', 'is_not_null'
val false NULL Number String

範例 [ {"id":1, "op":">", "val": 10}, {"id":1, "op":"<", "val": 20} ]

取得客戶

curl -X get
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/contact/1

Response

請參考客戶回應格式

Property Type Description
data Object 客戶

回傳 json 格式


{
    "data": {
        "id": 1,
        "name": "Angelita D'Amore",
        "first_name": "Angelita",
        "last_name": "D'Amore",
        "membership_no": "8771639",
        "identity_no": "418099",
        "gender": 0,
        "birth_at": "1985-08-27",
        "profile_id": 1,
        "profile": {
            "id": 1,
            "phones": []
        },
        "email_contacts": [],
        "cz_cols": [
            {
                "id": 1,
                "value": "19999",
                "category_id": 1
            },
            {
                "id": 4,
                "value": "51",
                "category_id": 1
            },
            {
                "id": 5,
                "value": null,
                "category_id": 1
            },
            {
                "id": 6,
                "value": null,
                "category_id": 1
            },
            {
                "id": 7,
                "value": null,
                "category_id": 1
            },
            {
                "id": 8,
                "value": null,
                "category_id": 1
            },
            {
                "id": 12,
                "value": null,
                "category_id": 1
            },
            {
                "id": 21,
                "value": null,
                "category_id": 1
            },
            {
                "id": 2,
                "value": null,
                "category_id": 2
            },
            {
                "id": 20,
                "value": null,
                "category_id": 2
            },
            {
                "id": 3,
                "value": null,
                "category_id": 6
            },
            {
                "id": 9,
                "value": null,
                "category_id": 7
            },
            {
                "id": 10,
                "value": null,
                "category_id": 7
            },
            {
                "id": 11,
                "value": null,
                "category_id": 7
            },
            {
                "id": 13,
                "value": null,
                "category_id": 8
            },
            {
                "id": 14,
                "value": null,
                "category_id": 8
            },
            {
                "id": 15,
                "value": null,
                "category_id": 8
            },
            {
                "id": 16,
                "value": "0",
                "category_id": 9
            }
        ]
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/contact/{contact}

URL Parameters

Parameter Required Default Type Description
contact True NULL Number 客戶的 id

新增客戶

新增客戶

curl -X POST
    -H "Content-Type: application/json"
    '{"first_name":"abc","last_name":"cde"}'
    https://{API_HOST}/api/v1/contact?xxxx

Response

客戶

回應的 json 格式


{
    "data": {
        "id": 2,
        "name": "abc cde",
        "first_name": "abc",
        "last_name": "cde",
        "membership_no": null,
        "identity_no": null,
        "gender": null,
        "birth_at": null,
        "profile_id": 1,
        "profile": {
            "id": 1,
            "phones": []
        },
        "cz_cols": [],
    }
}

Http Request

POST https://{API_HOST}/api/v1/contact

Form Data

Parameter Required Default Type Description
membership_no false NULL String 會員編號
identity_no false NULL String 身分證
gender false NULL Number 性別, 0: 女, 1: 男
first_name true NULL String
last_name false NULL String
birth_at false NULL Date 出生日期
cz_cols false NULL Array 動態欄位,參數型態參考下方 CzCol 表格說明

CzCol

此欄位為包含以下格式之陣列

Parameter Required Default Type Description
id true NULL Number 動態欄位的 id
value true NULL String 動態欄位的值

範例

假設目前有兩個動態欄位,分別為

id=1, name='體重' id=2, name='血型'

則參數範例如右:

Form Data cz_cols

[
    {"id":1, "value":"18KG"}, // 1: 體重
    {"id":2, "value": "AB型"} // 2: 血型
]

更新客戶

更新客戶

curl -X PUT
    -H "Content-Type: application/json"
    '{"first_name":"First","last_name":"Line"}'
    https://{API_HOST}/api/v1/contact/2

Response

客戶

回應的 json 格式


{
    "data": {
        "id": 2,
        "name": "First Line",
        "first_name": "First",
        "last_name": "Line",
        "membership_no": null,
        "identity_no": null,
        "gender": null,
        "birth_at": null,
        "profile_id": 1,
        "profile": {
            "id": 1,
            "phones": []
        },
        "cz_cols": [],
    }
}

Http Request

PUT https://{API_HOST}/api/v1/contact/{id}

URL Parameters

Parameter Description
id 客戶的 ID

Form Data

Parameter Required Default Type Description
membership_no false NULL String 會員編號
identity_no false NULL String 身分證
gender false NULL Number 性別, 0: 女, 1: 男
first_name false NULL String
last_name false NULL String
birth_at false NULL Date 出生日期
cz_cols false NULL Array 動態欄位,參數型態參考下方 CzCol 表格說明

CzCol

此欄位為包含以下格式之陣列

Parameter Required Default Type Description
id true NULL Number 動態欄位的 id
value true NULL String 動態欄位的值

範例

假設目前有3個動態欄位,分別為

則參數範例如右: (注意不論是單選還是多選,都是丟 value,若誤丟 text 會導致前端顯示出現問題)

Form Data cz_cols

[
    {"id":1, "value":"70"}, // 1: 體重
    {"id":2, "value":"AB"}, // 2: 血型
    {"id":3, "value": [1, 2]} // 3. 運動: 跑步+游泳
]

刪除客戶

刪除客戶

curl -X DELETE
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/contact/2

回應的 json 格式

Http status 為 204


{}

Http Request

DELETE https://{API_HOST}/api/v1/contact/{id}

URL Parameters

Parameter Description
id 客戶的 id

動態欄位

鑑於客戶間商務邏輯的不同,勢必對於表單欄位的需求也會有差異,固定的表單欄位很難滿足所有客戶的需求,因此我們可以透過動態欄位讓客戶自行制定最適合自己使用的欄位。

類型

動態欄位共有整數,字串,布林值,日期,時間,日期時間,單選,多選等 8 種類別,依序對應數字 0,1,2,3,4,5,6,7

其中 6(單選) 以及 7(多選) 存在 options 欄位,此欄位以 json 格式紀錄選項,下面以血型為例

[{"text":"A型", "value": "A"},{"text":"B型", "value": "B"},{"text":"AB型", "value": "AB"},{"text":"O型", "value": "O"}]

動態表單或是動態表格最後儲存的值為 value

動態表單欄位 (延伸欄位)

即從原本的表單額外添加的欄位,例如 客戶體重,此種欄位屬於 動態表單欄位

動態關聯表格 (關聯紀錄)

即從原本的表單添加 "一對多" 的關聯,例如 客戶購買紀錄,即屬於 動態關聯表格

目前套用在 [客戶] 以及 [工單]

目前 FIRST LINE 的 客戶 以及 工單 皆支援 動態欄位表單動態關聯表格

目前系統所有的動態欄位

目前系統所有的動態欄位,可根據 category_id, types 進行過濾篩選

curl -X GET
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/cz-col

Response

Property Type Description
data Array of objects 動態欄位陣列
meta Object Pagination meta

回傳 json 格式

{
    "data": [
        {
            "id": 1,
            "name": "Cyril223",
            "description": "Assumenda est corrupti voluptas aut. Beatae quisquam ex asperiores sit ullam.",
            "is_allowed_null": true,
            "default": null,
            "type": 4,
            "category_id": null,
            "category": null,
            "creater_id": null,
            "creater": null
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 10,
        "per_page": 1,
        "to": 1,
        "total": 10
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/cz-col

Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
category_id false NULL Number 動態欄位分類 的 id
types false NULL Number 0: 客戶動態表單欄位 1: 客戶動態關聯表格 2: 工單動態表單欄位 3: 工單動態關聯表格

動態欄位分類

所有動態欄位分類

GET https://{API_HOST}/api/v1/cz-col-category

type 0 表示 客戶動態欄位, 1 表示 客戶動態關聯表格, 2 表示 工單動態欄位, 3 表示 工單動態關聯表格

curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/cz-col-category?xxxx

Response

Property Type Description
data Array of objects 動態欄位分類 陣列
meta Object Pagination meta

回傳的 json 格式

{
    "data": [
        {
            "id": 1,
            "name": "SF",
            "type": 0,
            "description": null,
            "cols": [
                {
                    "id": 1,
                    "name": "唯一碼",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 1,
                    "options": null,
                    "category_id": 1,
                    "creater_id": null
                },
                {
                    "id": 2,
                    "name": "TESTCLICK__C",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 2,
                    "options": null,
                    "category_id": 1,
                    "creater_id": null
                }
            ],
            "creater_id": null,
            "creater": null
        },
        {
            "id": 2,
            "name": "其他",
            "type": 0,
            "description": null,
            "cols": [
                {
                    "id": 3,
                    "name": "勿擾",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 2,
                    "options": null,
                    "category_id": 2,
                    "creater_id": null
                },
                {
                    "id": 4,
                    "name": "最後活動日期",
                    "description": null,
                    "is_allowed_null": true,
                    "default": null,
                    "type": 1,
                    "options": null,
                    "category_id": 2,
                    "creater_id": null
                }
            ],
            "creater_id": null,
            "creater": null
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/cz-col-category?page=1",
        "last": "https://firstline.localhost/api/cz-col-category?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/cz-col-category",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}

此客戶綁定的動態欄位

此客戶綁定的動態欄位

curl -X GET
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/cz-col

Response

動態欄位

回傳 json 格式

{
    "data": [
        {
            "id": 1,
            "name": "Cyril223",
            "default": null,
            "description": "Assumenda est corrupti voluptas aut. Beatae quisquam ex asperiores sit ullam.",
            "is_allowed_null": true,
            "type": 4,
            "created_at": "2019-04-10 04:09:27",
            "updated_at": "2019-04-10 04:09:27",
            "category_id": null,
            "creater_id": null,
            "pivot": {
                "contact_id": 1,
                "cz_col_id": 1,
                "value": null
            }
        },
        {
            "id": 2,
            "name": "Geovany63",
            "default": null,
            "description": "Dolorum rerum ut est quam unde recusandae consequatur. Nobis laudantium eum et voluptatem sunt sint. Et occaecati voluptas ut aliquid cum sed.",
            "is_allowed_null": true,
            "type": 1,
            "created_at": "2019-04-10 04:09:27",
            "updated_at": "2019-04-10 04:09:27",
            "category_id": null,
            "creater_id": null,
            "pivot": {
                "contact_id": 1,
                "cz_col_id": 2,
                "value": "5"
            }
        }
    ]
}

Http Request

POST https://{API_DOMAIN}/api/v1/contact/{contact}/cz-col

Url Parameters

Parameter Required Default Type Description
contact true NULL Number 客戶 的 id

客戶動態關聯表格

列出指定客戶關聯紀錄 ([客戶關聯紀錄] 即 [客戶動態關聯表格])

GET https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation

curl -X GET
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/contact-cz-relation

假設目前有3個動態欄位,分別為

Response

回傳 json 格式

客戶動態關聯表格


{
    "data": [
        {
            "id": 1,
            "relation_id": 1, // CzColCategory (動態關聯分類)  id
            "relation_name": "健康檢查",
            "information": [
                {
                    "id": 1,
                    "value": 70,
                    "col_id": 1,
                    "col_name": "體重"
                },
                {
                    "id": 2,
                    "value": "A",
                    "col_id": 2,
                    "col_name": "血型"
                },
                {
                    "id": 3,
                    "value": [0,1],
                    "col_id": 3,
                    "col_name": "檢查項目"
                }
            ],
            "created_at": "2019-11-24 22:58:21",
            "updated_at": "2019-11-24 22:58:21"
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "last": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/contact/2197607/contact-cz-relation",
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}

URL Parameters

Parameter Required Default Type Description
contact true NULL Number 客戶 的 id

對指定客戶增加關聯紀錄 (即客戶動態關聯表格)

POST https://{API_HOST}/api/v1/contact/{contact}/cz-col-category/{cz_col_category}/contact-cz-relation

假設目前有3個動態欄位,分別為


{
    "cz_cols": [
        {
            "id":1,
            "value":65
        },
        {
            "id":2,
            "value":"A"
        },
        {
            "id":3,
            "value":[1,2]
        }
    ]
}

Response

客戶動態關聯表格

客戶動態關聯表格內容

回傳 json 格式


{
    "data": [
        {
            "id": 2,
            "relation_id": 1, // CzColCategory (動態關聯分類)  id
            "relation_name": "健康檢查",
            "information": [
                {
                    "id": 4,
                    "value": 65,
                    "col_id": 1,
                    "col_name": "體重"
                },
                {
                    "id": 5,
                    "value": "A",
                    "col_id": 2,
                    "col_name": "血型"
                },
                {
                    "id": 6,
                    "value": [1,2],
                    "col_id": 3,
                    "col_name": "檢查項目"
                }
            ],
            "created_at": "2019-11-25 22:58:21",
            "updated_at": "2019-11-25 22:58:21"
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "last": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/contact/2197607/contact-cz-relation",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}

URL Parameters

Parameter Required Default Type Description
contact true NULL Number 客戶 的 id
cz_col_category true NULL Number 動態欄位分類 的 id

Form Data

Parameter Required Default Type Description
cz_cols false NULL Array or Objects 動態欄位,參數型態參考 CzCol 表格說明

CzCol

此欄位為包含以下格式之陣列

Parameter Required Default Type Description
id true NULL Number 動態欄位的 id
value true NULL String 動態欄位的值

範例

參數範例如右: (注意不論是單選還是多選,都是丟 value,若誤丟 text 會導致前端顯示出現問題)

Form Data cz_cols

[
    {"id":1, "value":"65"}, // 1: 體重
    {"id":2, "value":"A"}, // 2: 血型
    {"id":3, "value": [1, 2]} // 3. 檢查項目: 抽血+量身高
]

對指定客戶更新關聯紀錄 (即客戶動態關聯表格)

PUT https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation/{contact_cz_relation}

Form Data cz_cols


{
    "cz_cols": [
        {
            "id": 1, // 體重欄位的 id
            "value": 55
        }
    ]
}


Response

動態關聯表格

回傳 json 格式


{
    "data": {
        "id": 1,
        "relation_id": 1, // CzColCategory  id
        "relation_name": "寶寶資料",
        "information": [
            {
                "id": 4,
                "value": 55,
                "col_id": 1,
                "col_name": "體重"
            },
            {
                "id": 5,
                "value": "A",
                "col_id": 2,
                "col_name": "血型"
            },
            {
                "id": 6,
                "value": [1,2],
                "col_id": 3,
                "col_name": "檢查項目"
            }
        ]
    }
}

URL Parameters

Parameter Required Default Type Description
contact true NULL Number 客戶 的 id
contact_cz_relation true NULL Number 客戶動態關聯表格 的 id

Form Data

Parameter Required Default Type Description
cz_cols false NULL Array 動態欄位,參數型態參考 CzCol 表格說明

CzCol

此欄位為包含以下格式之陣列

Parameter Required Default Type Description
id true NULL Number 動態欄位的 id
value true NULL String 動態欄位的值

範例

參數範例如右: (注意不論是單選還是多選,都是丟 value,若誤丟 text 會導致前端顯示出現問題)

Form Data cz_cols

[
    {"id":1, "value":"70"}, // 1: 體重
    {"id":2, "value":"AB"}, // 2: 血型
    {"id":3, "value": [1, 2]} // 3. 運動: 跑步+游泳
]

對指定客戶刪除關聯紀錄 (即客戶動態關聯表格)

DELETE https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation/{contact_cz_relation}

curl -X DELETE
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/contact-cz-relation/1

回應 204 http status

URL Parameters

Parameter Required Default Type Description
contact true NULL Number 客戶 的 id
contact_cz_relation true NULL Number 客戶動態關聯表格 的 id

對指定客戶刪除所有指定分類下的關聯紀錄 (即客戶動態關聯表格)

DELETE https://{API_HOST}/api/v1/contact/{contact}/cz-col-category/{cz_col_category}

curl -X DELETE
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/cz-col-category/1

回應 204 http status

URL Parameters

Parameter Required Default Type Description
contact true NULL Number 客戶 的 id
cz_col_category true NULL Number 動態欄位分類 的 id

電話號碼

搜尋電話號碼

搜尋電話號碼

curl -X GET
    -H "Content-Type: application/json"
    '{"type": 0, "number": "0928846763"}'
    https://{API_HOST}/api/v1/phone-number

回傳 json 格式


{
    "data": [
        {
            "id": 245621,
            "type": 0,
            "extension": null,
            "number": "0928846763",
            "description": null,
            "profile_id": 1935008,
            "phone_contact": {
                "id": 480,
                "contact_id": 1935038,
                "phone_number_id": 245621,
                "is_visible": true
            }
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/phone-number?number=0928846763&contact_id=1935038&page=1",
        "last": "https://firstline.localhost/api/phone-number?number=0928846763&contact_id=1935038&page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/phone-number",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/phone-number

Form Data

下表為可使用的過濾條件

Parameter Required Default Type Description
contact_id false NULL Number 客戶的 id (可透過 搜尋客戶 取得客戶的 id)
type false NULL Number 0: 住家, 1: 公司, 2: 手機, 3: 傳真, 4: 其他
number false NULL String 電話號碼
extension false NULL String 分機號碼
description false NULL String 備註

Response

Property Type Description
data Array of objects 電話號碼陣列
meta Object Pagination meta

取得電話號碼

curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/245621

Response

請參考電話號碼的回應格式

Property Type Description
data Object 電話號碼

回傳 json 格式


{
    "data": {
        "id": 245621,
        "type": 0,
        "extension": null,
        "number": "0928846763",
        "description": null,
        "profile_id": 1935008,
        "phone_contact": {
            "id": 480,
            "contact_id": 1935038,
            "phone_number_id": 245621,
            "is_visible": true
        }
    }
}

Http Request

https://{API_DOMAIN}/api/v1/phone-number/{phone_number}

URL Parameters

Parameter Required Default Type Description
phone_number true NULL Number <電話號碼的id

新增電話號碼

新增電話號碼

curl -X POST
    -H "Content-Type: application/json"
    '{"type": 0, "number": "23255780374507", "extension": "54 311", "description": "Up-sized mobile focusgroup"}'
    https://{API_HOST}/api/v1/phone-number

回傳 json 格式

{
    "data": {
        "id": 1,
        "type": 0,
        "extension": "54 311",
        "number": "23255780374507",
        "description": "Up-sized mobile focusgroup",
        "profile_id": 1
    }
}

Http Request

POST https://{API_DOMAIN}/api/v1/phone-number

Form Data

Parameter Required Default Type Description
contact_id true NULL Number 客戶的 id (可透過 搜尋客戶 取得客戶的 id)
type true NULL Number 0: 住家, 1: 公司, 2: 手機, 3: 傳真, 4: 其他
number true NULL String 電話號碼
extension false NULL String 分機號碼
description false NULL String 備註

更新電話號碼

更新電話號碼

curl -X PUT
    -H "Content-Type: application/json"
    '{"type": 2, "number": "0939888999", "extension": ""}'
    https://{API_HOST}/api/v1/phone-number/1

Response

電話號碼

回傳 json 格式

{
    "data": {
        "id": 1,
        "type": 2,
        "extension": "",
        "number": "0939888999",
        "description": "Up-sized mobile focusgroup",
        "profile_id": 1
    }
}

Http Request

PUT https://{API_DOMAIN}/api/v1/phone-number/{phone_number}

URL Parameters

Parameter Required Default Type Description
phone_number true NULL Number 電話號碼的id

Form Data

Parameter Required Default Type Description
contact_id true NULL Number 客戶的 id
type false NULL Number 0: 住家, 1: 公司, 2: 手機, 3: 傳真, 4: 其他
number false NULL String 電話號碼
extension false NULL String 分機號碼
description false NULL String 備註

刪除電話號碼

刪除電話號碼

curl -X DELETE
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/phone-number/1

回傳 json 格式

Http status 為 204

{}

Http Request

DELETE https://{API_DOMAIN}/api/v1/phone-number/{phone_number}

URL Parameters

Parameter Required Default Type Description
phone_number true NULL Number 電話號碼的id

國家,縣市,區

查詢國家

查詢國家

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/country?per_page=3"

Response

Property Type Description
data Array of objects 國家陣列
meta Object Pagination meta

回傳 json 格式

{
    "data": [
        {
            "id": 1,
            "name": "台灣",
            "abbrev": null
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": "3",
        "to": 1,
        "total": 1
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/state

Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆

查詢縣市

查詢縣市

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/state?per_page=3"

Response

Property Type Description
data Array of objects 縣市陣列
meta Object Pagination meta

回傳 json 格式

{
    "data": [
        {
            "id": 2,
            "country_id": 1,
            "name": "基隆市",
            "country": {
                "id": 1,
                "name": "台灣",
                "abbrev": null
            }
        },
        {
            "id": 3,
            "country_id": 1,
            "name": "台北市",
            "country": {
                "id": 1,
                "name": "台灣",
                "abbrev": null
            }
        },
        {
            "id": 4,
            "country_id": 1,
            "name": "新北市",
            "country": {
                "id": 1,
                "name": "台灣",
                "abbrev": null
            }
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 8,
        "per_page": "3",
        "to": 3,
        "total": 23
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/state

Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
name false NULL String 縣市名稱

查詢區

查詢區

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/city?per_page=3"

Response

Property Type Description
data Array of objects 區域陣列
meta Object Pagination meta

回傳 json 格式

{
    "data": [
        {
            "id": 1,
            "state_id": 2,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "基隆市"
            },
            "name": "仁愛區",
            "zipcode": "200"
        },
        {
            "id": 2,
            "state_id": 2,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "基隆市"
            },
            "name": "信義區",
            "zipcode": "201"
        },
        {
            "id": 3,
            "state_id": 2,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "基隆市"
            },
            "name": "中正區",
            "zipcode": "202"
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 124,
        "per_page": "3",
        "to": 3,
        "total": 371
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/city

Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
state_id false NULL Number 縣市的 id
zipcode false NULL Number 郵遞區號
name false NULL String 郵遞區名

聯絡地址

通用資料

此區為聯絡地址欄位對應資料。

類別 type

名稱
住家 0
通訊 1
帳單 2
郵寄 3
戶籍 4
其他 5

搜尋聯絡地址

搜尋聯絡地址

curl -X GET
    -H "Content-Type: application/json"
    '{"city_id":1}'
    https://{API_HOST}/api/v1/address

回傳 json 格式


{
    "data": [
        {
            "id": 2678,
            "type": 1,
            "enum_type": {
                "key": "MAILING",
                "value": 1,
                "description": "mail address"
            },
            "address": "基隆市仁愛區愛一路35號8樓之一",
            "contact_id": 1938277,
            "profile_id": 1938247,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "基隆市"
            },
            "state_id": 2,
            "country": {
                "id": 1,
                "name": "台灣",
                "abbrev": null
            },
            "country_id": 1,
            "city": {
                "id": 1,
                "state_id": 2,
                "name": "仁愛區",
                "zipcode": "200"
            },
            "city_id": 1,
            "description": null
        },
        {
            "id": 2830,
            "type": 1,
            "enum_type": {
                "key": "MAILING",
                "value": 1,
                "description": "mail address"
            },
            "address": "愛一路19號",
            "contact_id": 1938482,
            "profile_id": 1938452,
            "state": {
                "id": 2,
                "country_id": 1,
                "name": "基隆市"
            },
            "state_id": 2,
            "country": {
                "id": 1,
                "name": "台灣",
                "abbrev": null
            },
            "country_id": 1,
            "city": {
                "id": 1,
                "state_id": 2,
                "name": "仁愛區",
                "zipcode": "200"
            },
            "city_id": 1,
            "description": null
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/address?per_page=2&city_id=1&page=1",
        "last": "https://firstline.localhost/api/address?per_page=2&city_id=1&page=63",
        "prev": null,
        "next": "https://firstline.localhost/api/address?per_page=2&city_id=1&page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 63,
        "path": "https://firstline.localhost/api/address",
        "per_page": "2",
        "to": 2,
        "total": 126
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/address

Form Data

下表為可使用的過濾條件

Parameter Required Default Type Description
contact_id false NULL Number 客戶的 id
type false NULL Number 0:住家,1:通訊,2:帳單,3:郵寄,4:戶籍,5:其他
address false NULL String 地址
country_id false NULL Number 國家的id
state_id false NULL Number 城市的id
city_id false NULL Number 區域的id
description false NULL String 地址描述

Response

Property Type Description
data Array of objects 地址陣列
meta Object Pagination meta

取得指定客戶聯絡地址

取得指定聯絡地址

shell curl -X GET -H "Content-Type: application/json" https://{API_HOST}/api/v1/address/1 `

Response

請參考地址回應格式

Property Type Description
data Object 地址

回傳 json 格式


{
    "data": {
        "id": 1,
        "type": 3,
        "address": "67, rue Michelle Jones\n81785 Berge",
        "profile_id": 1,
        "state": {
            "id": 1,
            "country_id": 1,
            "name": "台北市"
        },
        "state_id": 1,
        "country": {
            "id": 1,
            "name": "台灣",
            "abbrev": null
        },
        "country_id": 1,
        "city": {
            "id": 1,
            "state_id": 1,
            "name": "仁愛區",
            "zipcode": "200"
        },
        "city_id": 1,
        "description": null
    }
}

Http Request

https://{API_DOMAIN}/api/v1/address/{address}

URL Parameters

Parameter Required Default Type Description
address True Null Number 地址 的 id

新增指定客戶聯絡地址

新增聯絡地址

curl -X POST
    -H "Content-Type: application/json"
    '{"profile_id":1,"country_id":1,"state_id":1,"city_id":1,"address": "67, rue Michelle Jones 81785 Berge"}'
    https://{API_HOST}/api/v1/address

回傳 json 格式

{
    "data": {
        "id": 1,
        "type": 3,
        "address": "67, rue Michelle Jones\n81785 Berge",
        "profile_id": 1,
        "state": {
            "id": 1,
            "country_id": 1,
            "name": "台北市"
        },
        "state_id": 1,
        "country": {
            "id": 1,
            "name": "台灣",
            "abbrev": null
        },
        "country_id": 1,
        "city": {
            "id": 1,
            "state_id": 1,
            "name": "仁愛區",
            "zipcode": "200"
        },
        "city_id": 1,
        "description": null
    }
}

Http Request

POST https://{API_DOMAIN}/api/v1/address

Form Data

Parameter Required Default Type Description
contact_id true NULL Number 客戶的 id
type true NULL Number 0:住家,1:郵寄,2:帳單,3:快遞,4:現居,5:其他
address true NULL String 地址
country_id false NULL Number 國家的id
state_id false NULL Number 城市的id
city_id false NULL Number 區域的id
description false NULL String 地址描述

修改聯絡地址

修改聯絡地址

curl -X PUT
    -H "Content-Type: application/json"
    '{"address": "仁愛路一段"}'
    https://{API_HOST}/api/v1/address/1

Response

地址

回傳 json 格式

{
    "data": {
        "id": 1,
        "type": 3,
        "address": "信義路一段",
        "profile_id": 1,
        "state": {
            "id": 1,
            "country_id": 1,
            "name": "台北市"
        },
        "state_id": 1,
        "country": {
            "id": 1,
            "name": "台灣",
            "abbrev": null
        },
        "country_id": 1,
        "city": {
            "id": 1,
            "state_id": 1,
            "name": "仁愛區",
            "zipcode": "200"
        },
        "city_id": 1,
        "description": null
    }
}

Http Request

PUT https://{API_DOMAIN}/api/v1/address/{address}

URL Parameters

Parameter Required Default Type Description
address true NULL Number 地址的id

Form Data

Parameter Required Default Type Description
contact_id false NULL Number 客戶的 id
type false NULL Number 0:住家,1:郵寄,2:帳單,3:快遞,4:現居,5:其他
address false NULL String 地址
country_id false NULL Number 國家的id
state_id false NULL Number 城市的id
city_id false NULL Number 區域的id
description false NULL String 地址描述

刪除聯絡地址

刪除聯絡地址

curl -X DELETE
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/address/1

回傳 json 格式

Http status 為 204

{}

Http Request

DELETE https://{API_DOMAIN}/api/v1/address/{address}

URL Parameters

Parameter Required Default Type Description
address true NULL Number 地址的id

電子信箱

搜尋電子信箱

搜尋電子信箱

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/email-contact?contact_id=1"

回傳 json 格式

{
    "data": [
        {
            "id": 1,
            "address": "harvey.bartholome@gmail.com",
            "contact_id": 1,
            "draft": null,
            "name": "Jaiden Champlin III",
            "description": "Pariatur dolorem aut voluptatibus. Aut pariatur voluptatum ratione atque sit. Et inventore quo voluptates animi.",
            "contact": {
                "id": 1,
                "membership_no": "8771639",
                "identity_no": "418099",
                "first_name": "Angelita",
                "last_name": "D'Amore",
                "gender": 0,
                "birth_at": "1985-08-27 00:00:00",
                "created_at": "2019-04-10 03:01:41",
                "updated_at": "2019-04-10 03:01:41",
                "profile_id": 1,
                "sponsor_id": null,
                "disturb_setting": null
            }
        },
        {
            "id": 5,
            "address": "shyanne47@hotmail.com",
            "contact_id": 1,
            "draft": null,
            "name": "Mikayla Funk",
            "description": "Possimus optio molestiae perspiciatis distinctio. Vel incidunt ut unde. Laudantium eaque distinctio officia eum error odit.",
            "contact": {
                "id": 1,
                "membership_no": "8771639",
                "identity_no": "418099",
                "first_name": "Angelita",
                "last_name": "D'Amore",
                "gender": 0,
                "birth_at": "1985-08-27 00:00:00",
                "created_at": "2019-04-10 03:01:41",
                "updated_at": "2019-04-10 03:01:41",
                "profile_id": 1,
                "sponsor_id": null,
                "disturb_setting": null
            }
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/email-contact

Query Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
contact_id false NULL Number 客戶的id
name false NULL String 定義的 Email 名稱
description false NULL String Email 備註
address false NULL String Email 位址

Response

Property Type Description
data Array of objects 電子信箱陣列
meta Object Pagination meta

取得指定電子信箱

curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/email-contact/1

Response

請參考電子信箱回應格式

Property Type Description
data Object 電子信箱

回傳 json 格式


{
    "data": {
        "id": 1,
        "address": "harvey.bartholome@gmail.com",
        "contact_id": 1,
        "draft": null,
        "name": "Jaiden Champlin III",
        "description": "Pariatur dolorem aut voluptatibus. Aut pariatur voluptatum ratione atque sit. Et inventore quo voluptates animi.",
        "contact": {
            "id": 1,
            "membership_no": "8771639",
            "identity_no": "418099",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "gender": 0,
            "birth_at": "1985-08-27 00:00:00",
            "created_at": "2019-04-10 03:01:41",
            "updated_at": "2019-04-10 03:01:41",
            "profile_id": 1,
            "sponsor_id": null,
            "disturb_setting": null
        }
    }
}

Http Request

https://{API_DOMAIN}/api/v1/email-contact/{email_contact}

URL Parameters

Parameter Required Default Type Description
email_contact True Null Number 電子信箱的 id

新增電子信箱

指定客戶新增電子信箱

curl -X POST
    -H "Content-Type: application/json"
    '{"contact_id":1,"address":"loren18@ortiz.biz","name":"Theresia Zieme"}'
    https://{API_HOST}/api/v1/email-contact

Response

電子信箱

回傳 json 格式

{
    "data": {
        "id": 3,
        "address": "loren18@ortiz.biz",
        "contact_id": 1,
        "draft": null,
        "name": "Theresia Zieme",
        "description": null,
        "contact": {
            "id": 1,
            "membership_no": "8771639",
            "identity_no": "418099",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "gender": 0,
            "birth_at": "1985-08-27 00:00:00",
            "created_at": "2019-04-10 03:01:41",
            "updated_at": "2019-04-10 03:01:41",
            "profile_id": 1,
            "sponsor_id": null,
            "disturb_setting": null
        }
    }
}

Http Request

POST https://{API_DOMAIN}/api/v1/email-contact

Parameters

Parameter Required Default Type Description
contact_id true NULL Number 客戶的id
address true NULL String 電子信箱地址
name false NULL String 電子信箱自定義名稱
description false NULL String 電子信箱自定義描述

更新指定電子信箱

更新指定電子信箱

curl -X PUT
    -H "Content-Type: application/json"
    '{"name":"Sharon"}'
    https://{API_HOST}/api/v1/email-contact/1

Response

電子信箱

回傳 json 格式

{
    "data": {
        "id": 3,
        "address": "loren18@ortiz.biz",
        "contact_id": 1,
        "draft": null,
        "name": "Sharon",
        "description": null,
        "contact": {
            "id": 1,
            "membership_no": "8771639",
            "identity_no": "418099",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "gender": 0,
            "birth_at": "1985-08-27 00:00:00",
            "created_at": "2019-04-10 03:01:41",
            "updated_at": "2019-11-10 03:01:41",
            "profile_id": 1,
            "sponsor_id": null,
            "disturb_setting": null
        }
    }
}

Http Request

PUT https://{API_DOMAIN}/api/v1/email-contact/{email_contact}

Parameters

Parameter Required Default Type Description
address true NULL String 電子信箱地址
name false NULL String 電子信箱自定義名稱
description false NULL String 電子信箱自定義描述

刪除電子信箱

刪除指定客戶的電子信箱

curl -X DELETE
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/email-contact?contact_id=1"

回傳 json 格式

http status: 204

{}

Http Request

https://{API_DOMAIN}/api/v1/email-contact/{email_contact}

URL Parameters

Parameter Required Default Type Description
email_contact true NULL Number 電子信箱的id

工單

通用資料

此區為工單相關對應資料,如「狀態」、「優先度」等代碼。

狀態 statuses

名稱
待處理 0
處理中 1
已解決 2
已關閉 3

優先度 priority

名稱
0
1
2
緊急 3

搜尋工單

根據各種條件搜尋工單,詳細介紹請參考下表

除了工單本身資訊以外,也包含關聯的客戶,分類,子分類,聯絡記錄,處理人員,業主等資訊。

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket?per_page=15&page=1"

Response

Property Type Description
data Array of objects 工單陣列
meta Object Pagination meta

回傳 json 格式

{
    "data": [
        {
            "id": 67,
            "subject": "無法通話",
            "content": "無法通話\n#處理完成",
            "due_at": null,
            "status": 0,
            "status_memo": null,
            "priority": 0,
            "contact": null,
            "contact_id": null,
            "sub_category": {
                "id": 26,
                "name": "建議",
                "description": null,
                "category": {
                    "id": 1,
                    "name": "電話功能",
                    "description": null
                },
                "category_id": 1
            },
            "sub_category_id": 26,
            "creater": {
                "id": 7,
                "name": "Tommy Hsu",
                "first_name": "Tommy",
                "last_name": "Hsu",
                "employee_no": "tommy",
                "photo_url": "/employee/7/photo",
                "identity_no": null,
                "job_title_id": -1,
                "department_id": -1,
                "extension_id": 8,
                "extension": {
                    "id": 8,
                    "type": 3,
                    "extension": "8005",
                    "description": null,
                    "media_cluster_id": null
                },
                "group_id": 2,
                "group": {
                    "id": 2,
                    "name": "測試B組",
                    "description": null,
                    "supervisor_id": 1
                },
                "cti_agent_account": "ag8005",
                "cti_agent": {
                    "id": 5,
                    "account": "ag8005",
                    "group_id": null
                },
                "created_at": "2019-04-12 12:51:34",
                "updated_at": "2019-04-15 15:25:46"
            },
            "handler_id": 7,
            "handler": {
                "id": 7,
                "name": "Tommy Hsu",
                "first_name": "Tommy",
                "last_name": "Hsu",
                "employee_no": "tommy",
                "photo_url": "/employee/7/photo",
                "identity_no": null,
                "job_title_id": -1,
                "department_id": -1,
                "extension_id": 8,
                "extension": {
                    "id": 8,
                    "type": 3,
                    "extension": "8005",
                    "description": null,
                    "media_cluster_id": null
                },
                "group_id": 2,
                "group": {
                    "id": 2,
                    "name": "測試B組",
                    "description": null,
                    "supervisor_id": 1
                },
                "cti_agent_account": "ag8005",
                "cti_agent": {
                    "id": 5,
                    "account": "ag8005",
                    "group_id": null
                },
                "created_at": "2019-04-12 12:51:34",
                "updated_at": "2019-04-15 15:25:46"
            },
            "interact_collections": [
                {
                    "id": 149,
                    "is_acw_completed": true,
                    "first_enter_queue_at": "2019-04-18 16:51:57",
                    "acw_at": "2019-04-18 16:54:57",
                    "last_finished_at": "2019-04-18 16:52:10",
                    "handler_id": 7,
                    "handler": {
                        "id": 7,
                        "name": "Tommy Hsu",
                        "first_name": "Tommy",
                        "last_name": "Hsu",
                        "employee_no": "tommy",
                        "photo_url": "/employee/7/photo",
                        "identity_no": null,
                        "job_title_id": -1,
                        "department_id": -1,
                        "extension_id": 8,
                        "extension": {
                            "id": 8,
                            "type": 3,
                            "extension": "8005",
                            "description": null,
                            "media_cluster_id": null
                        },
                        "group_id": 2,
                        "group": {
                            "id": 2,
                            "name": "測試B組",
                            "description": null,
                            "supervisor_id": 1
                        },
                        "cti_agent_account": "ag8005",
                        "cti_agent": {
                            "id": 5,
                            "account": "ag8005",
                            "group_id": null
                        },
                        "created_at": "2019-04-12 12:51:34",
                        "updated_at": "2019-04-15 15:25:46"
                    },
                    "contact_id": null,
                    "memo": null,
                    "bound_type": 1,
                    "sponsor_id": 1,
                    "campaign_queue_id": null,
                    "result_id": 2
                }
            ],
            "sponsor_id": 1,
            "sponsor": {
                "id": 1,
                "name": "default",
                "description": null,
                "is_immortal": true,
                "mail_channels": []
            },
            "campaign_queue": null,
            "campaign_queue_id": null,
            "created_at": "2019-04-16 14:45:12",
            "updated_at": "2019-04-18 16:54:16",
            "termination_code_id": null,
            "termination_code": null,
            "category": {
                "id": 1,
                "name": "電話功能",
                "description": null
            },
            "category_id": 1
        },
        {
            "id": 66,
            "subject": "工單 for TEST",
            "content": "內容內容內容內容內容內容內容內容111111",
            "due_at": null,
            "status": 2,
            "status_memo": null,
            "priority": 0,
            "contact": {
                "id": 2,
                "name": "小 閎",
                "first_name": "小",
                "last_name": "閎",
                "membership_no": null,
                "identity_no": "A123456789",
                "gender": 0,
                "birth_at": "1987-10-10",
                "profile_id": 3,
                "sponsor_id": 1,
                "disturb_setting": null
            },
            "contact_id": 2,
            "sub_category": {
                "id": 23,
                "name": "時效",
                "description": null,
                "category": {
                    "id": 2,
                    "name": "理賠相關",
                    "description": null
                },
                "category_id": 2
            },
            "sub_category_id": 23,
            "creater": {
                "id": 6,
                "name": "Karick Tung",
                "first_name": "Karick",
                "last_name": "Tung",
                "employee_no": "karick",
                "photo_url": null,
                "identity_no": null,
                "job_title_id": -1,
                "department_id": -1,
                "extension_id": 5,
                "extension": {
                    "id": 5,
                    "type": 3,
                    "extension": "8004",
                    "description": "井井",
                    "media_cluster_id": null
                },
                "group_id": 2,
                "group": {
                    "id": 2,
                    "name": "測試B組",
                    "description": null,
                    "supervisor_id": 1
                },
                "cti_agent_account": "ag8004",
                "cti_agent": {
                    "id": 4,
                    "account": "ag8004",
                    "group_id": null
                },
                "created_at": "2019-03-08 22:51:25",
                "updated_at": "2019-04-17 13:31:00"
            },
            "handler_id": null,
            "handler": null,
            "interact_collections": [
                {
                    "id": 108,
                    "is_acw_completed": true,
                    "first_enter_queue_at": "2019-04-16 14:18:24",
                    "acw_at": "2019-04-16 14:23:06",
                    "last_finished_at": "2019-04-16 14:18:49",
                    "handler_id": 6,
                    "handler": {
                        "id": 6,
                        "name": "Karick Tung",
                        "first_name": "Karick",
                        "last_name": "Tung",
                        "employee_no": "karick",
                        "photo_url": null,
                        "identity_no": null,
                        "job_title_id": -1,
                        "department_id": -1,
                        "extension_id": 5,
                        "extension": {
                            "id": 5,
                            "type": 3,
                            "extension": "8004",
                            "description": "井井",
                            "media_cluster_id": null
                        },
                        "group_id": 2,
                        "group": {
                            "id": 2,
                            "name": "測試B組",
                            "description": null,
                            "supervisor_id": 1
                        },
                        "cti_agent_account": "ag8004",
                        "cti_agent": {
                            "id": 4,
                            "account": "ag8004",
                            "group_id": null
                        },
                        "created_at": "2019-03-08 22:51:25",
                        "updated_at": "2019-04-17 13:31:00"
                    },
                    "contact_id": 2,
                    "memo": null,
                    "bound_type": 1,
                    "sponsor_id": 1,
                    "campaign_queue_id": null,
                    "result_id": 2
                },
                {
                    "id": 121,
                    "is_acw_completed": true,
                    "first_enter_queue_at": "2019-04-16 15:36:59",
                    "acw_at": "2019-04-16 15:54:48",
                    "last_finished_at": "2019-04-16 15:54:48",
                    "handler_id": 2,
                    "handler": {
                        "id": 2,
                        "name": "eason d",
                        "first_name": "eason",
                        "last_name": "d",
                        "employee_no": "eason",
                        "photo_url": "/employee/2/photo",
                        "identity_no": null,
                        "job_title_id": -1,
                        "department_id": -1,
                        "extension_id": 2,
                        "extension": {
                            "id": 2,
                            "type": 3,
                            "extension": "8002",
                            "description": null,
                            "media_cluster_id": null
                        },
                        "group_id": 2,
                        "group": {
                            "id": 2,
                            "name": "測試B組",
                            "description": null,
                            "supervisor_id": 1
                        },
                        "cti_agent_account": "ag8002",
                        "cti_agent": {
                            "id": 2,
                            "account": "ag8002",
                            "group_id": null
                        },
                        "created_at": "2018-11-09 13:21:17",
                        "updated_at": "2019-04-15 15:10:10"
                    },
                    "contact_id": 2,
                    "memo": "這次不知道幹嘛",
                    "bound_type": 1,
                    "sponsor_id": 1,
                    "campaign_queue_id": null,
                    "result_id": 2
                }
            ],
            "sponsor_id": 1,
            "sponsor": {
                "id": 1,
                "name": "default",
                "description": null,
                "is_immortal": true,
                "mail_channels": []
            },
            "campaign_queue": null,
            "campaign_queue_id": null,
            "created_at": "2019-04-16 14:22:13",
            "updated_at": "2019-04-17 12:39:53",
            "termination_code_id": 5,
            "termination_code": {
                "id": 5,
                "name": "確認可否處理",
                "description": null,
                "status": 0,
                "creater_id": 1
            },
            "category": {
                "id": 2,
                "name": "理賠相關",
                "description": null
            },
            "category_id": 2
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 8,
        "per_page": "2",
        "to": 2,
        "total": 16
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/ticket

Query Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
search false NULL String 模糊搜尋工單標題和內容
contact_id false NULL Number 客戶 id
statuses false NULL Array 工單狀態 < 0: 待處理 1: 處理中 2: 已解決 3: 已關閉 >
due_at__start false NULL Datetime 截止日期時間(起始)
due_at__end false NULL Datetime 截止日期時間(結束)
created_at__start false NULL Datetime 建立日期時間(起始)
created_at__end false NULL Datetime 建立日期時間(結束)
sponsor_id false NULL Number 業主 id
termination_code_ids false NULL Array 狀態細項 id 陣列
handler_ids false NULL Array 處理工單的員工之 id 陣列
creater_ids false NULL Array 建立工單的員工之 id 陣列

取得工單

新建工單

新建工單

curl -X POST
    '{"subject":"標題","content":"內容","status":2,"contact_id":1,"sub_category_id":1,"termination_code":5}'
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket"

Response

請參考工單回應格式

Property Type Description
data Object 工單

回傳 json 格式

{
    "data" : {
        "id": 1,
        "subject": "標題",
        "content": "內容",
        "due_at": null,
        "status": 2,
        "status_memo": null,
        "priority": 0,
        "contact": {
            "id": 1,
            "name": "艾 魁爾",
            "first_name": "艾",
            "last_name": "魁爾",
            "membership_no": null,
            "identity_no": "A123456789",
            "gender": 0,
            "birth_at": "1987-10-10",
            "profile_id": 3,
            "sponsor_id": 1,
            "disturb_setting": null
        },
        "contact_id": 1,
        "sub_category": {
            "id": 1,
            "name": "時效",
            "description": null,
            "category": {
                "id": 1,
                "name": "理賠相關",
                "description": null
            },
            "category_id": 1
        },
        "sub_category_id": 1,
        "handler_id": null,
        "handler": null,
        "sponsor_id": null,
        "sponsor": null,
        "campaign_queue": null,
        "campaign_queue_id": null,
        "created_at": "2019-04-16 14:22:13",
        "updated_at": "2019-04-17 12:39:53",
        "termination_code_id": 5,
        "termination_code": {
            "id": 5,
            "name": "確認可否處理",
            "description": null,
            "status": 0,
            "creater_id": null
        },
        "category": {
            "id": 1,
            "name": "理賠相關",
            "description": null
        },
        "category_id": 1
    }
}

Http Request

POST https://{API_DOMAIN}/api/v1/ticket

Form Data

Parameter Required Default Type Description
sponsor_id false NULL Number 業主的 id
handler_id false NULL Number 處理員工的 id
termination_code_id false NULL Number 狀態細項的 id
subject true NULL String 工單標題
content true NULL String 工單內容
due_at false NULL Datetime 工單截止時間
priority false 0(最低) Number 工單優先等級
status false 0(待處理) Number 工單處理狀態
status_memo false NULL String 工單狀態備註
sub_category_id false NULL Number 子分類
contact_id false NULL Number 客戶的id

檢視工單

檢視工單

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket/1"

Response

請參考工單回應格式

回傳 json 格式


{
    "id": 1,
    "subject": "標題",
    "content": "內容",
    "due_at": null,
    "status": 2,
    "status_memo": null,
    "priority": 0,
    "contact": {
        "id": 1,
        "name": "艾 魁爾",
        "first_name": "艾",
        "last_name": "魁爾",
        "membership_no": null,
        "identity_no": "A123456789",
        "gender": 0,
        "birth_at": "1987-10-10",
        "profile_id": 3,
        "sponsor_id": 1,
        "disturb_setting": null
    },
    "contact_id": 1,
    "sub_category": {
        "id": 1,
        "name": "時效",
        "description": null,
        "category": {
            "id": 1,
            "name": "理賠相關",
            "description": null
        },
        "category_id": 1
    },
    "sub_category_id": 1,
    "handler_id": null,
    "handler": null,
    "sponsor_id": null,
    "sponsor": null,
    "campaign_queue": null,
    "campaign_queue_id": null,
    "created_at": "2019-04-16 14:22:13",
    "updated_at": "2019-04-17 12:39:53",
    "termination_code_id": 5,
    "termination_code": {
        "id": 5,
        "name": "確認可否處理",
        "description": null,
        "status": 0,
        "creater_id": null
    },
    "category": {
        "id": 1,
        "name": "理賠相關",
        "description": null
    },
    "category_id": 1
}

Http Request

GET https://{API_DOMAIN}/api/v1/ticket/{id}

URL Parameters

Parameter Description
id 工單 id

更改工單

更改工單

curl -X PUT
    -H "Content-Type: application/json"
    '{"subject":"修改後的標題"}'
    "https://{API_HOST}/api/v1/ticket/1"

Response

請參考工單回應格式

回傳 json 格式


{
    "id": 1,
    "subject": "修改後的標題",
    "content": "內容",
    "due_at": null,
    "status": 2,
    "status_memo": null,
    "priority": 0,
    "contact": {
        "id": 1,
        "name": "艾 魁爾",
        "first_name": "艾",
        "last_name": "魁爾",
        "membership_no": null,
        "identity_no": "A123456789",
        "gender": 0,
        "birth_at": "1987-10-10",
        "profile_id": 3,
        "sponsor_id": 1,
        "disturb_setting": null
    },
    "contact_id": 1,
    "sub_category": {
        "id": 1,
        "name": "時效",
        "description": null,
        "category": {
            "id": 1,
            "name": "理賠相關",
            "description": null
        },
        "category_id": 1
    },
    "sub_category_id": 1,
    "handler_id": null,
    "handler": null,
    "sponsor_id": null,
    "sponsor": null,
    "campaign_queue": null,
    "campaign_queue_id": null,
    "created_at": "2019-04-16 14:22:13",
    "updated_at": "2019-04-17 12:39:53",
    "termination_code_id": 5,
    "termination_code": {
        "id": 5,
        "name": "確認可否處理",
        "description": null,
        "status": 0,
        "creater_id": null
    },
    "category": {
        "id": 1,
        "name": "理賠相關",
        "description": null
    },
    "category_id": 1
}

Http Request

PUT https://{API_DOMAIN}/api/v1/ticket/{id}

URL Parameters

Parameter Description
id 工單 id

Form Data

Parameter Required Default Type Description
sponsor_id false NULL Number 業主的 id
handler_id false NULL Number 處理員工的 id
termination_code_id false NULL Number 狀態細項的 id
subject false NULL String 工單標題
content false NULL String 工單內容
due_at false NULL Datetime 工單截止時間
priority false 0(最低) Number 工單優先等級
status false 0(待處理) Number 工單處理狀態
status_memo false NULL String 工單狀態備註
sub_category_id false NULL Number 子分類
contact_id false NULL Number 客戶的id

刪除工單

刪除工單

curl -X DELETE
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket/1"

回傳 json 格式

Http status 為 204


{}

Http Request

DELETE https://{API_DOMAIN}/api/v1/ticket/{id}

URL Parameters

Parameter Description
id 工單 id

查詢員工

查詢員工

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/employee"

Response

Property Type Description
data Array of objects 員工陣列
meta Object Pagination meta

json

{
    "data": [
        {
            "id": 17,
            "name": "AG 8018",
            "first_name": "AG",
            "last_name": "8018",
            "employee_no": "ag8018",
            "photo_url": null,
            "identity_no": null,
            "job_title_id": 21,
            "job_title": {
                "id": 21,
                "abbrev": null,
                "name": "銷售專員",
                "description": null
            },
            "department_id": -1,
            "department": null,
            "extension_id": -1,
            "extension": null,
            "profile": {
                "id": 29,
                "phones": []
            },
            "is_active": true,
            "role": "",
            "email": null,
            "group_id": 3,
            "group": {
                "id": 3,
                "name": "SUN1",
                "description": null,
                "supervisor_id": 9
            },
            "is_immortal": false,
            "cti_agent_account": null,
            "cti_agent": null,
            "created_at": "2019-04-18 06:13:43",
            "updated_at": "2019-04-18 06:16:51"
        },
        {
            "id": 16,
            "name": "AG 8017",
            "first_name": "AG",
            "last_name": "8017",
            "employee_no": "ag8017",
            "photo_url": null,
            "identity_no": null,
            "job_title_id": 21,
            "job_title": {
                "id": 21,
                "abbrev": null,
                "name": "銷售專員",
                "description": null
            },
            "department_id": -1,
            "department": null,
            "extension_id": -1,
            "extension": null,
            "profile": {
                "id": 30,
                "phones": []
            },
            "is_active": true,
            "role": "",
            "email": null,
            "group_id": 3,
            "group": {
                "id": 3,
                "name": "SUN1",
                "description": null,
                "supervisor_id": 9
            },
            "is_immortal": false,
            "cti_agent_account": null,
            "cti_agent": null,
            "created_at": "2019-04-18 06:13:24",
            "updated_at": "2019-04-18 06:17:02"
        },
        {
            "id": 15,
            "name": "AG 8016",
            "first_name": "AG",
            "last_name": "8016",
            "employee_no": "ag8016",
            "photo_url": null,
            "identity_no": null,
            "job_title_id": 21,
            "job_title": {
                "id": 21,
                "abbrev": null,
                "name": "銷售專員",
                "description": null
            },
            "department_id": -1,
            "department": null,
            "extension_id": -1,
            "extension": null,
            "profile": {
                "id": 31,
                "phones": []
            },
            "is_active": true,
            "role": "",
            "email": null,
            "group_id": 3,
            "group": {
                "id": 3,
                "name": "SUN1",
                "description": null,
                "supervisor_id": 9
            },
            "is_immortal": false,
            "cti_agent_account": null,
            "cti_agent": null,
            "created_at": "2019-04-18 06:13:02",
            "updated_at": "2019-04-18 06:17:13"
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 6,
        "per_page": "3",
        "to": 3,
        "total": 17
    }
}

Query Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
search false NULL String 模糊搜尋員工姓名,身分證,員工編號

Http Request

GET https://{API_DOMAIN}/api/v1/employee

查詢業主

查詢業主

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/sponsor"

Response

Property Type Description
data Array of objects 業主陣列
meta Object Pagination meta

json

{
    "data": [
        {
            "id": 1,
            "name": "default",
            "description": null,
            "is_immortal": true,
            "mail_channels": []
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}

Http Request

GET https://{API_DOMAIN}/api/v1/sponsor

查詢工單狀態細項

查詢工單狀態細項

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/ticket-termination-code"

Response

Property Type Description
data Array of objects 工單狀態細項陣列
meta Object Pagination meta

Response

Property Type Description
id Number 狀態細項 id
name String 狀態細項名稱
description String 狀態細項敘述
status Number 對應的工單狀態 <0: 待處理 1: 處理中 2: 已完成 3: 已關閉>
creater_id Number 該狀態細項的建立員工之id

json 回傳格式

{
    "data": [
        {
            "id": 1,
            "name": "尚未知曉",
            "description": null,
            "status": 0,
            "creater_id": 1
        },
        {
            "id": 2,
            "name": "已知曉",
            "description": null,
            "status": 0,
            "creater_id": 1
        },
        {
            "id": 3,
            "name": "討論中",
            "description": null,
            "status": 1,
            "creater_id": 1
        },
        {
            "id": 4,
            "name": "正在寫",
            "description": null,
            "status": 1,
            "creater_id": 1
        },
        {
            "id": 5,
            "name": "確認可否處理",
            "description": null,
            "status": 0,
            "creater_id": 1
        },
        {
            "id": 6,
            "name": "放棄",
            "description": null,
            "status": 3,
            "creater_id": 1
        },
        {
            "id": 7,
            "name": "還有些東西未來處理",
            "description": null,
            "status": 2,
            "creater_id": 1
        },
        {
            "id": 8,
            "name": "搞定",
            "description": null,
            "status": 2,
            "creater_id": 1
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 8,
        "total": 8
    }
}

Query Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
search false NULL String 模糊搜尋員工姓名,身分證,員工編號

Http Request

GET https://{API_DOMAIN}/api/v1/ticket-termination-code

查詢主分類

查詢主分類

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/category"

Response

Property Type Description
data Array of objects 主分類陣列
meta Object Pagination meta

json 回傳格式

{
    "data": [
        {
            "id": 1,
            "name": "電話功能",
            "description": null,
            "children": [
                {
                    "id": 26,
                    "name": "建議",
                    "description": null
                }
            ]
        },
        {
            "id": 2,
            "name": "理賠相關",
            "description": null,
            "children": [
                {
                    "id": 23,
                    "name": "時效",
                    "description": null
                }
            ]
        },
        {
            "id": 3,
            "name": "PA 相關",
            "description": null,
            "children": [
                {
                    "id": 21,
                    "name": "保費計算方式",
                    "description": null
                },
                {
                    "id": 22,
                    "name": "最新優惠",
                    "description": null
                }
            ]
        },
        {
            "id": 4,
            "name": "配送",
            "description": null,
            "children": [
                {
                    "id": 25,
                    "name": "地區",
                    "description": null
                }
            ]
        },
        {
            "id": 5,
            "name": "電子郵件",
            "description": "電子郵件相關的功能",
            "children": [
                {
                    "id": 27,
                    "name": "後端程式BUG",
                    "description": "待修正處理的 BUG"
                }
            ]
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 5,
        "total": 5
    }
}

Query Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆

Http Request

GET https://{API_DOMAIN}/api/v1/category

查詢子分類

查詢子分類

curl -X GET
    -H "Content-Type: application/json"
    "https://{API_HOST}/api/v1/subcategory"

Response

Property Type Description
data Array of objects 子分類陣列
meta Object Pagination meta

json 回傳格式


{
    "data": [
        {
            "id": 21,
            "name": "保費計算方式",
            "description": null,
            "category": {
                "id": 3,
                "name": "PA 相關",
                "description": null
            },
            "category_id": 3
        },
        {
            "id": 22,
            "name": "最新優惠",
            "description": null,
            "category": {
                "id": 3,
                "name": "PA 相關",
                "description": null
            },
            "category_id": 3
        },
        {
            "id": 23,
            "name": "時效",
            "description": null,
            "category": {
                "id": 2,
                "name": "理賠相關",
                "description": null
            },
            "category_id": 2
        },
        {
            "id": 24,
            "name": "測試子分類",
            "description": "測試子分類",
            "category": null,
            "category_id": null
        },
        {
            "id": 25,
            "name": "地區",
            "description": null,
            "category": {
                "id": 4,
                "name": "配送",
                "description": null
            },
            "category_id": 4
        },
        {
            "id": 26,
            "name": "建議",
            "description": null,
            "category": {
                "id": 1,
                "name": "電話功能",
                "description": null
            },
            "category_id": 1
        },
        {
            "id": 27,
            "name": "後端程式BUG",
            "description": "待修正處理的 BUG",
            "category": {
                "id": 5,
                "name": "電子郵件",
                "description": "電子郵件相關的功能"
            },
            "category_id": 5
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "per_page": 15,
        "to": 7,
        "total": 7
    }
}

Query Parameters

Parameter Required Default Type Description
page false 1 Number 目前在第幾頁
per_page false 15 Number 每頁呈現多少筆
category_id false Number 所屬的主分類id

Http Request

GET https://{API_DOMAIN}/api/v1/subcategory

Webhook

請於 FIRST LINE 系統填寫您的回呼網址。

填寫完成後,客戶、地址、電話、電子郵件信箱有新增更新、或是刪除的動作發生, FIRST LINE 都會對您填寫的回呼網址進行呼叫,通知異動。

驗證

回呼網址建立後系統會自動產生一個 secret 值。

FIRST LINE 在呼叫回呼網址時,會在 Header X_FIRSTLINE_SIGNATURE 附帶簽章, 回呼網址收到 FIRST LINE 請求時,應該按照以下步驟進行驗證,確認請求確實來自 FIRST LINE

檢查流程

  1. 請將 secret 和 body 進行連接
  2. 將連接後的字串進行 md5 加密
  3. 用 base64 加密 2. 的字串
  4. 比對 3. 的字串和簽章是否吻合

範例

假設 secret 為 'A-Cup-of-coffee' body 為 '12345678' 檢查流程每個步驟的數值如下:

  1. 'A-Cup-of-coffee12345678'
  2. '10af1f0d0b8af9c0c476bc84a0ac39ce'
  3. 'MTBhZjFmMGQwYjhhZjljMGM0NzZiYzg0YTBhYzM5Y2U='

異動通知格式

異動格式共有 客戶異動電話號碼異動地址異動電子信箱異動 四種

其中 action 欄位有 createdupdateddeleted 三種值, 對應 新增修改刪除

客戶異動通知 json 格式


{
    "data": {
        "id": 1,
        "name": "Angelita D'Amore",
        "first_name": "Angelita",
        "last_name": "D'Amore",
        "membership_no": "8771639",
        "identity_no": "418099",
        "gender": 0,
        "birth_at": "1985-08-27",
        "profile_id": 1,
        "profile": {
            "id": 1,
            "phones": []
        },
        "cz_cols": [],
    },
    "model": "contact",
    "action": "created"
}

電話號碼異動通知 json 格式


{
    "data": {
        "id": 1,
        "type": 2,
        "extension": "",
        "number": "0939888999",
        "description": "Up-sized mobile focusgroup",
        "profile_id": 1
    },
    "model": "phonenumber",
    "action": "created"
}

地址異動通知 json 格式


{
    "data": {
        "id": 1,
        "type": 3,
        "address": "67, rue Michelle Jones\n81785 Berge",
        "profile_id": 1,
        "state": {
            "id": 1,
            "country_id": 1,
            "name": "台北市"
        },
        "state_id": 1,
        "country": {
            "id": 1,
            "name": "台灣",
            "abbrev": null
        },
        "country_id": 1,
        "city": {
            "id": 1,
            "state_id": 1,
            "name": "仁愛區",
            "zipcode": "200"
        },
        "city_id": 1,
        "description": null
    },
    "model": "address",
    "action": "created"
}

電子信箱異動通知 json 格式


{
    "data": {
        "id": 5,
        "address": "shyanne47@hotmail.com",
        "contact_id": 1,
        "draft": null,
        "name": "Mikayla Funk",
        "description": "Possimus optio molestiae perspiciatis distinctio. Vel incidunt ut unde. Laudantium eaque distinctio officia eum error odit.",
        "contact": {
            "id": 1,
            "membership_no": "8771639",
            "identity_no": "418099",
            "first_name": "Angelita",
            "last_name": "D'Amore",
            "gender": 0,
            "birth_at": "1985-08-27 00:00:00",
            "created_at": "2019-04-10 03:01:41",
            "updated_at": "2019-04-10 03:01:41",
            "profile_id": 1,
            "sponsor_id": null,
            "disturb_setting": null
        }
    },
    "model": "email_contact",
    "action": "created",
}

回應物件格式

地址 (Address)

Property Type Description
id Number 地址 id
type Number 地址類型
  • 0: 住家
  • 1: 郵寄
  • 2: 帳單
  • 3: 寄送
  • 4: 現居
  • 5: 其他
address String 地址內容
profile_id Number 客戶個資物件 的 id
state Object 縣市
state_id Number 縣市的id
country Object 國家
country_id Number 國家的id
city Object
city_id Number 區的id
description String 地址描述說明

國家 (Country)

Property Type Description
id Number id
name String 名稱

城市 (State)

Property Type Description
id Number id
name String 名稱

區 (City)

Property Type Description
id Number id
name String 名稱

客戶 (Contact)

Property Type Description
id Number 客戶的 id
name String 全名
first_name String 姓氏
last_namt String 名字
membership_no String 會員編號
identity_no String 身分證字號
gender Number 性別
birth_at Datetime 生日
profile_id Number 客戶個資物件 的 id
profile Object 客戶個資物件
sponsor Object 業主
sponsor_id Number 業主id
campaign_queues Array of objects 此欄位請忽略,尚未具備正式功能
email_contacts Array of objects 客戶電子信箱陣列
fbs Array of objects 此欄位請忽略,尚未具備正式功能
lines Array of objects 此欄位請忽略,尚未具備正式功能
cz_cols Array of objects 客戶的動態欄位陣列
tags Array of objects 標籤陣列
disturb_setting Object 勿擾

客戶個資物件 (Profile)

Property Type Description
id Number 客戶個資物件的 id,會被用來撈取住址,電話
phones Array of object 電話陣列

電子信箱 (EmailContact)

Property Type Description
id Number 電子郵件信箱 id
contact_id Number 所屬 客戶 的id
address String 電子郵件位址
draft String 草稿
name String 自定義的電子信箱別名
description String 電子信箱描述

動態欄位 (CzCol)

Property Type Description
id Number 動態欄位的 id
name String 動態欄位的名稱
description String 動態欄位的描述說明
is_allowed_null Boolean 是否允許空值
default Object 此動態欄位的預設值
type Number 動態欄位的類型
  • 0: 數字
  • 1: 字串
  • 2: 布林值
  • 3: 日期
  • 4: 時間
  • 5: 日期時間
  • 6: 單選
  • 7: 多選
category_id Number 主分類的 id
category Object 主分類
creater_id Number 建立此動態欄位的員工id
creater Object 建立此動態欄位的 員工

動態欄位分類 (CzColCategory)

Property Type Description
id Number 動態欄位分類 的 id
name String 動態欄位分類名稱
type Number 動態欄位分類類型 {0: 客戶動態關聯表單 1: 客戶動態關聯表格 2: 工單動態關聯表單 3: 工單動態關聯表格}
description String 動態欄位分類描述
cols Array of objects 動態欄位

客戶動態關聯表格 (ContactCzRelation)

Property Type Description
id Number 客戶動態關聯表格 id
relation_id Number 動態欄位分類 的 id
relation_name String 動態欄位分類 的名稱
information Array of Objects 客戶動態關聯表格內容 的陣列

客戶動態關聯表格內容 (ContactCzRelationInformation)

Property Type Description
id Number 客戶動態關聯表格內容的 id
value String 客戶動態關聯表格內容的值
col_id Number 動態欄位 的 id
col_name String 動態欄位 的名稱

客戶標籤 (Contact Tag)

Property Type Description
id Number id
name String 名稱
description String 說明

客戶勿擾設定 (Disturb Setting)

Property Type Description
id Number id
type Array of string 勿擾設定的類型,包含電話,Fb,Line
no_disturb_start_at Time 勿擾設定起始時間
no_disturb_end_at Time 勿擾設定結束時間
reason String 勿擾理由

員工 (Employee)

Property Type Description
id Number 員工的id
name String 姓名
first_name String 姓氏
last_name String 名字
employee_no String 員工編號
photo_url String 照片路徑
identity_no String 身分證字號
job_title_id Number 職稱 id
job_title Object 職稱
department_id Number 部門 id
department Object 部門
extension_id Number 分機 id
extension Object 分機
profile Object 客戶個資
is_active Boolean 是否啟用
role String 權限
email String 信箱地址
group_id Number 員工群組 id
group Object 員工群組
is_immortal Boolean 不可被修改
cti_agent_account String cti 帳號名稱
cti_agent Object 電話專員
created_at Datetime 初始建立時間
updated_at Datetime 最後更新時間

職稱 (Job Title)

Property Type Description
id Number id
abbrev String 簡稱
name String 名稱
description String 說明

分機 (Extension)

Property Type Description
id Number id
type Number 類型 <0: 分機, 1: ACD, 2: IVR, 3: WEBRTC>
extension String 分機號碼
description String 說明
media_cluster_id Number 待補
media_cluster Object 待補
employee_id Number 員工
employee Object 員工 id

電話專員 (CtiAgent)

Property Type Description
id Number id
account String 帳號
employee Object 員工
group_id Number 員工群組 id
group Object 員工群組

員工群組 (Employee Group)

Property Type Description
id Number 員工的id
name String 姓名
description String 說明
supervisor_id Number 督導的 id
supervisor Object 督導,格式為員工
members Array of object 群組成員,格式為員工的陣列

部門 (Deaprtment)

Property Type Description
id Number id
name String 名稱
abbrev String 簡稱
number Number 代號
description String 說明

電話 (Phone Number)

Property Type Description
id Number id
type Number 0: 住家, 1: 公司, 2: 手機, 3: 傳真, 4: 其他
extension String 分機
number String 號碼
description String 說明

工單 (Ticket)

Property Type Description
id Number id
subject String 標題
content String 內容
due_at Datetime 截止時間
status Number 工單狀態 < 0: 待處理 1: 處理中 2: 已解決 3: 已關閉 >
status_memo String 狀態備註
priority Number 優先順序
termination_code_id Number 狀態細項 id
termination_code Object 狀態細項
contact Object 客戶
contact_id Number 客戶 id
sub_category Object 子分類
sub_category_id Number 子分類 id
creater Object 建立此工單的員工
handler_id Number 建立此工單的員工 id
handler Object 負責此工單的員工
sponsor_id Number 負責此工單的員工 id
sponsor Object 此工單所屬的業主
created_at Datetime 初始建立時間
updated_at Datetime 最後更新時間

工單狀態細項代碼 (Ticket Termination Code)

Property Type Description
id Number id
name String 名稱
description String 說明
status Number 對應工單狀態 < 0: 待處理 1: 處理中 2: 已解決 3: 已關閉 >
creater_id Number 建立此狀態細項的員工 id
creater Object 建立此狀態細項的員工

主分類 (Category)

Property Type Description
id Number id
name String 名稱
description String 說明
children Array of objects 子分類陣列

子分類 (SubCategory)

Property Type Description
id Number id
name String 名稱
description String 說明
category Object 母分類
category_id Number 母分類 id
Property Type Description
id Number id
name String 名稱
description String 說明
is_immortal Boolean 是否不可更改
kbs Array of objects 待補
mail_channels Array of objects 待補

錯誤

FIRST LINE API 使用以下錯誤代碼

錯誤代碼 敘述
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
419 Sesstion expired.
422 Unprocessable Entity.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.