How to tag an intent with the user's email when they chat from MS Teams

Problem statement: In the NLP Metrics section, for a user who has interacted from MS Teams, I see only some identifiers like “29:xxxxxxxxxxxxxx”. How can I see something like email id or given-name.

First let me share some context:

  • The id: 29:1c0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX207g is generated at the MS end and is shared by the MS bots framework with Kore as a unique user identifier. I think you may need to look into MS Teams bots framework documentation further to know more about this. This is just used by Kore as is. However, from Text formatting in cards - Teams | Microsoft Docs it looks like MS Teams uses this ID internally to mention a user. Send and receive messages with a bot - Teams | Microsoft Docs also mention the usage of this identifier.

  • At, for an MS Teams end-user, you may be able to see some more identifiable details under UserContext. Like context.session.UserContext.identities[0]

        "UserContext": {
             "workinghours": {
                 "workdays": "mon,tue,wed,thu,fri",
                 "workstart": "8:00 AM",
                 "workend": "5:00 PM"
             "profImage": "no-avatar",
             "jTitle": "",
             "dept": "",
             "profColour": "#40e0d0",
             "activationStatus": "active",
             "firstName": "",
             "lastName": "",
             "orgId": "o-e31a1a45xxxxxxxxxxxxxxxx-d44396e6e4ac",
             "_id": "u-8b17c9ee-xxxxxxxxxxxxxxx7931d43f34bb",
             "customData": null,
             "identities": [{
                     "profileInfo": {
                         "id": "29:1fvw2hh2_nWetarx9ejxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDY_wyW9L2CQPaMcGJg",
                         "aadObjectId": "96cf354c-xxxxxxxxxxxxxxx-7743cecd0977",
                         "name": "Kore Support",
                         "givenName": "Kore",
                         "surname": "Support",
                         "email": "",
                         "userPrincipalName": "",
                         "userRole": "user",
                         "locale": "en-US",
                         "timeZoneOffset": 19800000,
                         "timezone": "Asia/Calcutta",
                         "country": "US",
                         "profileInfoLastUpdated": 1657123637892
                     "val": "st-9832501a-xxxxxxxxxxxxxx-c0cf2c2d932d/msteams/29:1fvw2hh2_nWetarx9ejxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDY_wyW9L2CQPaMcGJg",
                     "type": "mapped"
  • However, it must be noted that -

    • The platform polls the MS Teams account for fetching user details every 24 hours. The platform saves the details like given name, surname, email, etc. only if the MS Teams end-user has updated these details while setting up their account. If we don’t find these details, i.e user did not set them up, then we don’t store it.
    • What it means is, there can be some cases where some of these details are not available (though chances are less) -
      ['id', 'aadObjectId', 'name', 'givenName', 'surname', 'email', 'mail', 'userPrincipalName', 'userRole', 'displayName', 'jobTitle','businessPhones', 'country']
    • However, apparently, the id like “29:xxxxxxxxx” is always available and that is why it was chosen to be the unique identifier.
    • So, the product team sees a risk in consistently using the name or email as a unique identifier for ms teams.

An alternative solution can be to use ‘custom meta tags’ on the intent to help filter it under the ‘intent found’ section of the NLP Metrics. Any available details in the context like ms teams email id is can be used to tag the intent. Please see the details below:

  1. An intent node does not directly have any placeholder for custom tags. It needs to be applied through a script node immediately after the intent node (as shown below).
  2. Apply the email id or given name through the custom meta tag in the script node. NOTE - This is just an example and is not required to have all session, message, and user level tags applied at the same time. In case any of these values are not available in the user context, we recommend that you handle null and empty values (use some default value maybe - this is totally up to you and your use case).
  3. When the dialog executes, you can see the custom meta tags emitted and applied to the identified intent under the ‘intent found’ section
  4. Now you should be able to use these tags in the filter