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 Learn it looks like MS Teams uses this ID internally to mention a user. Send and receive messages with a bot - Teams | Microsoft Learn also mention the usage of this identifier.

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

        "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": "koresupport@xxxxxxxxxxxx.com",
                         "userPrincipalName": "koresupport@xxxxxxxxxxx.com",
                         "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 Kore.ai 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


Hi @swagata.sengupta ,

Are we able to delete meta tags from the conversations? I was testing some user level meta tags that I don’t want to see anymore but they persist in the conversation history even after I’ve removed them from the script node and re-publish.

Hi, Can we able to display that stored meta tag value in a message node to the user.

@StacyJPelletier
Once you remove it from script nodes/configurations, it only takes effect going forward. Previous conversations will still have the tags. Are you seeing this in new conversations too? Hope the bot is published (in published version fo the bot, the script node should not be saving/applying the tags).

@varun.bingi
Can you please share a use case? The primary purpose of meta tags is to tag conversations/messages and use them in custom dashboards.

Hi @swagata.sengupta

I have a universal bot and 3 standard bots. 3rd bot is just to store the completed task names which are there in the 1 nd 2 bots.
After completing the whole task we are invoking anything else dialog and trying to save the completed task name before anything else in save completed task dialog in 3rd bot.
But when we are trying to use current tags and historic tags we are not able to save that completed task names. Its storing anything else dialog task name.

Is there any way we could save the task names rather than saving anything else task name?