当我收到来自Microsoft团队的消息后发布到Connector服务器时,我会收到404响应。
{"error":{"code":"Unclassified","message":""}}
该服务正在与Skype合作,并且正在与团队合作,直到大约10天前。
我已经尝试了ReplyToActivity和RespondToConversation端点。我也试过编码:在conversation.id中。
代码可以在这里看到:https://github.com/Grungnie/microsoftbotframework/blob/FixTeamsError732/microsoftbotframework/response.py在方法reply_to_activity中。
从Microsoft收到的消息(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
我的回复 URL
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":""}
答案 0 :(得分:0)
所以我犯了一个错误,
response_url = urljoin(self["serviceUrl"], "/v3/conversations/{}/activities/{}".format( conversation_id, reply_to_id))
urljoin正在剥离自我[" serviceUrl"]的网址的最后一部分。这是预期的行为。似乎并不是一种将网址的两个部分连接在一起的方法。我想这样做,因为微软有时会发送以" /"结尾的网址。有时候不是。我想我会写自己的方法。