ConversationsOperations Class

ConversationsOperations operations.

You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.

Inheritance
builtins.object
ConversationsOperations

Constructor

ConversationsOperations(client, config, serializer, deserializer)

Parameters

Name Description
client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Variables

Name Description
api_version

The API version to use for the request. Constant value: "v3".

Methods

create_conversation

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)
  • Array containing the members to include 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() ... ) ;.
delete_activity

DeleteActivity.

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

delete_conversation_member

DeleteConversationMember.

Deletes a member from a conversation. This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member of the conversation, the conversation will also be deleted.

get_activity_members

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.

get_conversation_member

GetConversationMember.

Get a member of a conversation. This REST API takes a ConversationId and memberId and returns a ChannelAccount object representing the member of the conversation.

get_conversation_members

GetConversationMembers.

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

get_conversation_paged_members

GetConversationPagedMembers.

Enumerate the members of a conversation one page at a time. This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members of the conversation and a continuation token that can be used to get more values. One page of ChannelAccounts records are returned with each call. The number of records in a page may vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no additional results the response will not contain a continuation token. If there are no members in the conversation the Members will be empty or not present in the response. A response to a request that has a continuation token from a prior request may rarely return members from a previous request.

get_conversations

GetConversations.

List the Conversations in which this bot has participated. GET from this method with a skip token The return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. If the skip token is not empty, then there are further values to be returned. Call this method again with the returned token to get more values. Each ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that describe the members of the conversation.

get_teams_conversation_paged_members

GetTeamsConversationPagedMembers.

Enumerate the members of a Teams conversation one page at a time. This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members of the conversation and a continuation token that can be used to get more values. One page of ChannelAccounts records are returned with each call. The number of records in a page may vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no additional results the response will not contain a continuation token. If there are no members in the conversation the Members will be empty or not present in the response. A response to a request that has a continuation token from a prior request may rarely return members from a previous request.

reply_to_activity

ReplyToActivity.

This method allows you to reply to an activity. This is slightly different from SendToConversation().

  • SendToConversation(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.
send_conversation_history

SendConversationHistory.

This method allows you to upload the historic activities to the conversation. Sender must ensure that the historic activities have unique ids and appropriate timestamps. The ids are used by the client to deal with duplicate activities and the timestamps are used by the client to render the activities in the right order.

send_to_conversation

SendToConversation.

This method allows you to send an activity to the end of a conversation. This is slightly different from ReplyToActivity().

  • SendToConversation(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.
update_activity

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.

upload_attachment

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.

create_conversation

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)
  • Array containing the members to include 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() ... ) ;.
