Ejemplo n.º 1
0
        public static async Task WelcomeTeam(ConnectorClient connectorClient, Activity activity, string tenantId, string teamId)
        {
            var botDisplayName = CloudConfigurationManager.GetSetting("BotDisplayName");
            var teamName       = await GetTeamNameAsync(connectorClient, teamId);

            var welcomeTeamMessageCard = WelcomeTeamAdaptiveCard.GetCard(teamName, botDisplayName);

            await NotifyTeam(connectorClient, welcomeTeamMessageCard, teamId);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends a welcome message to the General channel of the team that this bot has been installed to
        /// </summary>
        /// <param name="connectorClient">The connector client</param>
        /// <param name="teamId">The id of the team that the bot is installed to</param>
        /// <param name="botInstaller">The installer of the application</param>
        /// <returns>Tracking task</returns>
        public async Task WelcomeTeam(ConnectorClient connectorClient, string teamId, string botInstaller)
        {
            this.telemetryClient.TrackTrace($"Sending welcome message for team {teamId}");

            var teamName = await this.GetTeamNameAsync(connectorClient, teamId);

            var welcomeTeamMessageCard = WelcomeTeamAdaptiveCard.GetCard(teamName, this.botDisplayName, botInstaller);

            await this.NotifyTeam(connectorClient, welcomeTeamMessageCard, teamId);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a welcome message to the General channel of the team that this bot has been installed to
        /// </summary>
        /// <param name="turnContext">Context object containing information cached for a single turn of conversation with a user.</param>
        /// <param name="botInstaller">The installer of the application</param>
        /// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
        /// <returns>Tracking task</returns>
        private async Task WelcomeTeam(ITurnContext turnContext, string botInstaller, CancellationToken cancellationToken)
        {
            var teamId = turnContext.Activity.Conversation.Id;

            this.telemetryClient.TrackTrace($"Sending welcome message for team {teamId}");

            var teamName = turnContext.Activity.TeamsGetTeamInfo().Name;
            var welcomeTeamMessageCard = WelcomeTeamAdaptiveCard.GetCard(teamName, botInstaller);

            await this.NotifyTeamAsync(turnContext, MessageFactory.Attachment(welcomeTeamMessageCard), teamId, cancellationToken);
        }
        private async Task HandleDebugWelcomeTeam(ConnectorClient connectorClient, Activity activity, string teamId)
        {
            var welcomeCard = WelcomeTeamAdaptiveCard.GetCardJson("TestTeam", teamId, activity.Recipient.Id, "Rocky");

            var replyActivity = activity.CreateReply();

            replyActivity.Attachments = new List <Attachment> {
                AdaptiveCardHelper.CreateAdaptiveCardAttachment(welcomeCard)
            };

            await connectorClient.Conversations.ReplyToActivityAsync(replyActivity);
        }