Msteams-docs: Similar Botframework V4 Sample to create conversation

Created on 18 Apr 2019  路  7Comments  路  Source: MicrosoftDocs/msteams-docs

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 ?

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)
```

All 7 comments

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KyleSchroeder picture KyleSchroeder  路  5Comments

oyvindam picture oyvindam  路  5Comments

chris31389 picture chris31389  路  5Comments

Arefu picture Arefu  路  6Comments

bezua picture bezua  路  7Comments