Microsoft.Bot.Connector.ConversationsExtensions Class Reference

Extension methods for Conversations. More...

Static Public Member Functions

static ConversationResourceResponse CreateConversation (this IConversations operations, ConversationParameters parameters)
 CreateConversation More...
 
static async Task< ConversationResourceResponseCreateConversationAsync (this IConversations operations, ConversationParameters parameters, CancellationToken cancellationToken=default(CancellationToken))
 CreateConversation More...
 
static ConversationResourceResponse CreateDirectConversation (this IConversations operations, ChannelAccount bot, ChannelAccount user, Activity activity=null)
 Create a new direct conversation between a bot and a user More...
 
static ConversationResourceResponse CreateDirectConversation (this IConversations operations, string botAddress, string userAddress, Activity activity=null)
 Create a new direct conversation between a bot and a user More...
 
static async Task< ConversationResourceResponseCreateDirectConversationAsync (this IConversations operations, ChannelAccount bot, ChannelAccount user, Activity activity=null, CancellationToken cancellationToken=default(CancellationToken))
 Create a new direct conversation between a bot and a user More...
 
static async Task< ConversationResourceResponseCreateDirectConversationAsync (this IConversations operations, string botAddress, string userAddress, Activity activity=null, CancellationToken cancellationToken=default(CancellationToken))
 Create a new direct conversation between a bot and a user More...
 
static ErrorResponse DeleteActivity (this IConversations operations, string conversationId, string activityId)
 DeleteActivity More...
 
static async Task< ErrorResponseDeleteActivityAsync (this IConversations operations, string conversationId, string activityId, CancellationToken cancellationToken=default(CancellationToken))
 DeleteActivity More...
 
static ChannelAccount[] GetActivityMembers (this IConversations operations, string conversationId, string activityId)
 GetActivityMembers More...
 
static async Task< ChannelAccount[]> GetActivityMembersAsync (this IConversations operations, string conversationId, string activityId, CancellationToken cancellationToken=default(CancellationToken))
 GetActivityMembers More...
 
static ChannelAccount[] GetConversationMembers (this IConversations operations, string conversationId)
 GetConversationMembers More...
 
static async Task< ChannelAccount[]> GetConversationMembersAsync (this IConversations operations, string conversationId, CancellationToken cancellationToken=default(CancellationToken))
 GetConversationMembers More...
 
static ResourceResponse ReplyToActivity (this IConversations operations, Activity activity)
 Replyto an activity in an existing conversation More...
 
static ResourceResponse ReplyToActivity (this IConversations operations, string conversationId, string activityId, Activity activity)
 ReplyToActivity More...
 
static Task< ResourceResponseReplyToActivityAsync (this IConversations operations, Activity activity, CancellationToken cancellationToken=default(CancellationToken))
 Reply to an activity in an existing conversation More...
 
static async Task< ResourceResponseReplyToActivityAsync (this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken=default(CancellationToken))
 ReplyToActivity More...
 
static ResourceResponse SendToConversation (this IConversations operations, Activity activity)
 Send an activity to a conversation More...
 
static ResourceResponse SendToConversation (this IConversations operations, Activity activity, string conversationId)
 SendToConversation More...
 
static Task< ResourceResponseSendToConversationAsync (this IConversations operations, Activity activity, CancellationToken cancellationToken=default(CancellationToken))
 Send an activity to a conversation More...
 
static async Task< ResourceResponseSendToConversationAsync (this IConversations operations, Activity activity, string conversationId, CancellationToken cancellationToken=default(CancellationToken))
 SendToConversation More...
 
static ResourceResponse UpdateActivity (this IConversations operations, Activity activity)
 Update an activity in an existing conversation More...
 
static ResourceResponse UpdateActivity (this IConversations operations, string conversationId, string activityId, Activity activity)
 UpdateActivity More...
 
static Task< ResourceResponseUpdateActivityAsync (this IConversations operations, Activity activity, CancellationToken cancellationToken=default(CancellationToken))
 Update an activity in an existing conversation More...
 
static async Task< ResourceResponseUpdateActivityAsync (this IConversations operations, string conversationId, string activityId, Activity activity, CancellationToken cancellationToken=default(CancellationToken))
 UpdateActivity More...
 
