UCWA:发送多条消息时出错

UCWA: error when sending multiple messages

我正在尝试使用 UCWA 编写 Skype for Business 聊天机器人。现在,我可以成功创建应用程序、发送消息邀请并最终发送正确接收的消息。问题是:如果我发送另一条消息,它的收件人永远不会收到。

在活动中,消息状态为"Failure",但未提供其他有用信息。

我用了Matthew Proctor's tutorial and official Microsoft documentation。 Microsoft 示例在关闭对话之前只发送一条消息,因此没有给出有关我的问题的指示。 Matthew Proctor 的教程只说要重新运行 POST 请求 POST https://myhostname.com/ucwa/oauth/v1/applications/108/communication/conversations/39e/messaging/messages。我在每条消息之间正确地调用了事件资源。

以下是在我的脚本中执行的步骤:

sd.send_user_message_invitation()
conv_id = sd.get_conversation_ID_in_event()
sd.send_message(conv_id, "Premier message")
sd.get_event()
sd.send_message(conv_id, "Deuxième message")
sd.get_event()
sd.terminate_conversation(conv_id)

这是我在第一条消息(已正确接收)后对事件 URL 发出 GET 请求时得到的响应:

GET https://myhostname.com/ucwa/oauth/v1/applications/108/events?ack=2

{
    "_links": {
        "self": {"href": "/ucwa/oauth/v1/applications/108/events?ack=2"},
        "next": {"href": "/ucwa/oauth/v1/applications/108/events?ack=3"}
    },
    "sender": [
        {
            "rel": "conversation",
            "href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e",
            "events": [
                {
                    "link": {
                        "rel": "message",
                        "href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e/messaging/messages/2"
                    },
                    "status": "Success",
                    "_embedded": {
                        "message": {
                            "direction": "Outgoing",
                            "timeStamp": "\/Date(1581608086884)\/",
                            "_links": {
                                "self": {"href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e/messaging/messages/2"},
                                "messaging": {"href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e/messaging"}
                            },
                            "rel": "message"
                        }
                    },
                    "type": "completed"
                }
            ]
        }
    ]
}

这是我在第二条(或任何后续发送的)消息(未收到)后对事件 URL 发出 GET 请求时得到的结果:

GET https://myhostname.com/ucwa/oauth/v1/applications/108/events?ack=3

{
    "_links": {
        "self": {"href": "/ucwa/oauth/v1/applications/108/events?ack=3"},
        "next": {"href": "/ucwa/oauth/v1/applications/108/events?ack=4"}
    },
    "sender": [
        {
            "rel": "conversation",
            "href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e",
            "events": [
                {
                    "link": {
                        "rel": "message",
                        "href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e/messaging/messages/3"
                    },
                    "status": "Failure",
                    "_embedded": {
                        "message": {
                            "direction": "Outgoing",
                            "timeStamp": "\/Date(1581608088182)\/",
                            "_links": {
                                "self": {"href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e/messaging/messages/3"},
                                "messaging": {"href": "/ucwa/oauth/v1/applications/108/communication/conversations/39e/messaging"}
                            },
                            "rel": "message"
                        }
                    },
                    "reason": {
                        "code": "RemoteFailure",
                        "message": "Your request couldn\u0027t be completed.",
                        "debugInfo": {"errorReportId": "fb8aada02f7f47e6958b6c7df62e7bec"}
                    },
                    "type": "completed"
                }
            ]
        }
    ]
}

我忘记了什么?有帮助吗?

我刚刚解决了这个问题。似乎存在编码错误,因此无法发送包含重音字符的消息(“é”、“è”、“à”、“ù”、...)而不会导致失败。