CreateConversationOptionsBuilder class

Fluent builder for CreateConversationOptions.

Example

const opts = CreateConversationOptionsBuilder
  .create('my-client-id', 'msteams')
  .withUser('user-aad-id')
  .withTenantId('tenant-id')
  .build()

Methods

build()

Builds and returns CreateConversationOptions.

create(ConversationClaims, string, string, Partial<ConversationParameters>)

Creates a new builder from an existing claims object (e.g. from a stored Conversation).

create(string, string, string, Partial<ConversationParameters>)

Creates a new builder from an agent client ID string.

isGroup(boolean)

Sets parameters.isGroup.

storeConversation(boolean)

Controls whether the resulting conversation is stored after creation.

withActivity(Partial<Activity>)

Sets parameters.activity. Defaults activity.type to 'message' if not provided.

withChannelData(object)

Merges additional channel-specific data into parameters.channelData.

withScope(string)

Overrides the default AzureBotScope OAuth scope.

withTeamsChannelId(string)

Sets parameters.isGroup = true and channelData.channel.id. Only has effect on msteams channels.

withTenantId(string)

Sets parameters.tenantId. On msteams channels, also sets channelData.tenant.id.

withTopicName(string)

Sets parameters.topicName.

withUser(ChannelAccount)
withUser(string, string)

Adds a member (the target user) to parameters.members.

Method Details

build()

Builds and returns CreateConversationOptions.

function build(): CreateConversationOptions

Returns

create(ConversationClaims, string, string, Partial<ConversationParameters>)

Creates a new builder from an existing claims object (e.g. from a stored Conversation).

static function create(claims: ConversationClaims, channelId: string, serviceUrl?: string, parameters?: Partial<ConversationParameters>): CreateConversationOptionsBuilder

Parameters

claims
ConversationClaims

JWT claims — aud must be the agent's client ID.

channelId

string

The target channel (e.g. 'msteams').

serviceUrl

string

Optional service URL override.

parameters

Partial<ConversationParameters>

Returns

create(string, string, string, Partial<ConversationParameters>)

Creates a new builder from an agent client ID string.

static function create(agentClientId: string, channelId: string, serviceUrl?: string, parameters?: Partial<ConversationParameters>): CreateConversationOptionsBuilder

Parameters

agentClientId

string

The agent's client (app) ID.

channelId

string

The target channel (e.g. 'msteams').

serviceUrl

string

Optional service URL override.

parameters

Partial<ConversationParameters>

Returns

isGroup(boolean)

Sets parameters.isGroup.

function isGroup(value: boolean): CreateConversationOptionsBuilder

Parameters

value

boolean

Returns

storeConversation(boolean)

Controls whether the resulting conversation is stored after creation.

function storeConversation(value: boolean): CreateConversationOptionsBuilder

Parameters

value

boolean

Returns

withActivity(Partial<Activity>)

Sets parameters.activity. Defaults activity.type to 'message' if not provided.

function withActivity(activity: Partial<Activity>): CreateConversationOptionsBuilder

Parameters

activity

Partial<Activity>

Returns

withChannelData(object)

Merges additional channel-specific data into parameters.channelData.

function withChannelData(data: object): CreateConversationOptionsBuilder

Parameters

data

object

Returns

withScope(string)

Overrides the default AzureBotScope OAuth scope.

function withScope(scope: string): CreateConversationOptionsBuilder

Parameters

scope

string

Returns

withTeamsChannelId(string)

Sets parameters.isGroup = true and channelData.channel.id. Only has effect on msteams channels.

function withTeamsChannelId(teamsChannelId: string): CreateConversationOptionsBuilder

Parameters

teamsChannelId

string

Returns

withTenantId(string)

Sets parameters.tenantId. On msteams channels, also sets channelData.tenant.id.

function withTenantId(tenantId: string): CreateConversationOptionsBuilder

Parameters

tenantId

string

Returns

withTopicName(string)

Sets parameters.topicName.

function withTopicName(name: string): CreateConversationOptionsBuilder

Parameters

name

string

Returns

withUser(ChannelAccount)

function withUser(account: ChannelAccount): CreateConversationOptionsBuilder

Parameters

account
ChannelAccount

Returns

withUser(string, string)

Adds a member (the target user) to parameters.members.

function withUser(userId: string, userName?: string): CreateConversationOptionsBuilder

Parameters

userId

string

userName

string

Returns