I tried this on the V4 Botframework API but didn't succeed, then I moved to this documentation about proactive messaging with the V4 API, but it didn't state how to create a Conversation.
Can we please have a similar (Creating Conversations in a proactive fashion) sample with the V4 Botframework ?
Yes - as we move to GA our Teams Bot Builder v4 SDKs we'll be updating samples and code snippets with examples for this. Are you using Node or C#? I might be able to get you a snippet sooner.
@clearab I'm using C# with the version 4.3 of Bot Builder
@DamienDoumer I dont know what the C# equivlent is but I cant imagine its much different. Here is v4 version for NodeJS i have. This is creating a conversation to a teams channel, only difference for 1:1 is isGroup will be false and you will included the user channel account data you are creating the conversation with
v```
ar conversationReference = TurnContext.getConversationReference(context.activity)
connectorClient = await createConnectorClient(context)
*this is a custom method i madesince i had use case where the connector client may
be a different chat protocol so need new instance dont worry about this**
var conversationParameters = {
isGroup: true,
bot: conversationReference.bot,
channelData: (await teamsCtx.getTeamsChannelData()),
tenantId: teamsCtx.tenant.id,
activity: MessageFactory.text("Queue Summary Placeholder") as Activity
} as ConversationParameters
await connectorClient.conversations.createConversation(conversationParameters)
```
Thanks @01 It's similar to C#. I'll try this.
You can find an example of proactive messaging in v4 here: https://github.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/tree/master/CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot
In particular, this class: https://github.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/blob/master/CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/Engine/ProactiveMessageManager.cs
Thanks @clearab I went through the source code, It didn't work for me so I had to modify it and use the code snippet shared by @01 too so I Create Conversations, and Reply to specific conversations with my Bot. I wrote a blog post explaining how to accomplish this here in case anyone needs it.
@DamienDoumer glad it was helpful and awesome blog ill be bookmarking it.
Most helpful comment
@DamienDoumer I dont know what the C# equivlent is but I cant imagine its much different. Here is v4 version for NodeJS i have. This is creating a conversation to a teams channel, only difference for 1:1 is isGroup will be false and you will included the user channel account data you are creating the conversation with
v```
ar conversationReference = TurnContext.getConversationReference(context.activity)
connectorClient = await createConnectorClient(context)
*this is a custom method i madesince i had use case where the connector client may
be a different chat protocol so need new instance dont worry about this**
var conversationParameters = {
isGroup: true,
bot: conversationReference.bot,
channelData: (await teamsCtx.getTeamsChannelData()),
tenantId: teamsCtx.tenant.id,
activity: MessageFactory.text("Queue Summary Placeholder") as Activity
} as ConversationParameters
await connectorClient.conversations.createConversation(conversationParameters)
```