## Get public Token
<details>
<summary>
<b><code>GET</code> /api/public/getPublicTokenBombot</b>
</summary>
- Authorization: `Bearer {tokenBombot}`
- Description: This endpoint is used to get a public token for the Bombot API. The token is required for accessing certain endpoints in the API
- Response:
```json
{
token: "string" || null
}
```
</details>
## Customers
<details>
<summary>
<b><code>GET</code> /api/public/customers</b>
</summary>
- Description: This endpoint is used to get a list of customers
- Query Parameters:
- `page`: The page number to retrieve (default: 0)
- `size`: The number of customers to retrieve per page (default: 10)
- `search`: A search term to filter customers
- `sort`: The field to sort the customers by (default: "lastInboxTime,desc")
- Response:
```json
{
"content": [
// Array of customer objects
],
"pageable": {
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"offset": 0,
"pageNumber": 0,
"pageSize": 10,
"unpaged": false,
"paged": true
},
"totalElements": 0,
"totalPages": 0,
"last": false,
"first": true,
"size": 10,
"number": 0,
"numberOfElements": 0,
"empty": false,
"totalMatch": 0,
"totalPagesMatch": 0
}
```
- Additional infomation:
- `search` guide: Concat one or more of the following conditions with `;`:
```
<key>==<value> : Equal
<key>!=<value> : Not equal
<key>=contains=<value> : Contains
<key>=notcontains=<value> : Not contains
<key>=in=<value1>,<value2>,<value3> : In one or more values
<key>=notin=<value1>,<value2> : Not in one or more values
Example:
1. search=pageId==123456789;gender==MALE;bombotTags=in=444,222
2. search=pageId==123456789;name=contains=Dang;otherTags.system==cloudgo;otherTags.tags=in=123,456
```
</details>
<details>
<summary>
<b><code>PATCH</code> /api/public/customers</b>
</summary>
- Description: This endpoint is used to update a customer (name, phone, otherTags)
- Request Body:
```json
{
"identity_type": "string",
"pageId": "string",
"system": "string",
"inputs": [
// Array of input objects
]
}
```
- Response:
```json
{
"total": 0 // Total number of customers updated
}
```
- Additional information:
- `identity_type`: Type of identity to identify the customer.
- PSID: psid from facebook
- UID: uid from facebook
- CONVERSATIONID: conversation_id from facebook
- ID: id from Bombot
- PHONE_NAME: phone and name from Bombot
- Each request can only update with one identity_type. For example, if you want to update customers by `psid`, you must set `identity_type` to `PSID` only.
- inputs: Array of objects customer with value to update. Customers must be identified by `identity_type`.
```json
"inputs": [
{
"psid": "28298582559789822",
"otherTags": ["tag1", "tag2"]
},
{
"psid": "9790325140996218",
"otherTags": ["tag1"]
}
]
```
</details>
## Fanpages
<details>
<summary>
<b><code>GET</code> /api/public/fanpages/:id/tags</b>
</summary>
- Description: This endpoint is used to get a list of tags for a specific fanpage
- Path Parameters:
- `id`: The ID of the fanpage
- Response:
```json
{
"bombotTags": [
// Array of bombot tag objects
],
"fbTags": [], // Array of fb tag objects
"otherTags": [
// Array of other tag objects
{
"system": "pancake",
"tags": [
{
"id": 1,
"name": "Tag1",
"color": "#b593f"
},
]
}
]
}
```
</details>
<details>
<summary>
<b><code>PUT</code> /api/public/fanpages/:id/tags</b>
</summary>
- Description: This endpoint is used to update only otherTags for a specific fanpage
- Path Parameters:
- `id`: The ID of the fanpage
- Request Body:
```json
{
"otherTags": {
"system": "cloudgo",
"tags": [
{
"id": 1,
"name": "Kiểm thử",
"color": "#b593f" // Optional. If not provided, random color will be used
}
]
}
}
```
- Response:
```json
{
"otherTags": [
// Array of other tag objects
]
}
```
</details>