Microsoft.Bot.Connector.Conversations Class Reference

Conversations operations. More...

Inheritance diagram for Microsoft.Bot.Connector.Conversations:

Public Member Functions

 Conversations (ConnectorClient client)
 Initializes a new instance of the Conversations class. More...
 
async Task< HttpOperationResponse< object > > CreateConversationWithHttpMessagesAsync (ConversationParameters parameters, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 CreateConversation More...
 
async Task< HttpOperationResponse< ErrorResponse > > DeleteActivityWithHttpMessagesAsync (string conversationId, string activityId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 DeleteActivity More...
 
async Task< HttpOperationResponse< object > > GetActivityMembersWithHttpMessagesAsync (string conversationId, string activityId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 GetActivityMembers More...
 
async Task< HttpOperationResponse< object > > GetConversationMembersWithHttpMessagesAsync (string conversationId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 GetConversationMembers More...
 
async Task< HttpOperationResponse< object > > ReplyToActivityWithHttpMessagesAsync (string conversationId, string activityId, Activity activity, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 ReplyToActivity More...
 
async Task< HttpOperationResponse< object > > SendToConversationWithHttpMessagesAsync (Activity activity, string conversationId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 SendToConversation More...
 
async Task< HttpOperationResponse< object > > UpdateActivityWithHttpMessagesAsync (string conversationId, string activityId, Activity activity, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 UpdateActivity More...
 
async Task< HttpOperationResponse< object > > UploadAttachmentWithHttpMessagesAsync (string conversationId, AttachmentData attachmentUpload, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
 UploadAttachment More...
 

Properties

ConnectorClient Client [get]
 Gets a reference to the ConnectorClient More...
 

Detailed Description

Conversations operations.

Definition at line 25 of file Conversations.cs.

Constructor & Destructor Documentation

Microsoft.Bot.Connector.Conversations.Conversations ( ConnectorClient  client)
inline

Initializes a new instance of the Conversations class.

Parameters
clientReference to the service client.

Definition at line 33 of file Conversations.cs.

Member Function Documentation

async Task<HttpOperationResponse<object> > Microsoft.Bot.Connector.Conversations.CreateConversationWithHttpMessagesAsync ( ConversationParameters  parameters,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
parametersParameters to create the conversation from
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 85 of file Conversations.cs.

async Task<HttpOperationResponse<ErrorResponse> > Microsoft.Bot.Connector.Conversations.DeleteActivityWithHttpMessagesAsync ( string  conversationId,
string  activityId,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
conversationIdConversation ID
activityIdactivityId to delete
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 1150 of file Conversations.cs.

async Task<HttpOperationResponse<object> > Microsoft.Bot.Connector.Conversations.GetActivityMembersWithHttpMessagesAsync ( string  conversationId,
string  activityId,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
conversationIdConversation ID
activityIdActivity ID
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 1574 of file Conversations.cs.

async Task<HttpOperationResponse<object> > Microsoft.Bot.Connector.Conversations.GetConversationMembersWithHttpMessagesAsync ( string  conversationId,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
conversationIdConversation ID
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 1354 of file Conversations.cs.

async Task<HttpOperationResponse<object> > Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync ( string  conversationId,
string  activityId,
Activity  activity,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
conversationIdConversation ID
activityIdactivityId the reply is to (OPTIONAL)
activityActivity to send
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 896 of file Conversations.cs.

async Task<HttpOperationResponse<object> > Microsoft.Bot.Connector.Conversations.SendToConversationWithHttpMessagesAsync ( Activity  activity,
string  conversationId,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
activityActivity to send
conversationIdConversation ID
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 356 of file Conversations.cs.

async Task<HttpOperationResponse<object> > Microsoft.Bot.Connector.Conversations.UpdateActivityWithHttpMessagesAsync ( string  conversationId,
string  activityId,
Activity  activity,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
conversationIdConversation ID
activityIdactivityId to update
activityreplacement Activity
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 610 of file Conversations.cs.

async Task<HttpOperationResponse<object> > Microsoft.Bot.Connector.Conversations.UploadAttachmentWithHttpMessagesAsync ( string  conversationId,
AttachmentData  attachmentUpload,
Dictionary< string, List< string >>  customHeaders = null,
CancellationToken  cancellationToken = default(CancellationToken) 
)
inline

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
conversationIdConversation ID
attachmentUploadAttachment data
customHeadersHeaders that will be added to request.
cancellationTokenThe cancellation token.

<return> A response object containing the response body and response headers. </return>

Implements Microsoft.Bot.Connector.IConversations.

Definition at line 1802 of file Conversations.cs.

Property Documentation

ConnectorClient Microsoft.Bot.Connector.Conversations.Client
get

Gets a reference to the ConnectorClient

Definition at line 45 of file Conversations.cs.


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