3
votes

I am using Microsoft Bot Framework. My intent is to get the user email of customers when they are chatting with Microsoft Bot on Microsoft Teams.

On my application, I am using library "botbuilder" and NodeJs language. I have an example code:

var builder = require('botbuilder');
let inMemoryStorage = new builder.MemoryBotStorage();
var botSetting = {appId: '4c8f3u2b-c56n-4117-bc16-ec31eeb5d25c', appPassword: '4CBNO8vBGtdcGh9PoiVYottY'};
var connector = new builder.ChatConnector(botSetting);
var bot = new builder.UniversalBot(connector).set('storage', inMemoryStorage);

bot.dialog("/Debug", [
  function (session, args, next) {
    session.endDialog("Hello");
  }
]);

var address = {
    "channelId" : "msteams",
    "bot" : {
        "id" : "28:1b435929-3da2-46ed-8ccc-29ecb50cf350",
        "name" : "taskbot-prod",
        "nickname" : "taskbot-prod"
    },
    "serviceUrl" : "https://smba.trafficmanager.net/amer-client-ss.msg/",
    "user" : {
        "id" : "29:1rf-2Bm6aD0BWc-yRNDFcgOBG1-uSaEjCWtJcoR-rcU-Humz3a_RddsCKifHqYpvNSUosrRpxUnYL907Qa1ZZuw",
        "name" : "John Smith"
    },
    "channelData" : {
        "tenant" : {
            "id" : "adb94d72-6cf3-4244-86ae-aa69c9f2ad43"
        }
    }
};

bot.beginDialog(address, "/Debug", {});

In the example code above, I already have user id (29:1rf-2Bm6aD0BWc-yRNDFcgOBG1-uSaEjCWtJcoR-rcU-Humz3a_RddsCKifHqYpvNSUosrRpxUnYL907Qa1ZZuw), but I don't know how to get user email by this id.

So, what API should I use to get the user email by id? If not API, then what MS Bot Framework Library should I use to get user email by ID?

1

1 Answers

4
votes

Here is the sample code to get email id from the Teams. Please try and let me know if this works for you?