首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Chatbase一次发送多条消息错误序列

Chatbase一次发送多条消息错误序列
EN

Stack Overflow用户
提问于 2019-04-10 16:53:12
回答 1查看 39关注 0票数 0

我正在使用https://chatbase.com/api/messages Chatbase API向Chatbase发送多条消息。响应将为请求中发送的单个消息提供错误和成功的documentation统计信息。

如果响应提供了一条消息的错误,我应该如何检测我在请求中提供的3条消息中哪条消息失败?

发送多条消息的JSON请求体

代码语言:javascript
复制
{
    "messages": [
        {
            "api_key": "<API KEY>",
            "type": "agent",
            "user_id": "User_1",
            "time_stamp": 1542895834,
            "platform": "XXX",
            "message": "Test 1",
            "not_handled": false,
            "version": "1.0",
            "session_id": "session-User_1"
        },
        {
            "api_key": "<API KEY>",
            "type": "agent",
            "user_id": "User_1",
            "time_stamp": 1542895834,
            "platform": "XXX",
            "message": "Test 2",
            "not_handled": false,
            "version": "1.0",
            "session_id": "session-User_1"
        },
        {
            "api_key": "<API KEY>",
            "type": "agent",
            "user_id": "User_1",
            "time_stamp": 1542895834,
            "platform": "XXX",
            "message": "Test 3",
            "not_handled": false,
            "version": "1.0",
            "session_id": "session-User_1"
        }
    ]
}

JSON响应体

代码语言:javascript
复制
{
    "all_succeeded": false,
    "responses": [
        {
            "error": "Error fetching parameter 'type': Invalid conversation type [dfg]",
            "status": "error"
        },
        {
            "message_id": 139429278,
            "status": "success"
        },
        {
            "error": "Error fetching parameter 'time_stamp': Received a time (1921-02-09 09:49:26) which was too small. Please send a time within the past day for metrics to appear in the dashboards, or omit the time_stamp field for the time to automatically be set to now.",
            "status": "error"
        }
    ],
    "status": 200
}
EN

回答 1

Stack Overflow用户

发布于 2019-04-12 02:50:00

错误消息的顺序将与您提交的消息的顺序相对应。在本例中,它是第一条和第三条消息。我还注意到,您的时间戳中没有使用unix毫秒。为了在Chatbase报告中正确地对消息进行排序,这些消息需要至少相隔一毫秒。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55608459

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档