# 說明 ## 名詞說明 **將針對Chatannie 系統目錄功能說明。** ![image](https://hackmd.io/_uploads/r1Wob_J5T.png) * `對話設定` `scenario` 聊天情境(scenario)設定 * `圖形選單` `menu` LINE 聊天室下方選單 * `標籤清單` `tag` 聊天情境的每個node 可以添加標籤 * `用戶分類` `segment` 用戶分類 * `發送對話` `broadcast` 預約時間發送對話、可以條件分類用戶群 * `聯動信息設定` `externalapi` cors連接時使用 * `Icon設定` `IconUrl` LINE機器人圖像 ## API 順序 **各API基本順序的原則是依需求使用新增→取得→刪除、所有API使用前需要在Login後取得tokein, 在Request Header使用Bearer token** | Step 1 | Step 2 | Step 3 | Step 4 | | -------- | -------- | -------- | -------- | | [Login](#login) | 新增(save開頭API) | 取得(get開頭API) |刪除(delete開頭API) | ## 開放給人人直接存取API * [getChatHistoryCsv](#getChatHistoryCsv) * [getReportCsv](#getReportCsv) * [getUserHistoryCsv](#getUserHistoryCsv) * [getUserVariableCsv](#getUserVariableCsv) * [pushLineMessages](#pushLineMessages) * [api/penglue/send](#api/penglue/send) * [api/chichatcat/send](#api/chichatcat/send) * [api/userclick/send](#api/userclick/send) ## 時間格式 > YYYY-MM-DD HH:MM:SS.ZZZ **ex: 2024-01-28 06:04:25.693** # API ## createAccount **新增帳號** ### Request Body ``` json { "adminId" : "0001", "accountId":"f09y0xfcvnn-desn-anus-07s4-ftq370e334fd45", "accountName":"測試帳號1", "accountType":"line", "accountIcon":"https://i.imgur.com/aitiO6X.png", "accountWebhookUrl":"https://dev.chatannie.com/api/LineMessage/send?adminid=0001&accountid=f09y0xfcvnn-desn-anus-07s4-ftq370e334fd45", "accountToken":"P3RYNmaFZN0Uh+iazRpmoGPyMZ4OHWKd269NnbiXSl7N6BmV3ZlC53z3VVsuKVCS9NGo7qrFeTljRimAInI1SM4x6IHndptnx90xE6GO+anHMPf9cfUYPlNCac/Vk5zOGdKACDxTgcjMxoSeHqM0/wdB04t89/1O/w1cDnyilFU=", "accountSecret":"1ccfd15d289ab89d1b25479314d20f71", "accountClone":"" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID、需自行產生UUID碼、需唯一. - `accountName` (string, required) - 帳號名稱. - `accountType` (string, required) - 帳號類型 - line - wechat - fb - `accountIcon` (string, required) - 帳號圖片連結 (ex: https://i.imgur.com/aitiO6X.pngEndFragment). - `accountWebhookUrl` (string, required) - 社群帳號連結到chatannie 綁定的webhook url,格式固定為https://chatannie.com/api/LineMessage/send?adminid={adminid}&accountid={accountId}. {adminId}, {accountId}需等於上列adminId/accountId - `accountToken` (string, required) - SNS連結的Token. - `accountSecret` (string, required) - SNS連結的Secret. - `accountClone` (string, required): 複製帳號功能、輸入頻道ID(accountId)、雖然是必填欄位、沒使用到此功能請保持空白。 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null --- ## deleteBroadcast **刪除發送對話** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "broadcastIds":["2d76f8ac-b9c6-11ee-8b58-d6a4610da5ec"] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `broadcastIds` (array, required): broadcastId、至少輸入一個、可以從getBroadcastPlan取得 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null --------------------------------- ## deleteForm **刪除表單設定** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "formId":"99a2d0f0-b8fe-11ee-9229-f26f34ad4bbe" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `formId` (array, required): 表單ID、可以從getForm取得 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null --------------------------- ## deleteIconUrl **刪除bot圖像Icon、比方LINE對話視窗左側機器人圖像** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "accountIconUrl":[ { "id": "cd0b7895-05b1-4102-81fd-cfc4f92bc0ff" } ] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `accountIconUrl` (array, required): - `id`(string, required): bot icon 的id, 可以從getIconUrl 取得 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null --------------------------- ## deleteMenu **刪除用戶選單** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "richmenuId":"richmenu-971a954e8c80f5a7ff4c8e3986a4f69d" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道帳號 - `richmenuId` (string, required): RichmenuID、可以從getMenu取得 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null ----------------------------- ## deleteScenario **刪除對話設定** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "scenarioId":"0b55ee90-bb79-11ee-b1cb-3289ab88e76e" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `scenarioId` (string, required): RichmenuID、可以從getScenario取得 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null --------------------- ## deleteTag **刪除標籤** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "tag":{ "color":"red-filter", "name":"tag name" } } ``` - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `tag` (object): - `color` (text, required): 標籤顏色、可以從getTag取得. - `name` (text, required): 標籤名稱、可以從getTag取得. ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null --------------- ## deleteUserData **刪除所有追蹤用戶** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null ----------------- ## deleteUserSegment **刪除用戶分類** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "segmentId":"01dda98c-bb7b-11ee-86cf-fadf1953c744" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `segmentId` (string, required):用戶分類ID、可以從getSegment取得 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null ---------------- ## deleteVariable **刪除使用者變數** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "accountVariable":["var2"] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `accountVariable` (array, required): 變數名稱、可以從getVariable 取得 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null ------------------- ## getAccount **取得帳號資訊** ### Request Body ``` json { "adminId" : "0001" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "accounts": [ { "accountId": "2bsb3y38l9d-gzhb-1jnq-tn7h-f3ci454dd2101", "accountName": "GaryFB_TEST", "accountType": "fb", "accountIcon": "https://i.imgur.com/CBzw1py.png", "accountWebhookUrl": "https://dev.chatannie.com/api/facebook?adminid=0001&accountid=2bsb3y38l9d-gzhb-1jnq-tn7h-f3ci454dd2101", "accountToken": "EAAQU1tbLc5wBALb0CJ1VZA8R1PhYzc6r0i5uZCbJmODCkdt3tCqMu02Cs6fwhEZA3DhZCTjmmQfpwL8sDYNjL0VlnN63LZCH8RcarxHpseZBFTlaeT4QT4ZC2oM4v4VuBiBcT506OnpxtYulRBZBisJFuzuQcJT8pB7G1UtpzSQzZC1ttucprS0Pm", "accountSecret": "015c5e744f935a11b317e66b4cc42752", "appId": "", "setting": { "cros": { "endpoint": "https://stg.acs-tpkg.com/api/cros/v1/place_order", "key": "xKSpcnl92HS8yalSLdi0a92j2sjk7X", "clientid": "2015010004", "params": { "user_id": "a" } } } } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `accounts` (array): - `accountId` (string): 帳號ID - `accountName` (string): 帳號名稱. - `accountType` (string): 帳號類型 - line - wechat - fb - `accountIcon` (string): 帳號使用圖片. - `accountWebhookUrl` (string): Webhook URL. - `accountToken` (string): SNS token. - `accountSecret` (string): SNS secret . - `appId` (string): 帳號類型選擇wechat需應用程式ID. - `setting` (object): 設定CROS設定. - `cros` cros專用設定 - `endpoint`(string):cros 連結網址 - `key`(string):依據帳號不同來填入cros給予的value - `clientId`(string):依據帳號不同來填入cros給予的value - `params`(object): 用於使用user variable收集到的資訊來做為連接cros的Parameter - `key`: `value` ------------------ ## getBroadcastHistory **取得歷史"發送對話"清單** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "broadcastId": "e47f4370-bda8-11ee-90d4-dea4f76151b9", "broadcastName": "PM00002", "broadcastScenarioId": "22b0cc7e-26a3-11ee-90ac-a698574f3611", "broadcastScenarioName": "01_營業稅申報", "segmentNames": [], "broadcastUsers": [ { "userId": "Ucca1dab9cdaa6abf621f352b6a20e24b", "userName": "Rex曾", "accountType": "line" } ], "broadcastStatus": "done", "broadcastTime": "2024-01-28 06:45:00", "createTime": "2024-01-28 06:45:58.076", "updateTime": "2024-01-28 06:50:09.720", "failed": 0, "success": 1 } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `data` (array): . - `broadcastId` (string): 推播的唯一碼. - `broadcastName` (string): 堆播設定的一個名稱. - `broadcastScenarioId` (string): 推播設定的發送對話ID. - `broadcastScenarioName` (string): 推播設定的發送對話名稱. - `segmentNames` (array): 推播設定的Segment Name 陣列 - `broadcastUsers` (array): 廣播對象. - `userId` (string): 用戶ID. - `userName` (string): 用戶名稱. - `accountType` (string): 帳號類型. - line - wechat - fb - `broadcastStatus` (string): 推播目前狀態. - `broadcastTime` (string): 推播預計時間. - `createTime` (string): 推播建立時間. - `updateTime` (string): 推播更新時間. - `failed` (number): 失敗數目. - `success` (number): 成功數目. ------------------ ## getBroadcastPlan **取得預計"發送對話"清單** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "broadcastId": "441e61ea-bda8-11ee-90d4-dea4f76151b9", "broadcastName": "PM00001", "broadcastScenarioId": "22b0cc7e-26a3-11ee-90ac-a698574f3611", "broadcastScenarioName": "01_營業稅申報", "segmentNames": [ "forreal" ], "broadcastUsersCount": 1, "broadcastStatus": "pending", "broadcastTime": "2024-01-29 06:40:00", "createTime": "2024-01-28 06:41:29.006", "updateTime": "2024-01-28 06:41:29.006", "failed": null, "success": null } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `data` (array): . - `broadcastId` (string): 推播的唯一碼. - `broadcastName` (string): 堆播設定的一個名稱. - `broadcastScenarioId` (string): 推播設定的發送對話ID. - `broadcastScenarioName` (string): 推播設定的發送對話名稱. - `segmentNames` (array): An array of segment names. - `broadcastUsersCount` (number): 發送用戶數量. - `broadcastStatus` (string): 推播目前狀態. - `broadcastTime` (string): 推播預計時間. - `createTime` (string): 推播建立時間. - `updateTime` (string): 推播更新時間. - `failed` (number): 失敗數目. - `success` (number): 成功數目. ----------------- ## getChatHistory **取得對話歷史紀錄** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "userId": "Ucca1dab9cdaa6abf621f352b6a20e24b", "userName": "Rex曾", "userPicture": "https://sprofile.line-scdn.net/0hrXdIYP7nLXdJMD9Dk6VTCDlgLh1qQXRlNQE3FX9lJE4hCWonZV9nQS9kekUgUD5yZlJnQSlkcRBFI1oRV2bRQ04Ac0BzAWImZF5jkQ", "accountType": "line", "accountStatus": "0", "nodeId": "", "tags": [], "followTime": "2024-01-28 06:04:25.693", "accessTime": "2024-01-28 06:05:33.830", "createTime": "2024-01-28 06:04:25.695" } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): . - `data` (array): . - `userId` (string): 用戶SNS ID. - `userName` (string): 用戶SNS 名稱. - `userPicture` (string): 用戶SNS頭貼. - `accountType` (string): 帳號類型 - line - wechat - fb - `accountStatus` (string): 帳號狀態 - 0 失效 - 1 有效 - `nodeId` (string): node ID. - `tags` (array): 該對話使用的標籤. - `name` (string): 標籤名稱. - `color` (string): 標籤顏色、參考[#saveTag](#saveTag)說明. - `followTime` (string): 用戶追蹤時間. - `accessTime` (string): 用戶更新時間. - `createTime` (string): 用戶新建時間. ------------- ## getChatHistoryCsv **取得對話歷史紀錄、CSV格式輸出** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "startTime":"2023-07-20 02:19:15", "endTime":"2024-01-25 02:19:15" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `startTime` (string, required): 查詢開始時間 - `endTime` (string, required): 查詢結束時間 ### Response #### Success ``` csv userid,username,userpicture,accounttype,accountstatus,nodeid,tags,followtime,accesstime,createtime Ucca1dab9cdaa6abf621f352b6a20e24b,Rex曾,https://sprofile.line-scdn.net/0hrXdIYP7nLXdJMD9Dk6VTCDlgLh1qQXRlNQE3FX9lJE4hCWonZV9nQS9kekUgUD5yZlJnQSlkcRBFI1oRV2bRQ04Ac0BzAWImZF5jkQ,line,0,,[],2024-01-28 06:04:25.693,2024-01-28 06:05:33.830,2024-01-28 06:04:25.695 ``` #### 說明 CSV結果如上面格式 #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null ------------------ ## getCheckTest **給SNS平台測試服務是否正常用** ### Request Body ``` json { "adminId" : "0001", "int":"xxx", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `int` (text, required): 沒有意義的字串 - `accountId` (string, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "result": "Check Test OK" } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `result` (string): 成功的話回傳"Check Test OK" ------------------ ## getCorsError 取得cors 錯誤 ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "msg": "'account_id' in request parameter is empty.", "code": "E0001" } ] } } ``` ##### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `data` (object array): - `msg`(string): 錯誤訊息 - `code`(string): 參考excelチャットAPI_仕様整理rev07 エラーコード表. ---------------- ## getForm **取得表單設定** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ```json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "id": "b0582c7e-bd8f-11ee-88bb-f231805ff397", "name": "testname", "fields": [ { "var_name": "employee_count" }, { "var_name": "apply_count" } ] } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - Result (object): - data (array): - id (string): 表單 ID - name (string): 表單名稱. - fields (array): 使用變數 - var_name (string): 變數名稱與值對應. ----------------- ## getIconUrl **取得LINE圖像ICON** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ```json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "id": "218e8a16-e504-431b-aa0f-181810e859b3", "name": "1", "url": "2" } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - Result (object): - data (array): - id (string): icon ID - name (string): icon 名稱. - url (array): icon url ---------------- ## getMenu **取得頻道選單資訊** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ```json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "id": "richmenu-f1218d48a7d6b7dfaad1864778b2b665", "name": "選單", "user_segment": [ "richAllUser" ], "layout": "B", "chat_bar_text": "選單", "area_opt": { "A": { "type": "text", "data": "營業稅申報" }, "B": { "type": "uri", "data": "https://liffdev.chatannie.com/biz-demo-resource/financial-data.jpg" }, "C": { "type": "text", "data": "重要訊息" }, "D": { "type": "text", "data": "尋找會計事務所" } }, "image_width": 2500, "image_height": 1686, "createTime": "2023-07-20 02:37:08.939", "start_time": "2024-03-20T15:35:00.000Z", "end_time": "2024-03-30T15:35:00.000Z", "use_datetime_trigger": true, "tab_menu": [ { "name": "tt", "width": "1250", "yAxis": "0", "xAxis": "0", "height": "200" }, { "name": "bb", "width": "1250", "yAxis": "0", "xAxis": "1250", "height": "200" } ], "open_menu": false } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `data` (array): - `id` (string): 選單ID. - `name` (string): 選單名稱. - `user_segment` (array): 選單對應的user segment - `layout` (string): 使用的Layout、請參考[#saveMenu](#saveMenu)說明 - `chat_bar_text` (string): 顯示再SNS 下方的名稱 - `area_opt` (object): 圖片對應的區域、詳細參考[saveMenu](#saveMenu)說明 - `image_width` (integer): 圖片寬. - `image_height` (integer): 圖片高. - `createTime` (string): 建立時間 - `open_menu`(boolean): LINE 頻道menu是否持續開啟狀態 - `use_datetime_trigger`(boolean): 是否使用時間切換LINE menu - `start_time` (string): LINE menu有效的套用時間開始、如果use_datetime_trigger=true的話 - `end_time`(string): LINE menu有效的套用時間結束、如果use_datetime_trigger=true的話 - `tab_menu`(object array): 請參考[#saveMenu](#saveMenu) -------------------- ## getReportCSV **取得csv報表連結** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "download_url": "https://asnet-dev-lambda-working-bucket.s3.amazonaws.com/asnet-dev-getReportCsv/275cb0d2-0831-4b11-81a9-58fd2c045da4/0001_n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436_20240128094050.csv?AWSAccessKeyId=ASIA3C5XXPPOULUNCB2P&Signature=IAG4wwXXITm7dead1NQa4koWmrs%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEBoaDmFwLW5vcnRoZWFzdC0xIkYwRAIgE%2Bn9sx4cdKlmRR%2BtHv9epKQ%2FcGTym%2FeZgloAgaF%2FZGECICz4ArRcKO41vvZN2%2FxLtdiIy1RRgwE9UOn1fa0yGdRfKo8DCNP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAhoMNzYyMjA1MTQxOTgxIgxOW8KIQ0LeqCT9YKUq4wIjFA%2Bu%2FXJyhGftHF%2BPjHJ0L%2FwacloRT6GeOW24mV6pUK0UKWZwbD9dPaLPtoJDsH1r2zJZF2Y2bxaHyzP%2BfaBicIj20aIG1bEY45U1f4uUFWlckeTAVidJkMPhy3RH5QWi6hPbBnTiwwnVCtS60TG%2F97KsrqTSWgXACg1fYt9gKdd15H0C3wHtHH3DQazZy5Mkh%2FhR%2BGwufVl6d1TbENIw8sQu2HnWS4pJxLgcC6Gsi3VVxpK0q4MMhiD7kkFujjx4jKJqVdJU%2B8N3WkvEVVmdo0FXA0DIF0eItShhpiR6ej1nsGbDBd11xGteMIJ0vTICyvwXi9NEjAjHwgH0m5LrJbEQOeaXBguMH0UQEOgc%2FS5NlZKpHvbYZxiE06bIHmMSWHsphoapvngs7XeMFg9HMW9CRJkrHpkxIUTrw6clyxChxn0yBfMBimI76Vqq21qBnMFbKV7xFeeAD7DBAaioRyvUMKHC2K0GOp4ByUVoeRoNoOxn2ous8oUa9WyIipeE%2FQ11RUWN6CTNJ38hOzkwmkPLEHgMVB1znVyQAPkJaEaiClqLc%2BTTDYb%2BYG9YdxX6qsBVChr4g8sZtqLITRCO4L4UFfMpCuC%2Fd3ggwcKI8eTFHH%2FlvLUJGkkuoUSaIRziIpAxI1xOVBmsst1ZMAMKAxlIK8%2FHPzKrKIWDMmBHQzuTRMqnHebCT54%3D&Expires=1706438450" } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result`: - `download_url` (string): csv的檔案路徑 --------------- ## getScenario 取得一個頻道的所有對話 ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "id": "21626a18-bd9c-11ee-9576-5e3d17951793", "scenario": { "scenarioId": "21626a18-bd9c-11ee-9576-5e3d17951793", "scenarioName": "C00010", "iconUrlId": "", "trigger": "", "keywords": [] }, "nodes": [], "createTime": "2024-01-28 05:14:36.771", "updateTime": "2024-01-28 05:14:36.771" } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 結果詳細請參考[#saveScenario](#saveScenario) ----------------- ## getTag **取得一個頻道的所有標籤** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "name": "12", "color": "red-filter", "values": [ "1324" ] } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object) - `data` (array) - `name` (string) - 標籤名稱 - `color` (string) - 標籤顏色 - `values` (string array) - 標籤值、請參考[#saveTag](#saveTag)取得詳細資訊 ----------- ## getUserCount **取得該頻道追蹤人數** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID **Response** #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": 1 } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `data` (number): 追蹤人數 ---------------- ## getUserForm **取得該表單使用者填寫結果** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "userId": "Ucca1dab9cdaa6abf621f352b6a20e24b", "formId": "7159da30-b8f9-11ee-97a4-4e4b96481df1", "formName": "test", "formData": { "apply_count": "2", "apply_tel": "08-1234-343" }, "createTime": "2024-01-22 07:27:29.743" } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - Result: - data - `userId`使用者ID - `formId` 表單ID - `formName` 表單名稱 - `formData` 表單變數集 - `var_name` 變數與值對應 - `createTime` 建立時間 ------------- ## getUserHistoryCsv **取得該頻道使用者填寫結果** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ```json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "download_url": "csv url" } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `download_url` (string) csv下載的url ----------- ## getUserVariableHistory **取得該頻道使用者填寫結果歷史** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` ----------- ## getUserSegment **取得該頻道用戶分類資訊** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "id": "c087b316-bda4-11ee-a942-6a92a112c05d", "name": "SG00009", "conditions": [], "followTime": null, "users": [ { "userId": "Ucca1dab9cdaa6abf621f352b6a20e24b", "userName": "Rex曾", "userPicture": "https://sprofile.line-scdn.net/0hrXdIYP7nLXdJMD9Dk6VTCDlgLh1qQXRlNQE3FX9lJE4hCWonZV9nQS9kekUgUD5yZlJnQSlkcRBFI1oRV2bRQ04Ac0BzAWImZF5jkQ", "accountType": "line", "accountStatus": "1", "followTime": "2024-01-28 06:04:25.693", "createTime": "" } ], "usersCount": 1, "mode": "Custom", "cvKey": { "orderId": null }, "liffurl": "", "scenarioId": null, "defaultUsersSegment": false, "createTime": "2024-01-28 06:16:19.746", "updateTime": "2024-01-28 06:16:19.746" }, ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `data` (array): - `id` (string): 用戶分類ID. - `name` (string): 用戶分類名稱. - `conditions` (array): 條件設定、請參考[#saveUserSegment](#saveUserSegment) RequestBody的segmentConditions - `followTime` (string): 追蹤時間. - `users` (object array): 追蹤用戶資訊.請參考[#saveUserSegment](#saveUserSegment). RequestBody的segmentUsers - `usersCount` (integer): 在這個用戶分類的追中人數 - `mode` (string): 條件模式 - Custom - 自訂群組 - CVKey - CV參數 - Conditions - 多重條件 - `cvKey` (object): - `orderId` (string): CV專有訂單編號 - `liffurl` (string): LIFF URL, 每個segemnt 都可以當成管道的入口、如果有設定的話。 - `scenarioId` (string): 如果有設定管道、需要設定一個scenarioId, 請參考[#getScenario](#getScenario) - `defaultUsersSegment` (boolean): 是否使用預設用戶分類、true的話不須設定. - `createTime` (string): 建立時間. - `updateTime` (string): 更新時間. ----------- ## getUserVariableCsv 取得該頻道使用者填寫結果 ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ```csv username,luid Rex曾,Ucca1dab9cdaa6abf621f352b6a20e24b Rex曾,Ucca1dab9cdaa6abf621f352b6a20e24b ``` #### 說明 CSV 結果 #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null ----------- ## getUserVariableHistory **取得該頻道使用者填寫結果歷史** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "userid": "U339210b56885137347aaad361138927e", "variable": { "apply_name": [ { "value": "陳加一", "create_time": "2023-08-22 05:08:02.164" } ], "apply_tel": [ { "value": "0923590195", "create_time": "2023-08-22 05:08:02.164" } ], "apply_company": [ { "value": "是", "create_time": "2023-08-22 05:08:02.164" } ], "apply_count": [ { "value": "3", "create_time": "2023-08-22 05:08:02.164" } ] } } ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` - `data` (array): - `userid` (string): 使用者ID - `variable` (object): 變數列表、下列key 為變數名稱、value為值 - var_name (array): . - `value` (string): 變數值 - `create_time` (string): 建立時間 ------------- ## getUsersList 取得使用者資訊 ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "keywords", "lastEvaluatedKey": { "adm_acc_id": { "S": "#0001#be0lhwj8k9h-ypq0-nghy-tb9r-drt7d7ccb35d239" }, "usrid_acstm": { "S": "#U09f0f4c0bdadde26ada531cfc7decb3c#2023-08-19 11:18:00.787" } } } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `keywords`(string,optional): 關鍵字搜尋、可使用逗號分隔多個關鍵字. - `lastEvaluatedKey`(string,optional): 利用同一個查詢結果、拿到下一個分頁(假設有10000比結果、本服務一次回傳100筆資料 - `adm_acc_id`(object) - `S`(string) ChatAnnie平台登入帳號與頻道ID串接key, 格式#adminId#accountId, ex: #0001#mwcv12niwx-35n3-o43e-jroh-g9g1ec4c22b4151 - `usrid_acstm` - `S`(string) 使用者ID串接follow時間來代表資料表chatbot_userlist 的唯一值欄位 usrid_acstm、代表在該帳號adm_acc_id下、目前讀到哪一筆資料, ex: #U09f0f4c0bdadde26ada531cfc7decb3c#2023-08-19 11:18:00.787 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ { "userId": "Ucca1dab9cdaa6abf621f352b6a20e24b", "userName": "Rex曾", "userPicture": "https://sprofile.line-scdn.net/0hrXdIYP7nLXdJMD9Dk6VTCDlgLh1qQXRlNQE3FX9lJE4hCWonZV9nQS9kekUgUD5yZlJnQSlkcRBFI1oRV2bRQ04Ac0BzAWImZF5jkQ", "accountType": "line", "accountStatus": "1", "followTime": "2024-01-28 06:04:25.693", "createTime": "2024-01-28 06:04:25.693" } ], "count": 1, "lastEvaluatedKey": null } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result`: - `data`(object array) - `userId`(string,required):用戶SNS提供的ID - `userName`(string,required):用戶SNS提供的名稱 - `userPicture`(string,required):用戶SNS提供的圖片 - `accoutType`(string,required):用戶來源類型 - line - wechat - fb - `accountStatus`(string,required):用戶狀態 - `followTime`(string,required):用戶追蹤時間 - `createTime`(string,required):用戶加入時間 - `count`(Integer): 該頻道追蹤人數 - `lastEvaluatedKey`(object): 拿來當下一次query的條件,可以延續上一次的搜尋。比方:假設資料量有1000筆,每次query限100筆、第一次query ,server會給key下次query帶著key, 結果就能重101開始 - `adm_acc_id`(object) - `S`(string) ChatAnnie平台登入帳號與頻道ID串接key, 格式#adminId#accountId, ex:"#0001#mwcv12niwx-35n3-o43e-jroh-g9g1ec4c22b4151" - `usrid_acstm` - `S`(string) 使用者ID串接follow時間來代表資料表chatbot_userlist 的唯一值欄位 usrid_acstm、代表在該帳號adm_acc_id下、目前讀到哪一筆資料 --------------- ## getVariable **取得該頻道變數設定清單** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436" } ``` #### 說明 - `adminId` (text, required): ChatAnnie平台登入帳號. - `accountId` (text, required): 頻道ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": [ "employee_count", "apply_count" ] } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 - `data`(string array): 變數名稱列 --------------- ## imgMapfile **Senario中Rich Message的上傳圖片功能** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "category":"ImageMap", "img":"base64 string" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `category` (string,required): s3存檔路徑、目前永遠是 - `img`(string): base 64 圖片字串 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "link": "https://asnet-res-dev.chatannie.com/images/ImageMap/0001/n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436/2355a568-bdcb-11ee-974a-e6b170f2ffcd" } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `link`(string) 圖片儲存位置 ------------ ## login **登入、取得驗證token** ### Request Body ``` json { "adminId" : "account id", "password":"password" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `password` (string, required): ChatAnnie平台登入密碼 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "id_token": "", "refresh_token": "", "access_token": "", "expires_in": 3600, "token_type": "Bearer" } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 - `id_token`(string): AWS Cognitio回傳token、使用該token 可以存取各個api([說明](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-id-token.html)) - `refresh_token`(string): id_token、目前系統沒用到、請參考([說明](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-refresh-token.html)) - `access_token`(string): AWS Cognitio回傳、目前沒用到、請參考([說明](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-access-token.html)). - `expires_in`(integer): token 到期時間 - `token_type`(string): 驗證方式、目前永遠是Bearer, 由AWS Congnito 決定 ----------------- ## pushLineMessages **直接推播給用戶、目前非前端系統使用** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "luid":"Ucca1dab9cdaa6abf621f352b6a20e24b", "messages": [ { "type": "imagemap", "baseUrl": "https://i.imgur.com/kz86Gec.png", "altText": "Hi test", "baseSize": { "width": 1040, "height": 1040 }, "actions": [ { "type": "uri", "linkUri": "https://www.google.com.tw/?hl=zh_TW", "area": { "x": 0, "y": 586, "width": 520, "height": 454 } } ] } ] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `luid` (string, required): LINE ID - `messages`(object,array): 訊息內容、跟對話設定相同、請參考[#saveScenario](#saveScenario). ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "id_token": "", "refresh_token": "", "access_token": "", "expires_in": 3600, "token_type": "Bearer" } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null ------------ ## richMessageApi (可能失效) **最後呼叫時間為2022-11-21 11:19:49 (UTC+08:00)、目前已找不到開發工程師** ------------ ## saveForm **儲存表單變數** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "fields": [ { "var_name": "employee_count" }, { "var_name": "apply_count" } ], "name":"testname" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `fields` (object array,required): 表單使用到的變數 - `var_name` (string,required): 變數名稱、可以從getVariable取得. - `name` (string,required) 表單宣告名稱 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": { "data": { "id": "b0582c7e-bd8f-11ee-88bb-f231805ff397", "name": "testname", "fields": [ { "var_name": "employee_count" }, { "var_name": "apply_count" } ] } } } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): - `data` (object): - `id` (string): 表單ID - `name` (string): 表單宣告名稱 - `fields` (object array): - `var_name`(string) 變數名稱 ------------ ## saveIconUrl **儲存ICON** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "accountIconUrl":[ { "name":"icon name", "url":"https://i.imgur.com/l4Hcviw.png" } ] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `accountIconUrl` (object array,required): - `name` (string,required): ICON宣告名稱. - `url` (string,required): ICON網路放置位置,格式為URI. ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 --------- ## saveMenu 新增圖形選單 ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "area_opt": { "A":{"type": "text","data": "1"}, "B":{"type": "text","data": "2"}, "C":{"type": "text","data": "3"}, "D":{"type": "text","data": "4"} }, "chat_bar_text":"menu name", "image_height":1686, "image_width":2500, "image_type":"image/png", "layout":"B", "name":"test", "user_segment":"94c3b936-e1dc-11ed-b590-1ef7bce19ed4", "start_time": null, "end_time": "2024-03-06T14:10:00.000Z", "use_datetime_trigger": true, "open_menu": true, "tab_menu": [ { "name": "test1", "width": "1250", "yAxis": "0", "xAxis": "0", "height": "200" }, { "name": "test2", "width": "1250", "yAxis": "0", "xAxis": "1250", "height": "200" } ], "image_b64":"base64 string" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `area_opt` (object,required): 選單touch 事件範圍、依Layout 的選項目不同、共有 A, B, C. - `Layout A`: A\~F - `Layout B`: A\~D - `Layout C`: A\~C A\~F 格式如下: - `type` (object, required): - text - uri - `data` (string, required): 按下該區域對應的keyword. - `chat_bar_text` (string, required): 顯示於LINE頻道的選單名稱. - `image_height` (number,required): 圖片高. - `image_width` (number,required): 圖片寬.寬x高限制如下(pixels): - 2500 x 1686 - 1200 x 810 - 800 x 540 - `image_type` (string,required): 圖片類型. - image/png - image/jpeg - `layout` (string,required): Layout類型. - A: 代表area_opt 需有A~F 屬性 - B: 代表area_opt 需有A~D 屬性 - C: 代表area_opt 需有A~C 屬性 - `name` (string,required): 選單名稱. - `user_segment` (string, required): 套用於哪個用戶分類. - `open_menu`(boolean): LINE 頻道menu是否持續開啟狀態 - `use_datetime_trigger`(boolean): 是否使用時間切換LINE menu - `start_time` (string): LINE menu有效的套用時間開始、如果use_datetime_trigger=true的話、空白的情況下、只會參考`end_time` - `end_time`(string): LINE menu有效的套用時間結束、如果use_datetime_trigger=true的話 - `tab_menu`(object array): 如果tab_menu有設定的話、會在當下menu的作用區域`area_opt`之上再增加更高優先權的作用區域、當用戶按下該作用區域時、會切換到下列`name`對照的menu - `name`(string): menu 名稱 - `xAxis`(string): 圖片作用區域的x軸起點 - `yAxis`(string): 圖片作用區域的y軸起點 - `width`(string): 圖片作用區域的寬度 - `height`(string): 圖片作用區域的高度 - `image_b64` (string, required):base64編碼圖片. (參考[https://developers.line.biz/en/reference/messaging-api/#upload-rich-menu-image](https://developers.line.biz/en/reference/messaging-api/#upload-rich-menu-image)) ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 ---------- ## saveScenario **新增/更新對話設定** ### Request Body ``` json { "adminId": "0001", "accountId": "n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "scenario": { "scenarioId": "a324c456-be64-11ee-9326-de5eb83bcd1a", "scenarioName": "scenario name", "iconUrlId": "", "trigger": "keyword", "keywords": [ "keyword1" ] }, "nodes": [ { "type": "input", "level": "1", "condition_config": {}, "reservations_config": [], "nextScenario": "", "nextNode": "", "nodeId": "uhfdnektwyp-ylh7-0don-uhn2-ksp2d8eba8330", "nodeTag": [ { "name": "Lv1", "color": "bg-danger" } ], "sort": 1, "template": { "type": "bubble", "size": "giga", "body": { "contents": [ { "text": "123", "type": "text", "size": "md", "wrap": true } ], "layout": "vertical", "type": "box" } }, "flex_config": [], "title": "123", "subtitle": "", "error": 0, "userAction": { "userReply": { "variable": { "employee_count": { "name": "employee_count" } }, "validate": { "inputList": [ { "type": null, "value": "" } ], "success": { "nextNodeId": "", "scenarioId": "" }, "failed": { "nextNodeId": "", "scenarioId": "" } }, "encryption": false, "selectCompare": "", "lensCompare": [ { "value": "<", "label": "lessThan" }, { "value": ">", "label": "moreThan" }, { "value": "=", "label": "equal" } ] }, "emptyVariable": { "variable": {} } }, "nodeConst": { "ecsite": false, "chichatcatBox": false }, "externalApi": { "cros": { "enable": false, "responseSetting": { "success": { "nextNodeId": "", "scenarioId": "" }, "failed": {} }, "others": { "orderIdReplace": false } } }, "varForms": [], "datetimeTrigger": { "enable": false, "startTime": "", "endTime": "" } } ] } ``` - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `scenario` (object,required): 對話設定 - `scenarioId` (string, required): 對話宣告ID - `scenarioName` (string, required):對話宣告名稱 - `iconUrlId`(string, optional):該對話是永哪個一icon的iconId、請參考[#getIconUrl](#getIconUrl) - `trigger`(string,required):啟動方式 - selected: 手動發送 - keyword: 關鍵字 - follow: 用戶加入 - error: 錯誤訊息 - `keywords`(string array,optional):關鍵字、如果trigger選擇keyword才需要填寫. - `nodes` (object array, required): - `nodeId`(string,required): 隨機產生 UUID - `type`(string,required) 類型 - condition - 條件 - fb_generic - Facebook Generic Template - flex - Flex Message - imagemap - Rich Message - image - Image Message - input - Bold text - sticker - 貼圖 - text - Text Message - video - Video Message - `title`(string,required) 標題 - `level`(string,required) 對話的幾個節點 - `sort` (int,required) 排序 - `nodeTag` (object array,opational) 標籤、請參考[#getTag](#getTag) - `color` (string) 標籤顏色 - `name` (string) 標籤名稱 - `template`(object,required) 依照type的不同、有不同的格式、下列一一列出不同type的格式 - `type`(string,required): - bubble - sticker - imagemap - image - `template`=bubble, Flex Message、日期與時間、快速回復 - `type` bubble 根據message格式直接放入LINE FlexMessage 的Json結構([說明](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)) 快速回復請參考文件[說明](https://developers.line.biz/en/docs/messaging-api/using-quick-reply/#set-quick-reply-buttons) - `template`=sticker, 貼圖 - `type` sticker - `packageId`(string,optional)貼圖packageId、請參考LINE[說明](https://developers.line.biz/en/docs/messaging-api/sticker-list/#send-sticker) - `stickerId`(string,optional)貼圖stickerId - `template`=imagemap, RichMessage - `type` imagemap - `layout`(string,required) 版型共有A~E - `baseUrl`(string, required) 圖片網址 - `altText` (string,required) RichMessage標題 - `baseSize` (object,required) 圖片尺寸 - `width`(string,required) 固定為1040 - `height`(string,required) 固定為1040 - `areaOptions`(object array, required) 圖片各點擊範圍回傳文字 - `type`(string,required) 回傳類型 - uri 網址 - message 文字 - `label` (string,required) 對應區塊代碼 - layout A: A - layout B: A|B - layout C: A|B - layout D: A|B|C - layout E: A|B|C|D - `url` (string,required) 回傳網址 - `text`(string, required) 回傳文字 - `template`=image, 圖片/影片訊息 - `type` (string,required) 圖片或影片 - image - video - `originalContentUrl`(string, required) 原始圖檔或影音 - `previewImageUrl`(string,required) 預覽圖檔 - `template`=text, Text Message - `type` text - `text`(string, required) 輸入的文字 - `emojis` (object,required) LINE emoji系統、請參考([說明](https://developers.line.biz/en/docs/messaging-api/emoji-list/#specify-emojis-in-message-object)) - `index`(integer,required) 顏文字編號 - `productId`(string,required) LINE emoji productId - `emojiId`(string,required) LINE emojiId - `subtitle`(string) 副標題 - `nextNode`(string) 繼續發送的下個node的nodeId - `nextScenario`(string) 繼續發送的下個Scenario的ScenarioID - `reservations_config`(object array,optional) 預約發送設定 - `scenario_id`(string,required) 預約發送預計發送的Scenario ID - `reservationtime`(integer,required) 距離多少時間後發送、單位:分鐘 - `window`(object,required) 發送區間 - `start`(string, required) 發送開始時間(分:秒) - `end` (string, required) 發送開始時間(分:秒) - `condition_config` (object,optional) 多重條件 - `config_url`(string,required) 條件類型 - 輸入的網址 - URL - bysegment - 用戶分類 - bytag - 多重條件 - `options`(object array, required) - `value`(string,optional) 比對值 - `scenario_id`(string,optional) 比對成功後、轉移到的Scenario ID - `nextNodeId`(string,optional) 比對成功後、轉移到的Node ID - `nextnodeType`(string,required) scenario或node - snode - scenario - nnode - node - `multi_condition`(object array,required) - `source` (string,required) 比對來源 - tag - 標籤 - uservariable - 使用者變數 - followtime - 加入好友時間 - cvkey - CV參數 - `tag` (string, optional) 標籤 (沒選擇時會變成empty string) - `name`(string,required) 標籤名稱 - `color`(string,required) 標籤顏色 - `value`(string, optional) 比對值 - `uservariable`(object,optional) 要比對的變數 - `name`(string,required) 變數名稱 - `range`(object, optional) 比對範圍、expression選擇num_range/date_range使用 - `start` (string or date,optional) 開始值或日期 - `end` (string or date, optional) 結束值或日期 - `expression`(string,required) 比對方式 - exactly_match - 完全一致 - fuzzy_match - 部分一致 - has_value - 有值 - no_value - 沒有值 - num_range - 數值範圍 - num_gt - 大於數值 - num_lt - 小於數值 - date_range - 日期區間 - `flex_config` (object array,optional) Flex Message 格式變數對應、格式範例[說明](https://developers.line.biz/en/docs/messaging-api/using-flex-messages/)[格式編輯器](https://developers.line.biz/flex-simulator/) - `replacement_str`(string,required) Flex Message 裡面對應動作的keyword - `scenarioId`(string,required) 動作的下一個scenario - `tag` (object,optional) 動作的行為是否記錄到標籤 - `color`(string, optional) 標籤顏色 - `name`(string,optional) 標籤名稱 - `tagValue` (string, optional) 標籤值 - `userVars` (string array, optional) 變數值 - `userAction`(object,optional) - `userReply`(object,required): 使用者回覆 - `variable`(object,required) 使用這回覆儲存的變數 - `var_name`(object,required) 變數字串, var_name = 選擇的變數名稱 - `name`(string,required) 變數名稱 - `validate`(object,required) 資料輸入結果、比方應該輸入integer卻輸入string - `inputList`(object array,required) - `type`(string, required) 變數型態 - Eng - 英文 - Num - 數字 - Len - 字數 - RegExp - 正規表達式 - Phone - 電話號碼 - Post - 郵遞區號 - City - 縣市名稱 - `success` - `nextNodeId`(string,required) 成功後轉移的Node ID - `scenarioId`(string,required) 成功後轉移的Scenario ID - `failed` - `nextNodeId`(string,required) 失敗後轉移的Node ID - `scenarioId`(string,required) 失敗後轉移的Scenario ID - `encryption`(boolean,required) 是否加密 - `selectCompare` (string,required) 比對條件 - lessThan - 大於 - moreThan - 小於 - equal - 等於 - `lensCompare`(object array,required) 沒有意義 - `emptyVariable`(object,required) 變數消除 - `variable`(object,required) 要消除的變數 - `var_name`(object,required) 變數字串, var_name = 選擇的變數名稱 - `name`(string,required) 變數名稱 - `nodeConst`(object,required) - `ecsite`(boolean) - `chichatcatBox`(boolean) - `externalApi` (object) 外部api連接設定 - `cors`(object,required) - `enabled`(boolean,required) 是否啟用 - `responseSetting`(object,required) 設定 - `success`(object,required) 成功的情況 - `nextNodeId`(string,required) 設定下一個nodeID - `scenarioId`(string,required) 或者設定scenariodId - `failed`(object,required) 失敗的情況 - `nextNodeId`(string,required) 設定下一個nodeID - `scenarioId`(string,required) 或者設定scenariodId - `others`(object,required) - `orderIdReplace`(boolean,required) OrderId文字取代啟用 - `varForms` (array,optional) - `datetimeTrigger` (object,optional) 觸發區間、該設定的node 只會在區間內能被使用 - `enable`(boolean,required) 預設false - `startTime`(datetime,optional) 開始時間 - `endTime`(datetime,optional) 結束時間 - `nodeConst` - `error`(integer,required): 預設0 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 ---------- ## saveScenarioApi (可能失效) #### 最後呼叫時間為2022-11-02 19:10:12 (UTC+08:00)、目前已找不到開發工程師 ---------- ## saveTag **儲存標籤** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "tag":{ "color":"red-filter", "name":"tag name", "values":[ "tag value" ] } } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `tag` (object,required): - `color` (string,required): 顏色代稱 - bg-danger - red-filter - pink-filter - orange-filter - bg-warning - yellow-filter - bg-success - dark-green-filter - green-filter - bg-info - teal-filter - primary-filter - blue-filter - skyblue-filter - darkpurple-filter - purple-filter - bg-secondary - grey-filter - `name`(string,required): 標籤宣告名稱 - `values` (string array,required): 標籤值. ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 ---------- ## saveUserSegment **儲存用戶分類** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "cvKey":{}, "defaultUsersSegment":false, "mode":"Custom", "segmentConditions":[], "segmentName":"segmentName", "segmentUsers": [{ "accountStatus":"1", "accountType":"line", "createTime":"2023-05-25 01:18:53.287", "followTime":"2023-05-25 01:18:53.287", "userId":"U4d86ea5943e3bf692fd09065ff8c4f84", "userName":"ChatAnnie", "userPicture": "https://sprofile.line-scdn.net/0hewfBxPWCOlhLOyhsmkBEJztrOTJoSmNKM1Rybn5vZGAkD38JY1smbHxpYzt-C3tZMAlzN3g9Nz1HKE0-VW3GbEwLZG9xCnUJZlV0vg" }] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `cvKey` (object,required): - `orderId`(string,required): CV專有訂單編號 - `defaultUsersSegment`(boolean,required):是否使用預設用戶分類、true的話不須設定segmentConditions、segmentUsers - `mode`(string,required):條件模式 - Custom - 自訂群組 - CVKey - CV參數 - Conditions - 多重條件 - `segmentConditions`(array object, required) - `expression`(string,required): 比對方式 - exactly_match - 完全一致 - fuzzy_match - 部分一致 - has_value - 有值 - no_value - 沒有值 - num_range - 數值範圍 - num_gt - 大於數值 - num_lt - 小於數值 - date_range - 日期區間 - `source`(string,required): 條件類型 - tag - 標籤 - uservariable - 使用者變數 - followtime - 加入好友時間 - cvkey - CV參數 - serverpushtime - 伺服器推播 - cros - CROS(失效) - `value`(string,required): 比對值 - `cors`(object,optional): (失效) - `range`(object,optional):當expression使用num_range或date_range時 - `start`(string,optional) 範圍開始 - `end`(string,optional) 範圍結束 - `tag`(object,optional):標籤比對條件 - `name`(string,required) 顏色名稱、可以從getTag API取得 - `color`(string,required) 顏色名稱、可比對文件saveTag - `uservariable`(object,optional): 使用者變數、可從getVariable API 取得 - `segmentName`(string,required):用戶分類宣告名稱 - `segmentUsers`(object,optional):用戶比對條件 - `accountStatus`(string,required):用戶狀態 - `accoutType`(string,required):用戶來源類型 - line - wechat - fb - `createTime`(string,required):用戶加入時間 - `followTime`(string,required):用戶追蹤時間 - `userId`(string,required):用戶SNS提供的ID - `userName`(string,required):用戶SNS提供的名稱 - `userPicture`(string,required):用戶SNS提供的圖片 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 ---------- ## saveVariable **儲存變數** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "accountVariable":["var2"] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `accountVariable` (string array,required): 變數陣列 ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 ---------- ## scheduleBroadcast **儲存變數** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "broadcastName":"broadcastName", "broadcastScenarioId":"22b0cc7e-26a3-11ee-90ac-a698574f3611", "broadcastScenarioName":"01_營業稅申報", "broadcastStatus":"pending", "broadcastTime":"2024-01-23 03:25:00", "broadcastUsers":[ { "accountType":"line", "userId":"Ucca1dab9cdaa6abf621f352b6a20e24b", "userName":"Rex曾" } ], "isSelectAll":false, "segmentNames":[] } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID - `broadcastName` (string,required): 發送對話宣告名稱 - `broadcastScenarioId`(string,required):對話ID - `broadcastScenarioName`(string,required):對話名稱 - `broadcastStatus`(string,required):對話狀態、永遠都是pending - `broadcastTime`(string,required): 預約發送時間 - `broadcastUsers`(object array,optional):接收用戶, 如果isSelectAll=true時不用填寫 - `accountType`(string,required): 用戶類型 - line - wechat - fb - `userId`(string,required):用戶SNS ID - `userName`(string,required):用戶SNS名稱 - `isSelectAll`(boolean,required):是否全選所有用戶 - `segmentNames`(string array, optional):segment名稱陣列、如果選擇用戶分類發送時(請參考前端操作) ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): 操作結果 ---------- ## scheduleUsersImport (失效) ---------- ## updateAccount **更新Account** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "accountIcon":"https://i.imgur.com/q1KqEZ1.png", "accountName":"明日網會計師事務所", "accountSecret":"f24885ed52f0dedc9ad79f3041ba907f", "accountToken":"S3cAovZabe572qbEGR/xz9RiFZtV4wSRaWMOgDtjxeaBlibK3Q1FsEgP52E2YO6+EBl0sZj2M5UWE8AWghbQZaejSFMNLXmfg40r2+b8/a+eeSIF5o8sNyLD4aNP274gacg9/bY4NLsgo5NaWBo5lgdB04t89/1O/w1cDnyilFU=", "accountType":"line", "accountWebhookUrl":"https://dev.chatannie.com/api/LineMessage/send?adminid=0001&accountid=n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "lineLoginChannelId":"", "lineLoginSecret":"" } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID、需自行產生UUID碼、需唯一. - `accountIcon` (string, required) - 帳號圖片連結 (ex: [https://i.imgur.com/aitiO6X.pngEndFragment](https://i.imgur.com/aitiO6X.pngEndFragment)). - `accountName` (string, required) - 帳號名稱. - `accountToken` (string, required) - SNS連結的Token. - `accountSecret` (string, required) - SNS連結的Secret. - `accountType` (string, required) - 帳號類型 - line - wechat - fb - `accountWebhookUrl` (string, required) - 社群帳號連結到chatannie 綁定的webhook url. - `lineLoginChannelId` (string, optional): LINE Login In Channel ID、取得LIFF ID使用 - `lineLoginSecret` (string,optional):LINE Login In Channel Secret、取得LIFF ID使用 參考: lineLoginChannelId, lineLoginSecret [說明](https://developers.line.biz/en/docs/line-login/getting-started/#step-2-deploy-starter-app) ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok", "Result": null } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息", "Result": null } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" - `Result` (object): null --- ## updateAccountExternalApiConfig **更新聯動信息設定** ### Request Body ``` json { "adminId" : "0001", "accountId":"n4ud3h8n6-a9oa-l6f2-ct2i-555d20fb04c436", "setting":{ "cros":{ "clientId":"clientId", "endPoint":"endPoint", "key":"key", "params":{ "value":"employee_count" } } } } ``` #### 說明 - `adminId` (string, required): ChatAnnie平台登入帳號. - `accountId` (string, required): 頻道ID、需自行產生UUID碼、需唯一. - `setting` (object): 設定CROS設定. - `cros` cros專用設定 - `endpoint`(string):cros 連結網址 - `key`(string):依據帳號不同來填入cros給予的value - `clientId`(string):依據帳號不同來填入cros給予的value - `params`(object): 用於使用user variable收集到的資訊來做為連接cros的Parameter - `key`: `value` ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok" } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息" } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" ---------- ## userSegmentRegisterViaLiff **LIFF 管道機制避免未完成管道加入流程暫存使用** ### Request Body ``` json { "token" : "eydhZG1pbklkJzogJzAwMDEnLCAnYWNjb3VudElkJzogJzN5NWZqMDVvbWh3LWgzdWktNDlpOS10cjd2LWl0czE0OTk0M2U1NTEzJywgJ3NlZ21lbnRJZCc6ICc1ODg2NWY0ZS1hYWFiLTExZWUtOTU1MS00YTg5MjgyMTJhZmEnfQ==.KmGveYt949-PD5qjvogF5qTM2MQ=", "userId":"U865b0549c66640790ecee3d46c520cee" } ``` #### 說明 - `token` (string, required): "adminId","accountId","segmentId"編碼成一個token. - `userId` (string, required): 戶用SNS ID ### Response #### Success ``` json { "ErrorCode": 200, "ErrorMessage": "ok" } ``` #### Fail ``` json { "ErrorCode": 400 | 401, "ErrorMessage": "錯誤訊息" } ``` #### 說明 - `ErrorCode` (number): 回傳代碼 - 200 Success - 400 Fail - 401 Fail - `ErrorMessage` (string): 錯誤訊息 - 200 "ok" - 400 依據錯誤情況回傳不同錯誤訊息 - 401 "Unauthorized" # 其他API ## api/penglue/send **pengluewebhook:人人把訂單的紀錄寫回chatannie** ### Request Params ``` json { "orderId": 12335, "productId": "", "pscenario": 12345, "cvdate": "2024-01-02", "token": "Qm9xWVB5VDFRVzN1LWZhSVhOYWNPOWhOWi1Gdl9ZeWhHMEpEYkFwNzE4cmM4eUE0ZGlFOXZWNi1ydnRaaU1zRHhyR0V4b01HTW91QjF2WlpSQ2xaVW1aMVJPejZDWFQ3YVNGY05yNGV5UE40SG5UT3ZqWDVHekRSNXRNblRFMTlJTHBqNHhhaHg0anJCZ3ppbzFHdmMtem1PSWdFblBNUnF5aXNTYzlGblAtdnd0MU9ySzh2YlZvNVJoeVpsVVZGN1o2RjAzZFVxY3JuRmN6ZEpBY2VVZjZZM1o1X3p3ai1RRGNRN2hxdlZvbXpEOGMzaW5mbV95WmJORDhTOFo3aUFsQjlLUTBteHJMd2Q1Tk94cjNjSWw1R1dwcnR1UDM2ajdhTEdVc0cycjVJNXFNWjBxWW1hNmVWWWRNOGMtTGNRNjdQOFJhdmNuZnhlTklMMHlySlB2dlhSRURmM0N1VlV4MEhfeGFSN3BMdkRaTk5Za2dycFNBbW1yU2tsNGpHMXYzRzlrWmczTHNpakR2ZmtIMU1VQUVmY1prekxWQS1uZzh0Wll1bFctbz0%3D" } ``` #### 說明 - `orderId` (string, required) 訂單ID - `productId` (string, required) 產品ID - `pscenario`(string, required) Scenario Name - `cvdate`(string, required) 訂單日期 - `token`(string,required) 帶有以下資訊的token - lid - LINE ID - nodeid - 對話裡的node ID - senarioid - 對話Scenario ID - adminId (string, required): ChatAnnie平台登入帳號. - accountId (string, required): 頻道ID ### Response #### Success ``` json {} ``` #### Fail ``` string "Already Exist" ``` #### 說明 如範例所示 ## api/chichatcat/send **chichatcatwebhook:人人把訂單的紀錄寫回chatannie** ### Request Params ``` json { "orderId": 12335, "productId": "", "pscenario": 12345, "cvdate": "2024-01-02", "token": "Qm9xWVB5VDFRVzN1LWZhSVhOYWNPOWhOWi1Gdl9ZeWhHMEpEYkFwNzE4cmM4eUE0ZGlFOXZWNi1ydnRaaU1zRHhyR0V4b01HTW91QjF2WlpSQ2xaVW1aMVJPejZDWFQ3YVNGY05yNGV5UE40SG5UT3ZqWDVHekRSNXRNblRFMTlJTHBqNHhhaHg0anJCZ3ppbzFHdmMtem1PSWdFblBNUnF5aXNTYzlGblAtdnd0MU9ySzh2YlZvNVJoeVpsVVZGN1o2RjAzZFVxY3JuRmN6ZEpBY2VVZjZZM1o1X3p3ai1RRGNRN2hxdlZvbXpEOGMzaW5mbV95WmJORDhTOFo3aUFsQjlLUTBteHJMd2Q1Tk94cjNjSWw1R1dwcnR1UDM2ajdhTEdVc0cycjVJNXFNWjBxWW1hNmVWWWRNOGMtTGNRNjdQOFJhdmNuZnhlTklMMHlySlB2dlhSRURmM0N1VlV4MEhfeGFSN3BMdkRaTk5Za2dycFNBbW1yU2tsNGpHMXYzRzlrWmczTHNpakR2ZmtIMU1VQUVmY1prekxWQS1uZzh0Wll1bFctbz0%3D" } ``` #### 說明 - `orderId` (string, required) 訂單ID - `productId` (string, required) 產品ID - `pscenario`(string, required) Scenario Name - `cvdate`(string, required) 訂單日期 - `token`(string,required) 帶有以下資訊的token - lid - LINE ID - nodeid - 對話裡的node ID - senarioid - 對話Scenario ID - adminId (string, required): ChatAnnie平台登入帳號. - accountId (string, required): 頻道ID ### Response #### Success ``` json {} ``` #### Fail ``` string "Already Exist" ``` #### 說明 如範例所示