create_conversation(parameters, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
parameters
Required
<xref:botframework.connector.models.ConversationParameters>

Parameters to create the conversation from

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.ConversationResourceResponse>,
<xref:msrest.pipeline.ClientRawResponse>

ConversationResourceResponse or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

delete_activity

DeleteActivity.

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

delete_activity(conversation_id, activity_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

activity_id
Required
str

activityId to delete

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

delete_conversation_member

DeleteConversationMember.

Deletes a member from a conversation. This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member of the conversation, the conversation will also be deleted.

delete_conversation_member(conversation_id, member_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

member_id
Required
str

ID of the member to delete from this conversation

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

get_activity_members

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.

get_activity_members(conversation_id, activity_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

activity_id
Required
str

Activity ID

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
list[<xref:botframework.connector.models.ChannelAccount>],
<xref:msrest.pipeline.ClientRawResponse>

list or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

get_conversation_member

GetConversationMember.

Get a member of a conversation. This REST API takes a ConversationId and memberId and returns a ChannelAccount object representing the member of the conversation.

get_conversation_member(conversation_id, member_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation Id

member_id
Required
str

Member Id

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
list[<xref:botframework.connector.models.ChannelAccount>],
<xref:msrest.pipeline.ClientRawResponse>

list or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

get_conversation_members

GetConversationMembers.

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

get_conversation_members(conversation_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
list[<xref:botframework.connector.models.ChannelAccount>],
<xref:msrest.pipeline.ClientRawResponse>

list or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

get_conversation_paged_members

GetConversationPagedMembers.

Enumerate the members of a conversation one page at a time. This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members of the conversation and a continuation token that can be used to get more values. One page of ChannelAccounts records are returned with each call. The number of records in a page may vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no additional results the response will not contain a continuation token. If there are no members in the conversation the Members will be empty or not present in the response. A response to a request that has a continuation token from a prior request may rarely return members from a previous request.

get_conversation_paged_members(conversation_id, page_size=None, continuation_token=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

page_size
int

Suggested page size

default value: None
continuation_token
str

Continuation Token

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.PagedMembersResult>,
<xref:msrest.pipeline.ClientRawResponse>

PagedMembersResult or ClientRawResponse if raw=true

Exceptions

Type Description
msrest.exceptions.HttpOperationError

get_conversations

GetConversations.

List the Conversations in which this bot has participated. GET from this method with a skip token The return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. If the skip token is not empty, then there are further values to be returned. Call this method again with the returned token to get more values. Each ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that describe the members of the conversation.

get_conversations(continuation_token=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
continuation_token
str

skip or continuation token

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.ConversationsResult>,
<xref:msrest.pipeline.ClientRawResponse>

ConversationsResult or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

get_teams_conversation_paged_members

GetTeamsConversationPagedMembers.

Enumerate the members of a Teams conversation one page at a time. This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided. It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members of the conversation and a continuation token that can be used to get more values. One page of ChannelAccounts records are returned with each call. The number of records in a page may vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no additional results the response will not contain a continuation token. If there are no members in the conversation the Members will be empty or not present in the response. A response to a request that has a continuation token from a prior request may rarely return members from a previous request.

get_teams_conversation_paged_members(conversation_id, page_size=None, continuation_token=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

page_size
int

Suggested page size

default value: None
continuation_token
str

Continuation Token

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.PagedMembersResult>,
<xref:msrest.pipeline.ClientRawResponse>

PagedMembersResult or ClientRawResponse if raw=true

Exceptions

Type Description
msrest.exceptions.HttpOperationError

reply_to_activity

ReplyToActivity.

This method allows you to reply to an activity. This is slightly different from SendToConversation().

  • SendToConversation(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.
reply_to_activity(conversation_id, activity_id, activity, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

activity_id
Required
str

activityId the reply is to (OPTIONAL)

activity
Required
<xref:botframework.connector.models.Activity>

Activity to send

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.ResourceResponse>,
<xref:msrest.pipeline.ClientRawResponse>

ResourceResponse or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

send_conversation_history

SendConversationHistory.

This method allows you to upload the historic activities to the conversation. Sender must ensure that the historic activities have unique ids and appropriate timestamps. The ids are used by the client to deal with duplicate activities and the timestamps are used by the client to render the activities in the right order.

send_conversation_history(conversation_id, activities=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

activities
list[<xref:botframework.connector.models.Activity>]

A collection of Activities that conforms to the Transcript schema.

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.ResourceResponse>,
<xref:msrest.pipeline.ClientRawResponse>

ResourceResponse or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

send_to_conversation

SendToConversation.

This method allows you to send an activity to the end of a conversation. This is slightly different from ReplyToActivity().

  • SendToConversation(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.
send_to_conversation(conversation_id, activity, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

activity
Required
<xref:botframework.connector.models.Activity>

Activity to send

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.ResourceResponse>,
<xref:msrest.pipeline.ClientRawResponse>

ResourceResponse or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

update_activity

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.

update_activity(conversation_id, activity_id, activity, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

activity_id
Required
str

activityId to update

activity
Required
<xref:botframework.connector.models.Activity>

replacement Activity

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.ResourceResponse>,
<xref:msrest.pipeline.ClientRawResponse>

ResourceResponse or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

upload_attachment

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.

upload_attachment(conversation_id, attachment_upload, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
conversation_id
Required
str

Conversation ID

attachment_upload
Required
<xref:botframework.connector.models.AttachmentData>

Attachment data

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:botframework.connector.models.ResourceResponse>,
<xref:msrest.pipeline.ClientRawResponse>

ResourceResponse or ClientRawResponse if raw=true

Exceptions

Type Description
botframework.connector.models.ErrorResponseException

Attributes

models

models = <module 'botframework.connector.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\botframework\\connector\\models\\__init__.py'>