Exam AI-102 All QuestionsBrowse all questions from this exam
Question 215

HOTSPOT -

You are building a chatbot for a Microsoft Teams channel by using the Microsoft Bot Framework SDK. The chatbot will use the following code.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

NOTE: Each correct selection is worth one point.

Hot Area:

    Correct Answer:

    Box 1: Yes -

    The ActivityHandler.OnMembersAddedAsync method overrides this in a derived class to provide logic for when members other than the bot join the conversation, such as your bot's welcome logic.

    Box 2: Yes -

    membersAdded is a list of all the members added to the conversation, as described by the conversation update activity.

    Box 3: No -

    Reference:

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.activityhandler.onmembersaddedasync?view=botbuilder-dotnet-stable

Discussion
guruaws2021

2nd one should ne no, when a new member will join the chatbot will only great the new member and not all existing member in the chat

Viktur

I feel the answer is correct. The members are all in a "group". So when a new member is added, the old members will see the chatbot greet the new member ("Hello ${new.member}), and not every other existing members.

rdemontis

Agree with you. "In the context of the OnMembersAddedAsync method, the membersAdded list contains information about the members who have just been added to a conversation. Here's how this iteration process works: Method Parameters: membersAdded: This is a list of ChannelAccount objects, each of which represents a member who has just been added to the conversation. ChannelAccount objects contain information about the member, such as their Id, Name, Role, and so on. turnContext: The current context of the conversation and activity. cancellationToken: A cancellation token, which can be used to cancel the request if necessary. Iterating through Added Members: The code block starts with an iteration through the membersAdded list. This iteration is performed using a foreach loop. For each member in the list, the code within the loop will be executed." (ChatGPT)

rdemontis

if you look the code you can see that the method sends a Welcome message for each member added: "Hi there - {member.Name}". It would be very strange to give a welcome message to everyone in the chat, even member already joined, every time a new one is added. So I think ChatGPT is right and the second answer is wrong. It should be "NO". Here another similar example: https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/subscribe-to-conversation-events?tabs=dotnet#members-added

reachmymind

A1. Yes https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.activityhandler.onmembersaddedasync?view=botbuilder-dotnet-stable ActivityHandler.OnMembersAddedAsync(IList<ChannelAccount>, ITurnContext<IConversationUpdateActivity>, CancellationToken) Method invoked when members other than the bot join the conversation A2. No https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.turncontext.sendactivityasync?view=botbuilder-dotnet-stable Sends a message activity to the sender of the incoming activity in turncontext A3: No https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.activityhandler.onconversationupdateactivityasync?view=botbuilder-dotnet-stable ActivityHandler.OnConversationUpdateActivityAsync(ITurnContext<IConversationUpdateActivity>, CancellationToken) Method invoked when a conversation update activity that indicates one or more users other than the bot are joining the conversation

ninjapunk

This is correct, as per the docs SendActivityAsync "sends an activity to the sender of the incoming activity", thus not a public message to be seen by everyone in the group.

TheB

The answer looks correct.

zellck

YYN is the answer. https://learn.microsoft.com/en-us/azure/bot-service/bot-activity-handler-concept?view=azure-bot-service-4.0&tabs=csharp#activity-handling - OnMembersAddedAsync Non-bot members joined the conversation

dimsok

YYN - for the second one, everyone will see that the bot said hi to a new user , the message sent by the bot is not private, its posted in the channel

sl_mslconsulting

The answer to the second question is no. The membersAdded will have two guys : you and the bot. The OnMembersAddedAsync will only be triggered when non bot member joined the conversation which is you. The logic coded here will not send the welcome message to the bot which is also a existing user. You and the bot are both members. I think we are reading to much to this - it’s not a chat room where a new guy joined everyone will be notified.

sl_mslconsulting

You can actually write the code to verify this yourself and comment out the statement that check if a member is a bot to see what would happen.

Adedoyin_Simeon

The answer is correct.

takaimomoGcup

Yes No No

idcanymore

Discord sends this exact message to people joining groups and everyone in the chat sees it. don't let chatgpt do your thinking for you.

AzureJobsTillRetire

The given answers are correct. On the second question:- The sender is the Microsoft Teams channel. "from" Identifies the sender of the message. example: from: ChannelAccount The recipients are the members According to the code, If new member <> existing member, then send out welcome message if (member.Id != turnContext.Activity.Recipient.Id)

saadashraf

Thanks, spent quite a time on this question. Your answer is absolutely correct

krzkrzkra

YNN is the answer.

HaraTadahisa

My answer is that Yes No No

nanaw770

Will this question still be asked on June 2, 2024?

Murtuza

Yes, the OnMembersAddedAsync method is triggered when a new user joins the conversation. Yes, when a new user joins the conversation, the existing users in the conversation will see the chatbot greeting. This is because the OnMembersAddedAsync method sends a welcome message to each new member. No, the OnMembersAddedAsync method is not initialized when a user sends a message. It is only triggered when a new user joins the conversation. The method that handles incoming messages is typically OnMessageActivityAsyn

PCRamirez

YNN: Asking Windows Copilot about second answer: No, the existing users in the conversation will not see the chatbot greeting. The code snippet provided shows a method `OnMembersAddedAsync` that is triggered when new members are added to the conversation. Inside this method, there is a conditional statement `if (member.Id != turnContext.Activity.Recipient.Id)` which ensures that the welcome message is sent only to the new member who has joined, and not to the existing users or the bot itself. The welcome message is personalized with the new member's name and is sent directly to them.

evangelist

given answer is NOT Correct! why: Enable Active Learning: LUIS's Active Learning feature automatically identifies vague or low-confidence user inputs that may require further training. Review and Add Utterances Logged for Review: Utterances collected through Active Learning are marked for review. Regularly reviewing and categorizing these utterances into the relevant intents is a crucial step in enhancing model performance. Train and Republish the Language Understanding Model: After adding new utterances and potentially adjusting intents and entities, you need to retrain the LUIS model to incorporate these updates.