0

我已经使用机器人框架编写器部署了一个机器人并将其部署在 MS 团队中。现在我想合并个性化消息来问候用户,我正在尝试关注这篇文章https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/get-teams-context ?tabs=json#get-single-member-details

下面是我得到的 401 异常。

    {
      "type": "message",
      "serviceUrl": "http://localhost:49558",
      "channelId": "emulator",
      "from": {
      "id": "<>id",
      "name": "Bot",
      "role": "bot"
    },
   "conversation": {
      "id": "<id>"
    },
    "recipient": {
      "id": "<id>",
      "role": "user"
    },
    "locale": "en-US",
    "text": "{\r\n  \"statusCode\": 401,\r\n  \"reasonPhrase\": \"Unauthorized\",\r\n  \"headers\": {\r\n    
    \"Server\": \"Microsoft-HTTPAPI/2.0\",\r\n    \"Date\": \"Fri, 05 Mar 2021 10:29:31 GMT\"\r\n  },\r\n  
    \"content\": {\r\n    \"message\": \"Authorization has been denied for this request.\"\r\n  }\r\n}",
    "speak": "{\r\n  \"statusCode\": 401,\r\n  \"reasonPhrase\": \"Unauthorized\",\r\n  \"headers\": 
    {\r\n    \"Server\": \"Microsoft-HTTPAPI/2.0\",\r\n    \"Date\": \"Fri, 05 Mar 2021 10:29:31 
      GMT\"\r\n  },\r\n  \"content\": {\r\n    \"message\": \"Authorization has been denied for this 
      request.\"\r\n  }\r\n}",
    "attachments": [],
    "entities": [],
    "replyToId": "<id>",
    "id": "<id>",
    "localTimestamp": "2021-03-05T15:59:32+05:30",
    "timestamp": "2021-03-05T10:29:32.254Z"
    } 

任何建议都会很有帮助。

4

1 回答 1

0

为了获取用户的详细信息,有一个 API 作为 Bot Framework 的一部分,专门用于 Teams 中的此类操作。请参阅获取单个成员详细信息。这将展示如何获取用户的详细信息,以便向他们发送个性化的欢迎消息。

于 2021-03-10T06:25:03.997 回答