用戶標籤
本教學將說明如何透過 API 來操作 BotBonnie 平台的標籤,包含建立 / 刪除標籤和標籤資料夾,以及如何將標籤貼到用戶身上等。
在您的伺服器呼叫 BotBonnie 建立標籤的 API:
POST https://api.botbonnie.com/v1/api/tag/autogen
Name | Description |
Content-Type | application/json |
Authorization | Bearer {API Token} |
Name | Type | Description | Required |
botId | String | 機器人 ID | o |
name | String | 標籤名稱 | o |
type | Number | 標籤類型 0 :用戶標籤1 :標籤資料夾 | o |
parentId | Number | 標籤資料夾 ID | |
{
"res": "{
"id": "tag-xxxxxx" //建立成功之標籤 ID
}",
"status": 200
}
{
"errorMessage": "...",
"errorCode": 500
}
在您的伺服器呼叫 BotBonnie 取得標籤的 API:
GET https://api.botbonnie.com/v1/api/tag/{{tagID}}
Name | Description |
tagId | 欲查詢的標籤或是標籤資料夾 ID |
Name | Description |
Content-Type | application/json |
Authorization | Bearer {API Token} |
{
"res": {
"created": 1583983892294, // 標籤建立時的 UNIX 時間戳記(毫秒)
"id": "tag--PTfLM4wQ", // 標籤 ID
"name": "測試API標籤 child", // 標籤名稱
"botId": "bot-WDCLEHlTw", // 機器人 ID
"type": 0 // 標籤類型
},
"status": 200
}
在您的伺服器呼叫 BotBonnie 刪除標籤的 API,刪除標籤時,也會同時拔除所有用戶身上的該標籤紀錄。當刪除的標籤為資料夾,會將其資料夾下的標籤與子資料夾一併刪除。
DELETE https://api.botbonnie.com/v1/api/tag/{{tagID}}
Name | Description |
tagId | 欲刪除的標籤或是標籤資料夾 ID |
Name | Description |
Content-Type | application/json |
Authorization | Bearer {API Token} |
{
"res": [
"tag--PTfLM4Q"
], // 此陣列中包含所有被刪除的標籤 ID 與標籤資料夾 ID
"status": 200
}
在您的伺服器呼叫 BotBonnie 用戶標籤 API:
POST https://api.botbonnie.com/v1/api/user/tag
Name | Description |
Content-Type | application/json |
Authorization | Bearer {API Token} |
Name | Type | Description | Required |
bot_tag_id | String | 標籤 ID | o |
bot_uid | String | 用戶 ID (加密) | 與 bot_raw_uid 擇一 |
bot_raw_uid | String | 用戶 ID (未加密) | 與 bot_uid 擇一 |
bot_pid | String | 粉絲頁 ID | o |
bot_channel | Number | 渠道代號
0 :Facebook
1 :LINE | o |
在您的伺服器呼叫 BotBonnie 用戶標籤 API:
DELETE https://api.botbonnie.com/v1/api/user/tag
Name | Description |
Content-Type | application/json |
Authorization | Bearer {API Token} |
Name | Type | Description | Required |
bot_tag_id | String | 標籤 ID | o |
bot_uid | String | 用戶 ID (加密) | 與 bot_raw_uid 擇一 |
bot_raw_uid | String | 用戶 ID (未加密) | 與 bot_uid 擇一 |
bot_pid | String | 粉絲頁 ID | o |
bot_channel | Number | 渠道代號
0 :Facebook
1 :LINE | o |
{
"res": "ok",
"status": 200
}
{
"errorMessage": "...",
"errorCode": 500
}
在您的伺服器呼叫 BotBonnie 用戶標籤 API:
POST https://api.botbonnie.com/v1/api/user/taglist
Name | Description |
Content-Type | application/json |
Authorization | Bearer {API Token} |
Name | Type | Description | Required |
bot_uid | String | 用戶 ID (加密) | 與 bot_raw_uid 擇一 |
bot_raw_uid | String | 用戶 ID (未加密) | 與 bot_uid 擇一 |
bot_pid | String | 粉絲頁 ID | o |
bot_channel | Number | 渠道代號
0 :Facebook
1 :LINE | o |
{
"res":[
{
"bot_uid":"53f224d55bd378237ad26dd0d79002f7206527ab1e91bd3d84bf05c9c6ac761291",
"bot_raw_uid":"U21ab30ccce78feb456048adeb80cf00a",
"bot_pid":"test_audi",
"bot_channel":1,
"tags":[
{
"id": "tag-4TbbFavFY",
"name": "標籤A",
"timestamp": 1540869097545
},
{
"id": "tag-Aw3IcRKNt",
"name": "標籤B",
"timestamp": 1540869134405
},
{
"id": "tag-bcpe7NStr",
"name": "標籤C",
"timestamp": 1540869152985
}
]
}
]
,"status":200
}
Last modified 3yr ago