工单开放API

更新于

目录

Access Token

您需要在【设置 / 开发者 / APIs】中获取工作台的 Access Token,后续调用以下 APIs 时都需要使用 Token。目前 Token 的有效期是永久,重复获取将导致上次获取的 Token 失效。

$ curl -s https://api.meiqia.com/v1/conversations/<conv_id> -H Authorization:Bearer <access_token>

查询客服列表接口

请求方式:GET

接口地址:/ticket-openapi/agent/list

Header参数:

返回数据:

查询工单模板列表接口

请求方式:POST

接口地址:/ticket-openapi/template/list

Header参数:

Body参数:

返回数据:

返回示例:

 {
    "code": 1,
    "success": true,
    "msg": "操作成功",
    "data": [
            {
            "id": "641d3d54b1e81872bc537af6",
            "tenantId": "1",
            "title": "默认模板",
            "position": 1,
            "description": "这是系统自动生成的默认模板",
            "fields": [
                {
                    "fieldId": "63f33ced52ca28406dd9bb8d",
                    "required": true,
                    "visible": true,
                    "name": "templateId",
                    "viewName": "工单模板",
                    "dataType": "SINGLE_SELECT",
                    "active": true,
                    "hasSystem": true,
                    "hasConfig": true,
                    "hasAction": false,
                    "options": []
                },
                {
                    "fieldId": "63f33ced52ca28406dd9bb90",
                    "required": true,
                    "visible": true,
                    "name": "priority",
                    "viewName": "优先级",
                    "dataType": "SINGLE_SELECT",
                    "active": true,
                    "hasSystem": true,
                    "hasConfig": true,
                    "hasAction": true,
                    "options": [
                        {
                            "code": "EMERGENT",
                            "value": "紧急",
                            "active": true,
                            "description": null
                        },
                        {
                            "code": "HIGH",
                            "value": "高",
                            "active": true,
                            "description": null
                        },
                        {
                            "code": "MIDDLE",
                            "value": "中",
                            "active": true,
                            "description": null
                        },
                        {
                            "code": "LOW",
                            "value": "低",
                            "active": true,
                            "description": null
                        }
                    ]
                }
            ],
            "hasUsed": true,
            "hasSystem": true
        }
    ]
 }       

创建工单接口

请求方式:POST

接口地址:/ticket-openapi/ticket/save

Header参数:

Body参数:

请求示例:

{
    "clientid":"test", 
    "operator":"test",
    "metadata":{
       "name":"test",
       "sex":"female"
    },
  "templateId": "",
  "title": "test",
  "priority": "MIDDLE",
  "content": null,
  "followerIds": null,
  "deadline": null,
    "attachments": [
        {
            "name": "test.png",
            "size": 4000138,
            "attachmentId": "",
            "uploadTime": "2023-04-04T10:25:47.983Z",
            "status": "success",
            "url": ""
        }
    ],
  "fields": [
    {
      "fieldId": "641290b343478962ef9d4e09",
      "value": false
    },
    {
      "fieldId": "641290a943478962ef9d4e08",
      "value": null
    },
    {
      "fieldId": "6412907543478962ef9d4e05",
      "optionCodes": []
    }
  ]
}  

返回数据:

上传附件接口

请求方式:POST

接口地址:/unified-api/fileshelf/v1/openapi/upload_file

Header参数:

Body参数:

返回数据: