【问题标题】:Unclassified Error when posting to Microsoft Connector Service when using Microsoft Teams使用 Microsoft Teams 发布到 Microsoft 连接器服务时出现未分类错误
【发布时间】:2017-03-27 12:38:43
【问题描述】:

当我在收到来自 Microsoft 团队的消息后发布到连接器服务时,我在正文中收到 404 响应。

{"error":{"code":"Unclassified","message":""}}

该服务与 Skype 合作,直到大约 10 天前一直与团队合作。

我已经尝试过 ReplyToActivity 和 RespondToConversation 端点。我还尝试在 conversation.id 中对 : 进行编码。

代码可以看这里:方法reply_to_activity中的https://github.com/Grungnie/microsoftbotframework/blob/FixTeamsError732/microsoftbotframework/response.py

从微软收到的消息(id标签略有变化)

{
   "text": "Test Message",
   "textFormat": "plain",
   "type": "message",
   "timestamp": "2017-03-27T11:55:33.983Z",
   "id": "1490615736123",
   "channelId": "msteams",
   "serviceUrl": "https://smba.trafficmanager.net/apac-client-ss.msg/",
   "from": {
      "id": "29:10U0pO0yzCqc_TZQImyaX1JGhe9KWpagDIwqtTl0moeT2lNC4PMrm9B2W_0w-Cr9tr5rty8vEZErb4yoyautked",
      "name": "Matthew Brown"
   },
   "conversation": {
      "id": "a:1lRzVTZeip__5jthfxCqiWX8koXTOg5OsFsnefe2kesHxvJAcJxNJs-TT3NvR1ote1PZZ_DQVkd5u5wsKmw2TQy53bvXOlXydDJjUUcolfphZWu2N-HuX8181rfRIMj7Q"
   },
   "recipient": {
      "id": "28:5e21d7a8-d1b5-4534-f549-f521712f5a64",
      "name": "PythonBotFramework"
   },
   "entities": [
      {
         "locale": "en-AU",
         "country": "AU",
         "platform": "Android",
         "type": "clientInfo"
      }
   ],
   "channelData": {
      "tenant": {
         "id": "5ghtef8a-55a8-4263-bd84-e03688a2ab2d"
      }
   }
}

标题

Host: microsoftbotframework.herokuapp.com
Connection: close
Contextid: tcid=5448949784053522007, server=EAP010254248242
Authorization: Bearer eyJ0eXAiOiJ....
User-Agent: Microsoft-SkypeBotApi (Microsoft-BotFramework/3.0)
Content-Type: application/json; charset=utf-8
X-Request-Id: 6d8510c4-e3ba-4e34-80b2-45305a38d022
X-Forwarded-For: 13.75.95.64
X-Forwarded-Proto: https
X-Forwarded-Port: 443
Via: 1.1 vegur
Connect-Time: 0
X-Request-Start: 1490615736123
Total-Route-Time: 0
Content-Length: 747

我的回应 网址

https://smba.trafficmanager.net/v3/conversations/a:1lRzVTZeip__5jthfxCqiWX8koXTOg5OsFsnefe2kesHxvJAcJxNJs-TT3NvR1ote1PZZ_DQVkd5u5wsKmw2TQy53bvXOlXydDJjUUcolfphZWu2N-HuX8181rfRIMj7Q/activities/1490615736123

标题

Authorization: Bearer eyJ0eXAgibJ....

身体

{
   "from": {
      "id": "28:5e21d7a8-d1b5-4534-f549-f521712f5a64",
      "name": "PythonBotFramework"
   },
   "type": "message",
   "timestamp": "2017-03-27T11:55:36.463971Z",
   "conversation": {
      "id": "a:1lRzVTZeip__5jthfxCqiWX8koXTOg5OsFsnefe2kesHxvJAcJxNJs-TT3NvR1ote1PZZ_DQVkd5u5wsKmw2TQy53bvXOlXydDJjUUcolfphZWu2N-HuX8181rfRIMj7Q"
   },
   "recipient": {
      "id": "29:10U0pO0yzCqc_TZQImyaX1JGhe9KWpagDIwqtTl0moeT2lNC4PMrm9B2W_0w-Cr9tr5rty8vEZErb4yoyautked",
      "name": "Matthew BROWN"
   },
   "text": "How bout no",
   "replyToId": "1490615736123",
   "serviceUrl": "https://smba.trafficmanager.net/apac-client-ss.msg/",
   "channelId": "msteams",
   "channelData": {
      "tenant": {
         "id": "5ghtef8a-55a8-4263-bd84-e03688a2ab2d"
      }
   },
   "textFormat": "plain"
}

** 在 29/3 错误代码更改后更新。下面是以前的错误代码。

{"errorCode":732,"message":""}

【问题讨论】:

    标签: python python-3.x flask python-requests botframework


    【解决方案1】:

    所以我错了,

    response_url = urljoin(self["serviceUrl"], "/v3/conversations/{}/activities/{}".format( conversation_id, reply_to_id))
    

    urljoin 正在从 self["serviceUrl"] 中剥离 url 的最后一部分。这是预期的行为。似乎没有一种方法可以将 url 的两个部分连接在一起。我想这样做,因为微软有时会发送以“/”结尾的 url,有时不会。我想我会写我自己的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多