static ResourceResponse UploadAttachment (this IConversations operations, string conversationId, AttachmentData attachmentUpload)
 UploadAttachment More...
 
static async Task< ResourceResponseUploadAttachmentAsync (this IConversations operations, string conversationId, AttachmentData attachmentUpload, CancellationToken cancellationToken=default(CancellationToken))
 UploadAttachment More...
 

Detailed Description

Extension methods for Conversations.

Definition at line 18 of file ConversationsExtensions.cs.

Member Function Documentation

static ConversationResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.CreateConversation ( this IConversations  operations,
ConversationParameters  parameters 
)
inlinestatic

CreateConversation

Create a new Conversation.

POST to this method with a

  • Bot being the bot creating the conversation
  • IsGroup set to true if this is not a direct message (default is false)
  • Members array contining the members you want to have be in the conversation.

The return value is a ResourceResponse which contains a conversation id which is suitable for use in the message payload and REST API uris.

Most channels only support the semantics of bots initiating a direct message conversation. An example of how to do that would be:

var resource = await connector.conversations.CreateConversation(new
ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
ChannelAccount("user1") } );
await connect.Conversations.SendToConversationAsync(resource.Id, new
Activity() ... ) ;
Parameters
operationsThe operations group for this extension method.
parametersParameters to create the conversation from

Definition at line 52 of file ConversationsExtensions.cs.

static async Task<ConversationResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.CreateConversationAsync ( this IConversations  operations,
ConversationParameters  parameters,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

CreateConversation

Create a new Conversation.

POST to this method with a

  • Bot being the bot creating the conversation
  • IsGroup set to true if this is not a direct message (default is false)
  • Members array contining the members you want to have be in the conversation.

The return value is a ResourceResponse which contains a conversation id which is suitable for use in the message payload and REST API uris.

Most channels only support the semantics of bots initiating a direct message conversation. An example of how to do that would be:

var resource = await connector.conversations.CreateConversation(new
ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new
ChannelAccount("user1") } );
await connect.Conversations.SendToConversationAsync(resource.Id, new
Activity() ... ) ;
Parameters
operationsThe operations group for this extension method.
parametersParameters to create the conversation from
cancellationTokenThe cancellation token.

Definition at line 92 of file ConversationsExtensions.cs.

static ConversationResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.CreateDirectConversation ( this IConversations  operations,
ChannelAccount  bot,
ChannelAccount  user,
Activity  activity = null 
)
inlinestatic

Create a new direct conversation between a bot and a user

Parameters
operationsThe operations group for this extension method.
botBot to create conversation from
userUser to create conversation with
activity(OPTIONAL) initial message to send to the new conversation

Definition at line 21 of file ConversationsEx.cs.

static ConversationResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.CreateDirectConversation ( this IConversations  operations,
string  botAddress,
string  userAddress,
Activity  activity = null 
)
inlinestatic

Create a new direct conversation between a bot and a user

Parameters
operationsThe operations group for this extension method.
botAddressBot to create conversation from
userAddressUser to create conversation with
activity(OPTIONAL) initial message to send to the new conversation

Definition at line 47 of file ConversationsEx.cs.

