UCWA:发送多个消息时出错

时间:2020-02-13 17:39:59

标签: skype-for-business skypedeveloper ucwa

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

在这种情况下,消息状态为“失败”,但未提供其他有用信息。

我使用了Matthew Proctor's tutorial和官方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"
                }
            ]
        }
    ]
}

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

1 个答案:

答案 0 :(得分:0)

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

相关问题