1

I have deployed my bot on teams channel.

I would like to send a welcome message to a new user even before user sends a message to the bot.

can we achieve this for teams channel?

If yes, which event can be used to get that user is accessing bot for the first time.

3 Answers3

1

The conversationUpdate event with the membersAdded object in the payload is sent when either a bot is added to a team or a new user is added to a team where a bot has been added. It is always a good practice to send a welcome message introducing the bot to all the users. Ensure that your bot responds to the conversationUpdate message, with the teamsAddMembers eventType in the channelData object. Also, keep in mind that the memberAdded ID is the bot's App ID itself, because the same event is sent when a user is added to a team.

Hope this helps.

ranusharao
  • 1,826
  • 1
  • 8
  • 17
  • Refer to the [welcome-user](https://github.com/Microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/03.welcome-user) sample in the BotBuilder Samples. – ranusharao Dec 03 '19 at 16:38
  • Is there a way to get the user's locale using the `conversationUpdate` event so we can localize the welcome message? Seems like this is an open issue https://github.com/microsoft/botframework-solutions/issues/2920#issuecomment-582458342 and the proposed solution in directline is not found in teams – Marawan Okasha Feb 05 '20 at 15:48
  • 1
    As of now, the bot will have to wait for the user to message as the message activity has clientInfo filled out in channelData with locale information. – ranusharao Feb 05 '20 at 23:59
0

You can use the ConversationUpdate event ActivityTypes.ConversationUpdate // in c#

Marc Asmar
  • 1,527
  • 1
  • 10
  • 22
0

When a bot is installed, your bot receives a conversationUpdate event. You can then send a proactive message to the user. Could you please try sending a proactive message and let us know if you face any issues?

Gousia Begum
  • 2,076
  • 1
  • 5
  • 9
  • If user sends a message to a bot then only ConversationUpdate event is triggering, not on accessing Bot contact. Any other way or do you have any working example in Bot framework v4? – Rutuj Langalia Dec 03 '19 at 10:39
  • Your Bot will receive a ConversationUpdate event when your bot is installed in a team. Could you please put a debugger in your application and then install it and see if you are getting the conversationUpdate event. – Gousia Begum Dec 03 '19 at 10:44
  • Actually I am trying for 1:1/Personal conversations, not for teams. – Rutuj Langalia Dec 03 '19 at 10:45
  • @RutujLangalia You receive a conversationUpdate when app is added to a personal scope also. – Gousia Begum Dec 03 '19 at 11:06
  • I have attached relevant files to one of the similar issue on Github. Please check if I am doing anything wrong. Thanks for your help. – Rutuj Langalia Dec 03 '19 at 12:45
  • @RutujLangalia Could you please try this [sample](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/16.proactive-messages) for sending proactive messages? – Gousia Begum Dec 06 '19 at 06:41
  • I already tried this and for this users must have chatted once then only it will send a proactive message whereas I need to send welcome message when user accesses bot contact before even user sends a message. – Rutuj Langalia Dec 09 '19 at 12:23
  • @RutujLangalia User needs to install the app to get a proactive message. What do you mean by user accesses bot contact? – Gousia Begum Dec 13 '19 at 05:54