static async Task<ConversationResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.CreateDirectConversationAsync ( this IConversations  operations,
ChannelAccount  bot,
ChannelAccount  user,
Activity  activity = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

Create a new direct conversation between a bot and a user

Parameters
operationsThe operations group for this extension method.
botBot to create conversation from
userUser to create conversation with
activity(OPTIONAL) initial message to send to the new conversation
cancellationTokenThe cancellation token.

Definition at line 34 of file ConversationsEx.cs.

static async Task<ConversationResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.CreateDirectConversationAsync ( this IConversations  operations,
string  botAddress,
string  userAddress,
Activity  activity = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

Create a new direct conversation between a bot and a user

Parameters
operationsThe operations group for this extension method.
botAddressBot to create conversation from
userAddressUser to create conversation with
activity(OPTIONAL) initial message to send to the new conversation
cancellationTokenThe cancellation token

Definition at line 60 of file ConversationsEx.cs.

static ErrorResponse Microsoft.Bot.Connector.ConversationsExtensions.DeleteActivity ( this IConversations  operations,
string  conversationId,
string  activityId 
)
inlinestatic

DeleteActivity

Delete an existing activity.

Some channels allow you to delete an existing activity, and if successful this method will remove the specified activity.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdactivityId to delete

Definition at line 322 of file ConversationsExtensions.cs.

static async Task<ErrorResponse> Microsoft.Bot.Connector.ConversationsExtensions.DeleteActivityAsync ( this IConversations  operations,
string  conversationId,
string  activityId,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

DeleteActivity

Delete an existing activity.

Some channels allow you to delete an existing activity, and if successful this method will remove the specified activity.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdactivityId to delete
cancellationTokenThe cancellation token.

Definition at line 346 of file ConversationsExtensions.cs.

static ChannelAccount [] Microsoft.Bot.Connector.ConversationsExtensions.GetActivityMembers ( this IConversations  operations,
string  conversationId,
string  activityId 
)
inlinestatic

GetActivityMembers

Enumerate the members of an activity.

This REST API takes a ConversationId and a ActivityId, returning an array of ChannelAccount objects representing the members of the particular activity in the conversation.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdActivity ID

Definition at line 413 of file ConversationsExtensions.cs.

static async Task<ChannelAccount[]> Microsoft.Bot.Connector.ConversationsExtensions.GetActivityMembersAsync ( this IConversations  operations,
string  conversationId,
string  activityId,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

GetActivityMembers

Enumerate the members of an activity.

This REST API takes a ConversationId and a ActivityId, returning an array of ChannelAccount objects representing the members of the particular activity in the conversation.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdActivity ID
cancellationTokenThe cancellation token.

Definition at line 438 of file ConversationsExtensions.cs.

static ChannelAccount [] Microsoft.Bot.Connector.ConversationsExtensions.GetConversationMembers ( this IConversations  operations,
string  conversationId 
)
inlinestatic

GetConversationMembers

Enumerate the members of a converstion.

This REST API takes a ConversationId and returns an array of ChannelAccount objects representing the members of the conversation.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID

Definition at line 367 of file ConversationsExtensions.cs.

static async Task<ChannelAccount[]> Microsoft.Bot.Connector.ConversationsExtensions.GetConversationMembersAsync ( this IConversations  operations,
string  conversationId,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

GetConversationMembers

Enumerate the members of a converstion.

This REST API takes a ConversationId and returns an array of ChannelAccount objects representing the members of the conversation.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
cancellationTokenThe cancellation token.

Definition at line 388 of file ConversationsExtensions.cs.

static ResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivity ( this IConversations  operations,
Activity  activity 
)
inlinestatic

Replyto an activity in an existing conversation

Parameters
operationsThe operations group for this extension method.
activityActivity to send

Definition at line 106 of file ConversationsEx.cs.

static ResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivity ( this IConversations  operations,
string  conversationId,
string  activityId,
Activity  activity 
)
inlinestatic

ReplyToActivity

This method allows you to reply to an activity.

This is slightly different from SendToConversation().

  • SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel.
  • ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.

Use ReplyToActivity when replying to a specific activity in the conversation.

Use SendToConversation in all other cases.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdactivityId the reply is to (OPTIONAL)
activityActivity to send

Definition at line 260 of file ConversationsExtensions.cs.

static Task<ResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync ( this IConversations  operations,
Activity  activity,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

Reply to an activity in an existing conversation

Parameters
operationsThe operations group for this extension method.
activityActivity to send
cancellationTokenThe cancellation token.

Definition at line 123 of file ConversationsEx.cs.

static async Task<ResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync ( this IConversations  operations,
string  conversationId,
string  activityId,
Activity  activity,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

ReplyToActivity

This method allows you to reply to an activity.

This is slightly different from SendToConversation().

  • SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel.
  • ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.

Use ReplyToActivity when replying to a specific activity in the conversation.

Use SendToConversation in all other cases.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdactivityId the reply is to (OPTIONAL)
activityActivity to send
cancellationTokenThe cancellation token.

Definition at line 298 of file ConversationsExtensions.cs.

static ResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.SendToConversation ( this IConversations  operations,
Activity  activity 
)
inlinestatic

Send an activity to a conversation

Parameters
operationsThe operations group for this extension method.
activityActivity to send

Definition at line 75 of file ConversationsEx.cs.

static ResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.SendToConversation ( this IConversations  operations,
Activity  activity,
string  conversationId 
)
inlinestatic

SendToConversation

This method allows you to send an activity to the end of a conversation.

This is slightly different from ReplyToActivity().

  • SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel.
  • ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.

Use ReplyToActivity when replying to a specific activity in the conversation.

Use SendToConversation in all other cases.

Parameters
operationsThe operations group for this extension method.
activityActivity to send
conversationIdConversation ID

Definition at line 127 of file ConversationsExtensions.cs.

static Task<ResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.SendToConversationAsync ( this IConversations  operations,
Activity  activity,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

Send an activity to a conversation

Parameters
operationsThe operations group for this extension method.
activityActivity to send
cancellationTokenThe cancellation token.

Definition at line 92 of file ConversationsEx.cs.

static async Task<ResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.SendToConversationAsync ( this IConversations  operations,
Activity  activity,
string  conversationId,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

SendToConversation

This method allows you to send an activity to the end of a conversation.

This is slightly different from ReplyToActivity().

  • SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel.
  • ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.

Use ReplyToActivity when replying to a specific activity in the conversation.

Use SendToConversation in all other cases.

Parameters
operationsThe operations group for this extension method.
activityActivity to send
conversationIdConversation ID
cancellationTokenThe cancellation token.

Definition at line 162 of file ConversationsExtensions.cs.

static ResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.UpdateActivity ( this IConversations  operations,
Activity  activity 
)
inlinestatic

Update an activity in an existing conversation

Parameters
operationsThe operations group for this extension method.
activityActivity to update

Definition at line 146 of file ConversationsEx.cs.

static ResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.UpdateActivity ( this IConversations  operations,
string  conversationId,
string  activityId,
Activity  activity 
)
inlinestatic

UpdateActivity

Edit an existing activity.

Some channels allow you to edit an existing activity to reflect the new state of a bot conversation.

For example, you can remove buttons after someone has clicked "Approve" button.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdactivityId to update
activityreplacement Activity

Definition at line 192 of file ConversationsExtensions.cs.

static Task<ResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.UpdateActivityAsync ( this IConversations  operations,
Activity  activity,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

Update an activity in an existing conversation

Parameters
operationsThe operations group for this extension method.
activityActivity to update
cancellationTokenThe cancellation token.

Definition at line 163 of file ConversationsEx.cs.

static async Task<ResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.UpdateActivityAsync ( this IConversations  operations,
string  conversationId,
string  activityId,
Activity  activity,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

UpdateActivity

Edit an existing activity.

Some channels allow you to edit an existing activity to reflect the new state of a bot conversation.

For example, you can remove buttons after someone has clicked "Approve" button.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
activityIdactivityId to update
activityreplacement Activity
cancellationTokenThe cancellation token.

Definition at line 222 of file ConversationsExtensions.cs.

static ResourceResponse Microsoft.Bot.Connector.ConversationsExtensions.UploadAttachment ( this IConversations  operations,
string  conversationId,
AttachmentData  attachmentUpload 
)
inlinestatic

UploadAttachment

Upload an attachment directly into a channel's blob storage.

This is useful because it allows you to store data in a compliant store when dealing with enterprises.

The response is a ResourceResponse which contains an AttachmentId which is suitable for using with the attachments API.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
attachmentUploadAttachment data

Definition at line 465 of file ConversationsExtensions.cs.

static async Task<ResourceResponse> Microsoft.Bot.Connector.ConversationsExtensions.UploadAttachmentAsync ( this IConversations  operations,
string  conversationId,
AttachmentData  attachmentUpload,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inlinestatic

UploadAttachment

Upload an attachment directly into a channel's blob storage.

This is useful because it allows you to store data in a compliant store when dealing with enterprises.

The response is a ResourceResponse which contains an AttachmentId which is suitable for using with the attachments API.

Parameters
operationsThe operations group for this extension method.
conversationIdConversation ID
attachmentUploadAttachment data
cancellationTokenThe cancellation token.

Definition at line 492 of file ConversationsExtensions.cs.


The documentation for this class was generated from the following files: