UCWA:发送多条消息时出错
Posted
技术标签:
【中文标题】UCWA:发送多条消息时出错【英文标题】:UCWA: error when sending multiple messages 【发布时间】:2020-02-13 17:39:59 【问题描述】:我正在尝试使用 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】:我刚刚解决了这个问题。似乎存在编码错误,因此无法发送包含重音字符的消息(“é”、“è”、“à”、“ù”……)而不会导致失败。
【讨论】:
以上是关于UCWA:发送多条消息时出错的主要内容,如果未能解决你的问题,请参考以下文章
使用 Google API 发送邮件时出错 - “'原始' RFC822 有效负载消息字符串或通过 /upload/* URL 上传消息”