任务
创建并分配任务
域名
请求路由
请求方式
请求头
- Content-Type: application/json
- Authorization: Bearer a06b3b2d7f762....
请求参数
请求参数列表
| 参数名 |
类型 |
必填 |
描述 |
| name |
string |
是 |
任务名称,限256字符 |
| description |
string |
否 |
任务描述,限256字符 |
| type |
int |
是 |
任务类型,这里固定为3(消息任务类型) |
| auth_id |
int |
是 |
incs开通的 whatsapp 授权id |
| user_phone |
string |
是 |
任务对象手机号,必须是区号开头的纯数字格式,例如:"6281512341234" |
| user_name |
string |
否 |
任务对象名称 |
| assignee_username |
string |
是 |
任务被分配人账号 |
| task_module_info |
object |
否 |
任务聊天窗口展示信息的定制化展示,见下述示例 |
请求示例
{
"name": "by api",
"type": 3,
"auth_id": 30058,
"description": "123",
"user_name": "路人A",
"user_phone": "6281512345678",
"assignee_username": "incs_1",
"task_module_info": {
"module_id": "019d3dcd-f5a8-70e7-aff8-c54bde267f38", // 定制模块ID,该模块类型固定传此ID
"total_amount": "20000.00",
"orders": [
{
"order_number": "WD20260401001",
"username": "张三",
"phone_number": "13800138000",
"loan_amount": "",
"due_amount": "",
"next_due_date": "2026-04-15",
"confirm_loan_time": "2026-03-01 10:00:00"
},
{
"order_number": "WD20260401002",
"username": "李四",
"phone_number": "13900139000",
"loan_amount": "3000",
"due_amount": "1500",
"next_due_date": "2026-04-20",
"confirm_loan_time": "2026-03-10 14:30:00"
}
]
}
}
响应
成功响应示例
{
"status": "success",
"code": 200,
"message": "",
"data": {
"id": 239, // 任务id
"creation_id": 106, // 任务批次id
"auth_id": 30058,
"name": "test api 1",
"description": "2sfsdfsdfd",
"type": 3,
"user_name": "路人B",
"user_phone": "6281512340001",
"assignee_username": "incs_1",
"conversation_id": 1023, // 分配的会话id
"status": 0,
"created_at": "2026-04-16 17:44:48",
"updated_at": "2026-04-16 17:44:51",
"logs": []
},
"error": {}
}
失败响应示例
{
"status": "error",
"code": 400,
"message": "User is in an incomplete task.", // 用户被分配任务还未完成
"data": {},
"error": {}
}
获取任务列表
域名
请求路由
请求方式
请求头
- Content-Type: application/json
- Authorization: Bearer a06b3b2d7f762....
请求参数
请求参数列表
| 参数名 |
类型 |
必填 |
描述 |
| task_id |
int |
否 |
查询任务id |
| creation_id |
int |
否 |
查询任务批次id |
| type |
int |
否 |
查询任务类型 |
| status |
int |
否 |
查询任务状态:0未开始,1进行中,2已完成,3被终止 |
| name |
string |
否 |
任务名称搜索 |
| start_at |
string |
否 |
按任务创建时间搜索,如 "2026-04-07 17:00:00" |
| end_at |
string |
否 |
按任务创建时间搜索,如 "2026-04-07 18:00:00" |
| page |
int |
否 |
分页页号 |
| page_size |
int |
是 |
分页大小,默认20,最大100 |
响应示例
{
"status": "success",
"code": 200,
"message": "",
"data": {
"total": 1,
"data": [
{
"id": 237,
"creation_id": 104,
"auth_id": 30058,
"name": "4.8",
"description": "1111",
"type": 3,
"user_name": "Erin",
"user_phone": "6281519140316",
"assignee_username": "incs_1",
"conversation_id": 1023, // 分配的会话id
"status": 3,
"created_at": "2026-04-08 17:22:01",
"updated_at": "2026-04-08 17:28:54",
"logs": [
{
"id": 531,
"type": 1, // 1为创建任务日志
"status": 0,
"pre_status": 0,
"assignee_username": "",
"comment": "",
"created_at": "2026-04-08 17:22:01",
"updated_at": "2026-04-08 17:22:01"
},
{
"id": 532,
"type": 2, // 2为分配任务日志
"status": 0,
"pre_status": 0,
"assignee_username": "incs_1", // 被分配人账号名
"comment": "",
"created_at": "2026-04-08 17:22:06",
"updated_at": "2026-04-08 17:22:06"
},
{
"id": 533,
"type": 3, // 3为任务状态变更日志
"status": 1, // 新状态
"pre_status": 0, // 原状态
"assignee_username": "incs_1",
"comment": "",
"created_at": "2026-04-08 17:25:00",
"updated_at": "2026-04-08 17:25:00"
},
{
"id": 534,
"type": 4, // 4为任务备注日志
"status": 1,
"pre_status": 1,
"assignee_username": "incs_1",
"comment": "已经跟进", // 任务备注
"created_at": "2026-04-08 17:25:01",
"updated_at": "2026-04-08 17:25:01"
}
]
}
]
},
"error": {}
}