Skip to content

updating create conversation to take conversation params #496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from msrest.serialization import Model
from botbuilder.schema import (
Activity,
ActivityTypes,
ConversationAccount,
ConversationParameters,
ConversationReference,
Expand Down Expand Up @@ -172,6 +173,7 @@ async def create_conversation(
self,
reference: ConversationReference,
logic: Callable[[TurnContext], Awaitable] = None,
conversation_parameters: ConversationParameters = None,
):
"""
Starts a new conversation with a user. This is typically used to Direct Message (DM) a member
Expand All @@ -187,8 +189,12 @@ async def create_conversation(
)

# Create conversation
parameters = ConversationParameters(
bot=reference.bot, members=[reference.user], is_group=False
parameters = (
conversation_parameters
if conversation_parameters
else ConversationParameters(
bot=reference.bot, members=[reference.user], is_group=False
)
)
client = await self.create_connector_client(reference.service_url)

Expand All @@ -206,7 +212,9 @@ async def create_conversation(
parameters
)
request = TurnContext.apply_conversation_reference(
Activity(), reference, is_incoming=True
Activity(type=ActivityTypes.event, name="CreateConversation"),
reference,
is_incoming=True,
)
request.conversation = ConversationAccount(
id=resource_response.id, tenant_id=parameters.tenant_id
Expand Down