2
votes

I am making a custom bot, using the Bot Framework, for Microsoft teams. I am currently hosting the bot locally and tunneling through ngrok, and I'm using the /api/messages URL. I have registered the bot with the bot framework, and put the bot handle in BotId, app ID in MiscrosoftAppId, and app password in MicrosoftAppPassword in my Web.config. The Teams channel is enabled and has status "Running" on the Bot Framework page. The bot runs on the emulator, and runs on the test connection on the Bot Framework page, but it does not run in Microsoft Teams.

This is what is being sent to my bot:

"type": "message",
"id": "1497620296742",
"timestamp": "2017-06-16T13:38:19.303Z",
"localTimestamp": null,
"serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/",
"channelId": "msteams",
"from": {
    "id": "29:1F9b3IgxC3x5ynp7nVxdSQ0bQ9MNyf7uKDZHrrCfRLyBbjOmdWSY4gyFLuR8cTRFmbXOeDN4f_uI65xSem6M5OA",
    "name": "Ronnei, Evan T"
},
"conversation": {
    "isGroup": true,
    "id": "19:[email protected];messageid=1497558943513",
    "name": null
},
"recipient": null,
"textFormat": "plain",
"attachmentLayout": null,
"membersAdded": null,
"membersRemoved": null,
"topicName": null,
"historyDisclosed": null,
"locale": null,
"text": "Test Bot",
"summary": null,
"attachments": [
    {
        "contentType": "text/html",
        "contentUrl": null,
        "content": "<div><span itemscope=\"\" itemtype=\"http://schema.skype.com/Mention\" itemid=\"0\">Test Bot</span></div>",
        "name": null,
        "thumbnailUrl": null
    }
],
"entities": [
    {
        "type": "clientInfo",
        "locale": "en-US",
        "country": "US",
        "platform": "Windows"
    }
],
"channelData": {
    "teamsChannelId": "19:[email protected]",
    "teamsTeamId": "19:[email protected]",
    "channel": {
        "id": "19:[email protected]"
    },
    "team": {
        "id": "19:[email protected]"
    },
    "tenant": {
        "id": "a9691d3f-49e3-46a8-8b23-ddad274d0523"
    }
},
"action": null,
"replyToId": null,
"value": null,
"name": null,
"relatesTo": null

And it's giving me this 401 Unauthorized error:

BotAuthenticator failed to authenticate incoming request!

I'm very much a beginner when it comes to all of this stuff. I followed the available tutorials on the Bot Framework documentation, but it still doesn't work on Teams. I'm sort of stuck at this point. Let me know if there's any more information that I should provide.

Apparently I don't have enough reputation to post more code... So here's my manifest.json: https://pastebin.com/xK7y2VHX

2
Can you double check if the AppId and AppPassword values are correct?Ezequiel Jadib
They are correct. I even generated a new password and used that just to make sure.Evan Ronnei

2 Answers

3
votes

Your attached manifest has a few issues:

  1. bots.botsId needs to be the guid from your botframework's bot
  2. both needsChannelSelector and isNotificationOnly should be bools, not strings (e.g. "needsChannelSelector": false)

(packageName is not a blocking element but should be a unique string ideally in reverse domain name notation, if applicable.)

You can also compare against our simple bot package here and make sure you review the packaging and sideloading instructions as well.

0
votes

That's great you've got your bot working. Have you created a manifest.json file and sideloaded it into Teams? Your manifest contains the appID, botID, and the overall information about your bot. Here are the packaging instructions if not. There's a page below this page that shows the manifest schema. If you've sideloaded it and are still having trouble, please post again!