Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

microsoft graph api - Can't add Teams bot to a channel

This was originally a support ticket to Microsoft. However they told they don't do dev support without paying for it. They directed me to Stack Overflow, so here goes nothing.

I'm developing a Bot for Microsoft Teams. I have registered my bot with Azure Active Directory, & Bot Framework. I have uploaded my app to Team, without any errors. My bot is currently able to send direct messages to Teams users. However, when I try to add my bot to a Teams channel, I get unhelpful errors.

I click the dropdown under my app in the Apps tab:

enter image description here

I click "Add to a Team", then select a channel:

enter image description here

After clicking the button "Set up a bot", I get the following error message:

enter image description here

I have checked & rechecked my webApplicationInfo.id & webApplicationInfo.applicationPermissions numerous times, and I'm at a loss for what could be amiss. I don't see how either of these fields could be wrong given, I can authenticate with both the Microsoft Graph & Bot Framework apis using these values. Here's a slightly redacted version of my Teams app manifest:

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.8/MicrosoftTeams.schema.json",
  "manifestVersion": "1.8",
  "version": "1.0.15",
  "id": "<TEAMS_APP_ID>",
  "packageName": "ambition",
  "developer": {
    "name": "Ambition",
    "websiteUrl": "https://ambition.com",
    "privacyUrl": "https://ambition.com/privacy",
    "termsOfUseUrl": "https://ambition.com/pages/terms"
  },
  "icons": {
    "color": "logo_opaque_192x192.png",
    "outline": "logo_transparent_32x32.png"
  },
  "name": {
    "short": "Ambition",
    "full": ""
  },
  "description": {
    "short": "Motivate & Recognize",
    "full": "Ask Marketing"
  },
  "accentColor": "#FFFFFF",
  "permissions": [
    "identity",
    "messageTeamMembers"
  ],
  "validDomains": [
    "ambition.com"
  ],
  "bots": [
    {
      "botId": "<AZURE_ACTIVE_DIRECTORY_CLIENT_ID>",
      "scopes": [
        "team",
        "personal",
        "groupchat"
      ],
      "isNotificationOnly": true
    }
  ],
  "webApplicationInfo": {
    "id": "<AZURE_ACTIVE_DIRECTORY_CLIENT_ID>",
    "resource": "https://ambition.com",
    "applicationPermissions": [
      "Channel.ReadBasic.All",
      "ChannelMessage.Send",
      "Group.Read.All",
      "Notifications.ReadWrite.CreatedByApp",
      "Team.ReadBasic.All",
      "User.Read",
      "User.ReadBasic.All"
    ]
  }
}
question from:https://stackoverflow.com/questions/66066095/cant-add-teams-bot-to-a-channel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The webApplicationInfo section is really only for two things: Tab SSO, and Resource-Specific Consent. Are you trying to implement either one of those? If not, removing it is definitely the best option, as you've noted in your answer.

In addition, I see that the resource values you've put in there are Microsoft Graph Scopes, whereas the applicationPermissions section is expecting a different list of options (they look kind of similar, but their not the same thing). See here for more: https://docs.microsoft.com/en-gb/microsoftteams/platform/graph-api/rsc/resource-specific-consent#resource-specific-permissions


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...