通过 API 进行会话中身份验证

本页介绍了如何在 SDK 渠道中使用通话和聊天 API 端点进行会话中身份验证。

用户无需进行身份验证即可开始支持会话(例如支持聊天)。当需要进行最终用户身份验证时,您可以启动身份验证流程。成功进行身份验证后,您可以更新 end_user 标识符,以将相应会话与经过验证的最终用户相关联。

URI 和身份验证

此新端点的基本 URI 因 comm_type 而异。

对于 call comm_type:

POST https://<subdomain>.<domain>//apps/api/v1/calls/:call_id/end_user

对于 chat comm_type:

POST https://<subdomain>.<domain>//apps/api/v1/chats/:chat_id/end_user

API 操作

参数

API 请求的正文应包含以下字段:

ID 字段名称 类型 是否必需? 说明 示例值
0 identifier 字符串 提供了唯一的外部标识符。
1 name 字符串 与互动关联的通用名称或标识符。有助于客户查找。 John Doe
2 email 字符串 与互动关联的通用电子邮件地址。有助于客户查找。 john@doe.com
3 phone 字符串 与互动相关联的通用手机号码。有助于客户查找。 123-456-7890

API 示例

API 响应示例

成功响应示例:

202 Accepted

{
 "message": "accepted"
}

失败响应示例

缺少参数
400 {"message": "param is missing or the value is empty: comm_type"}
400 {"message": "param is missing or the value is empty: identifier"}
引用了通话或聊天以外的通信类型
404 {"message": "Not Found"}
会话未处于活跃状态
400 {"message": "Call is already ended"}
400 {"message": "Chat is already ended"}
不受支持的 CRM 请求
400 {"message": "Unsupported CRM request"}
重复请求
400 {"message": "Duplicate request: Please wait for the interval to expire"}

API 请求示例

通话通信类型

POST https://<subdomain>.<domain>/apps/api/v1/calls/:call_id/end_user
Content-Type: application/json
Authorization: Bearer <your_access_token>

{
    "identifier": "unique_external_id",
    "name": "John Doe",
    "email": "johndoe@example.com",
    "phone": "123-456-7890"
}

聊天通信类型

POST https://<subdomain>.<domain>/apps/api/v1/chats/:chat_id/end_user
Content-Type: application/json
Authorization: Bearer <your_access_token>

{
    "identifier": "unique_external_id",
    "name": "Jane Smith",
    "email": "janesmith@example.com",
    "phone": "098-765-4321"
}

应用 API 文档

如需了解其他应用 API 端点,请参阅 Apps API 发布