Skip to content
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

Add support for channelData field in conversation references #712

Merged
merged 12 commits into from
Feb 13, 2019
Merged
11 changes: 11 additions & 0 deletions libraries/botbuilder/src/botFrameworkAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,17 @@ export class BotFrameworkAdapter extends BotAdapter implements IUserTokenProvide
// Create conversation
const parameters: ConversationParameters = { bot: reference.bot, members: [reference.user] } as ConversationParameters;
const client: ConnectorClient = this.createConnectorClient(reference.serviceUrl);

// Mix in the tenant ID if specified. This is required for MS Teams.
if (reference.conversation && reference.conversation.tenantId) {
// Putting tenantId in channelData is a temporary solution while we wait for the Teams API to be updated
parameters.channelData = { tenant: { id: reference.conversation.tenantId } };

// Permanent solution is to put tenantId in parameters.tenantId
parameters.tenantId = reference.conversation.tenantId;

}

const response = await client.conversations.createConversation(parameters);

// Initialize request and copy over new conversation ID and updated serviceUrl.
Expand Down
8 changes: 8 additions & 0 deletions libraries/botframework-schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export interface ConversationAccount {
* Indicates the type of the conversation in channels that distinguish between conversation types
*/
conversationType: string;
/**
* This conversation's tenant ID
*/
tenantId: string;
/**
* Channel id for the user or bot on this channel (Example: joe@smith.com, or @joesmith or
* 123456)
Expand Down Expand Up @@ -499,6 +503,10 @@ export interface ConversationParameters {
* (Optional) Topic of the conversation (if supported by the channel)
*/
topicName?: string;
/**
* (Optional) The tenant ID in which the conversation should be created
*/
tenantId?: string;
/**
* (Optional) When creating a new conversation, use this activity as the initial message to the
* conversation
Expand Down