For the complete documentation index, see llms.txt. This page is also available as Markdown.

聯絡人

列出聯絡人

GET /api/v1/contacts/

參數

參數名稱
必填
類型
說明

channels

array

Multiple values may be separated by commas.

inbox

string

Deprecated: Use inboxes instead

inboxes

string

對話平台 ID (用於過濾特定 inbox 的聯絡人)

page

integer

A page number within the paginated result set.

pageSize

integer

Number of results to return per page.

query

string

姓名或來源ID搜尋

search

string

全文搜尋

tags

array

Multiple values may be separated by commas.

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/contacts/?channels=example&inbox=550e8400-e29b-41d4-a716-446655440000&inboxes=example&page=1&pageSize=1&query=example&search=example&tags=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/contacts/?channels=example&inbox=550e8400-e29b-41d4-a716-446655440000&inboxes=example&page=1&pageSize=1&query=example&search=example&tags=example", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });

回應內容

狀態碼: 200

回應結構範例

回應範例值


建立聯絡人

POST /api/v1/contacts/

程式碼範例

回應內容

狀態碼: 201

回應結構範例

回應範例值


取得聯絡人詳情

GET /api/v1/contacts/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Contact.

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


取得聯絡人詳情

GET /api/v1/contacts/bulk-import-template/

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


取得聯絡人詳情

GET /api/v1/contacts/connector-management/

程式碼範例

回應內容

狀態碼
說明

200

No response body


更新聯絡人

PUT /api/v1/contacts/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Contact.

請求內容

請求參數

欄位
類型
必填
說明

name

string

聯絡人姓名

inboxes

array[object]

對話平台列表(新版格式)

inbox

object

單一對話平台(舊版格式,向前相容)

inbox.id

string (uuid)

對話平台 ID

avatar

string

頭像URL

sourceId

string

來源ID

queryMetadata

string

查詢元資料

metadata

array[object]

自訂聯絡人屬性列表

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


部分更新聯絡人

PATCH /api/v1/contacts/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Contact.

請求內容

請求參數

欄位
類型
必填
說明

name

string

聯絡人姓名

inboxes

array[object]

對話平台列表(新版格式)

inbox

object

單一對話平台(舊版格式,向前相容)

inbox.id

string (uuid)

對話平台 ID

avatar

string

頭像URL

sourceId

string

來源ID

queryMetadata

string

查詢元資料

metadata

array[object]

自訂聯絡人屬性列表

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


刪除聯絡人

DELETE /api/v1/contacts/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Contact.

程式碼範例

回應內容

狀態碼
說明

204

No response body

400

聯絡人還有關聯的對話,無法刪除


取得聯絡人的對話列表

GET /api/v1/contacts/{id}/conversations/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Contact.

channels

array

Multiple values may be separated by commas.

inbox

string

按單一 inbox ID 過濾(UUID 格式)

inboxes

string

按多個 inbox IDs 過濾(逗號分隔,如:uuid1,uuid2 或使用多個 inboxes 參數)

keyword

string

搜尋對話中的訊息內容(不區分大小寫)

page

integer

A page number within the paginated result set.

pageSize

integer

Number of results to return per page.

query

string

tags

array

Multiple values may be separated by commas.

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


取得聯絡人最新對話

GET /api/v1/contacts/{id}/conversations/latest/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this Contact.

inbox

string

按單一 inbox ID 過濾(UUID 格式)

inboxes

string

按多個 inbox IDs 過濾(逗號分隔,如:uuid1,uuid2 或使用多個 inboxes 參數)

keyword

string

搜尋對話中的訊息內容(不區分大小寫)

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值

狀態碼: 404 - No response body


群發訊息

POST /api/v1/contacts/broadcast-message/

請求內容

請求參數

欄位
類型
必填
說明

contactIds

array[string]

[正向指定模式] 要發送訊息的 contact ID 列表

inboxId

string (uuid)

[反向排除/全部發送模式] Inbox ID,會發送給該 inbox 下的所有 contacts

excludeContactIds

array[string]

[反向排除模式] 要排除的 contact ID 列表,需配合 inbox_id 使用

message

string

要發送的訊息內容

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


Last updated

Was this helpful?