Thursday, 28 June 2018

Creating Deep Link to Static Tab in 1:1 Chat with context in Microsoft Teams Bot

I will be posting several post on my experience while developing on Microsoft Teams/Bot framework. This begin with my favorite feature DeepLink format which enables you to Navigate to the Tab app from the Bot.

Microsoft has not officially documented the deepLink to Static Tab. The work around is quite useful.

Below is the format for deeplink to static tab:{botID}/{tabEntityID}?context={sereliazedContextModel}&conversationType=chat

botId= Registered BotId 
tabEntityID= entityId given in the manifest file for static Tab.
sereliazedContextModel= context object in the format as described in Generating a deep link to your tab .

In the context object you can use subEntityID to pass custom json data object which you can read in the Tab.

I had created following extension method for generating deeplink for Static Tab and Team Tab.

public static string GetDeepLink(this Activity activity, CustomData customData, string subEntityName)
            bool isPrivateConversation = false;
            TeamsChannelData channelData = activity.GetChannelData<TeamsChannelData>();
            string channelID = string.Empty;
            if (channelData != null)
                if (channelData.Team == null)
                    isPrivateConversation = true;
                    channelID = string.Empty;
                    isPrivateConversation = false;
                    channelID = channelData.Channel.Id;
            string deepLink = string.Empty;
            var appID = BotConstants.BotAppID;
            var entityID = "DeepLinkTab";//should be same as manifest
            var webUrl = BotConstants.BaseURl;
            var label = HttpUtility.UrlEncode("DeepLink");
             var objContext = HttpUtility.UrlEncode(JsonConvert.SerializeObject(
                   subEntityId = $"{JsonConvert.SerializeObject(customData)}",
                   canvasUrl = HttpUtility.UrlEncode(BotConstants.BaseURl),
                   channelId = channelID
            var tenantID =activity.GetTenantId();
            if (!isPrivateConversation)
                deepLink = $"{appID}/{entityID}?webUrl={webUrl}&label={label}&context={objContext}&tenantId={tenantID}";
                deepLink = $"{appID}/{appID}?context={objContext}&conversationType=chat";
            return deepLink;

Thank you for reading through this. I hope you found it useful.

Tuesday, 5 May 2015

Email Translator Mail App for Office 365

During my tenure with Microsoft, created this little app and published in store for free. Many Office 365 users found it useful. However there were several feedback that there is no option to change the default language other than English. App was only able to convert the email which are in English to other supported languages.
The reason for this was, rendering script for Microsoft Translator contains a query string parameter named “from”. This expects a default language of email which was earlier set to “en-us” due to which app was only able to convert the language from English to other supported language.

I had a busy schedule but now when I quit my Job, I decided to extend the functionality of app. New version of app, allows user to select the language of email and then convert it to any other language like English, French etc. supported by Microsoft Translator. 

Permission for App:
1.       Since App reads the Body Text from email, it requires a Read/Write permission on users Mailbox. 

1.       App is free to use and powered by Microsoft Translator Widget.
2.       App does not collect/store any personal data. Email content is passed to Microsoft Translator as it is and it can be verified using Fiddler.
3.       App uses Google analytics for statistics of usability of app across different regions.
4.       I do not have control on Translation of the content, so please do not contact me for any translation related issue.

 Following are the steps for a user who wants to use this app :
(assuming user have already installed this app)

Step 1: User get an email in French
Step 2: Start the App. Email content is rendered inside the app.

Step 3: On Top right Corner click on small notebook like Icon for opening the Translator. On the drop down select Language of email. In image below it is selected as French, because language of email is French.

Step 4: After selection, click on Go. Translator Widget will render at the bottom section of the menu.

Step 5: Select the language of your choice and click on small Arrow like button on Widget. You would see that language for email is changed and on the Widget drop down, instead of English, Original is displayed.

 Step 6: You can close the Menu by clicking on the notebook icon on top left corner to close the menu. Now enjoy reading the email in your own language.

Step 7: For restoring the default language, open the Menu and click on Arrow button next to Original text in Translator widget.

Step 8: Language is restored to original.

Future Updates:

1.       Save the email language selection of user and trigger the translation automatically, so that user do not need to perform any action. Just start the app and read the email on his/her default language.

2.       Auto detect the email language.


Contact me at avishkaramtech At /Pallav.sharma At for any query/feedback/suggestion.