/// <summary> /// Generates the adaptive card string for the unrecognized input in a channel. /// It invites the user to chat directly with the bot. /// </summary> /// <param name="botChannelAccountId">bot ChannelAccount id for deep link to work</param> /// <param name="teamId">Team id of the channel this message is for</param> /// <returns>The adaptive card for the unrecognized input</returns> public static AdaptiveCard GetCard(string botChannelAccountId, string teamId) { var botMessage = AdaptiveCardHelper.GetChatWithMeMessage(teamId); var card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0)) { Body = new List <AdaptiveElement> { new AdaptiveTextBlock { Text = "👋 " + Resources.UnrecognizedInputInChannelText, Wrap = true } }, Actions = new List <AdaptiveAction> { new AdaptiveOpenUrlAction { Title = Resources.ChatWithMeButtonText, Url = new System.Uri("https://teams.microsoft.com/l/chat/0/0?users=" + botChannelAccountId + "&message=" + botMessage) } } }; return(card); }
/// <summary> /// Creates the adaptive card for the team welcome message /// </summary> /// <param name="teamName">The team name</param> /// <param name="teamId">Team id</param> /// <param name="botChannelAccountId">Bot id that will allow deeplink to chat with the bot</param> /// <param name="botInstaller">The name of the person that installed the bot</param> /// <returns>The welcome team adaptive card</returns> public static string GetCardJson(string teamName, string teamId, string botChannelAccountId, string botInstaller) { string teamIntroPart1; if (string.IsNullOrEmpty(botInstaller)) { teamIntroPart1 = string.Format(Resources.InstallMessageUnknownInstaller, teamName); } else { teamIntroPart1 = string.Format(Resources.InstallMessageKnownInstaller, botInstaller, teamName); } string teamIntroPart2 = Resources.InstallMessageBotDescription; string teamIntroPart3 = Resources.InstallMessageInstruction; var suggestedNextStep = Resources.WelcomeTeamSuggestedNextStep; var baseDomain = CloudConfigurationManager.GetSetting("AppBaseDomain"); var welcomeCardImageUrl = $"https://{baseDomain}/Content/welcome-card-image.png"; var salutationText = Resources.SalutationTitleText; var chatWithMeButtonText = Resources.ChatWithMeButtonText; var variablesToValues = new Dictionary <string, string>() { { "teamIntroPart1", teamIntroPart1 }, { "teamIntroPart2", teamIntroPart2 }, { "teamIntroPart3", teamIntroPart3 }, { "suggestedNextStep", suggestedNextStep }, { "welcomeCardImageUrl", welcomeCardImageUrl }, { "salutationText", salutationText }, { "chatWithMeButtonText", chatWithMeButtonText }, { "botChatId", botChannelAccountId }, { "botMessage", AdaptiveCardHelper.GetChatWithMeMessage(teamId) } }; var cardBody = CardTemplate; foreach (var kvp in variablesToValues) { cardBody = cardBody.Replace($"%{kvp.Key}%", kvp.Value); } return(cardBody); }