Conversations class
代表 Conversations 的類別。
建構函式
Conversations(Connector |
建立交談。 |
方法
建構函式詳細資料
Conversations(ConnectorClientContext)
方法詳細資料
createConversation(ConversationParameters, RequestOptionsBase)
建立新的交談。 使用POST至這個方法
- Bot 是建立交談的 Bot
- IsGroup 如果這不是直接訊息,則 IsGroup 會設定為 true (預設值為 false)
- 數位,其中包含要包含在交談中的成員
傳回值是 ResourceResponse,其中包含適合用於訊息承載和 REST API URI 的交談標識符。
大部分通道只支援 Bot 起始直接訊息交談的語意。 如何執行此動作的範例如下:
const resource = await connector.conversations.createConversation({
bot,
members: [{ id: 'user1' }]
});
await connector.conversations.sendToConversation(resource.Id, ... );
function createConversation(parameters: ConversationParameters, options?: RequestOptionsBase): Promise<Models.ConversationsCreateConversationResponse>
參數
- parameters
-
ConversationParameters
要從中建立交談的參數
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsCreateConversationResponse>
Promise<Models.ConversationsCreateConversationResponse>
createConversation(ConversationParameters, RequestOptionsBase, ServiceCallback<ConversationResourceResponse>)
function createConversation(parameters: ConversationParameters, options: RequestOptionsBase, callback: ServiceCallback<ConversationResourceResponse>)
參數
- parameters
-
ConversationParameters
要從中建立交談的參數
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ConversationResourceResponse>
回呼
createConversation(ConversationParameters, ServiceCallback<ConversationResourceResponse>)
function createConversation(parameters: ConversationParameters, callback: ServiceCallback<ConversationResourceResponse>)
參數
- parameters
-
ConversationParameters
要從中建立交談的參數
- callback
-
ServiceCallback<ConversationResourceResponse>
回呼
deleteActivity(string, string, RequestOptionsBase)
刪除現有的活動。 某些通道可讓您刪除現有的活動,如果成功,這個方法將會移除指定的活動。
function deleteActivity(conversationId: string, activityId: string, options?: RequestOptionsBase): Promise<RestResponse>
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
要刪除的 activityId
- options
-
RequestOptionsBase
傳回
Promise<RestResponse>
Promise<msRest.RestResponse>
deleteActivity(string, string, RequestOptionsBase, ServiceCallback<void>)
function deleteActivity(conversationId: string, activityId: string, options: RequestOptionsBase, callback: ServiceCallback<void>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
要刪除的 activityId
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<void>
回呼
deleteActivity(string, string, ServiceCallback<void>)
function deleteActivity(conversationId: string, activityId: string, callback: ServiceCallback<void>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
要刪除的 activityId
- callback
-
ServiceCallback<void>
回呼
deleteConversationMember(string, string, RequestOptionsBase)
從交談中刪除成員。 此 REST API 會採用 ConversationId 和 memberId(類型為 string),並從交談中移除該成員。 如果該成員是交談的最後一個成員,也會刪除交談。
function deleteConversationMember(conversationId: string, memberId: string, options?: RequestOptionsBase): Promise<RestResponse>
參數
- conversationId
-
string
交談標識碼
- memberId
-
string
要從此交談中刪除的成員標識碼
- options
-
RequestOptionsBase
傳回
Promise<RestResponse>
Promise<msRest.RestResponse>
deleteConversationMember(string, string, RequestOptionsBase, ServiceCallback<void>)
function deleteConversationMember(conversationId: string, memberId: string, options: RequestOptionsBase, callback: ServiceCallback<void>)
參數
- conversationId
-
string
交談標識碼
- memberId
-
string
要從此交談中刪除的成員標識碼
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<void>
回呼
deleteConversationMember(string, string, ServiceCallback<void>)
function deleteConversationMember(conversationId: string, memberId: string, callback: ServiceCallback<void>)
參數
- conversationId
-
string
交談標識碼
- memberId
-
string
要從此交談中刪除的成員標識碼
- callback
-
ServiceCallback<void>
回呼
getActivityMembers(string, string, RequestOptionsBase)
列舉活動的成員。 此 REST API 會採用 ConversationId 和 ActivityId,傳回 ChannelAccount 物件的陣列,代表交談中特定活動的成員。
function getActivityMembers(conversationId: string, activityId: string, options?: RequestOptionsBase): Promise<Models.ConversationsGetActivityMembersResponse>
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
活動標識碼
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsGetActivityMembersResponse>
Promise<Models.ConversationsGetActivityMembersResponse>
getActivityMembers(string, string, RequestOptionsBase, ServiceCallback<ChannelAccount[]>)
function getActivityMembers(conversationId: string, activityId: string, options: RequestOptionsBase, callback: ServiceCallback<ChannelAccount[]>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
活動標識碼
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ChannelAccount[]>
回呼
getActivityMembers(string, string, ServiceCallback<ChannelAccount[]>)
function getActivityMembers(conversationId: string, activityId: string, callback: ServiceCallback<ChannelAccount[]>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
活動標識碼
- callback
-
ServiceCallback<ChannelAccount[]>
回呼
getConversationMember(string, string, RequestOptionsBase | ServiceCallback<ChannelAccount[]>, ServiceCallback<ChannelAccount[]>)
function getConversationMember(conversationId: string, memberId: string, options?: RequestOptionsBase | ServiceCallback<ChannelAccount[]>, callback?: ServiceCallback<ChannelAccount[]>): Promise<Models.ConversationsGetConversationMemberResponse>
參數
- conversationId
-
string
交談標識碼
- memberId
-
string
使用者的 MemberId
- options
-
RequestOptionsBase | ServiceCallback<ChannelAccount[]>
選擇性參數
- callback
-
ServiceCallback<ChannelAccount[]>
回呼
傳回
Promise<Models.ConversationsGetConversationMemberResponse>
getConversationMembers(string, RequestOptionsBase)
列舉交談的成員。 此 REST API 會取得 ConversationId,並傳回代表交談成員的 ChannelAccount 物件陣列。
function getConversationMembers(conversationId: string, options?: RequestOptionsBase): Promise<Models.ConversationsGetConversationMembersResponse>
參數
- conversationId
-
string
交談標識碼
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsGetConversationMembersResponse>
Promise<Models.ConversationsGetConversationMembersResponse>
getConversationMembers(string, RequestOptionsBase, ServiceCallback<ChannelAccount[]>)
function getConversationMembers(conversationId: string, options: RequestOptionsBase, callback: ServiceCallback<ChannelAccount[]>)
參數
- conversationId
-
string
交談標識碼
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ChannelAccount[]>
回呼
getConversationMembers(string, ServiceCallback<ChannelAccount[]>)
function getConversationMembers(conversationId: string, callback: ServiceCallback<ChannelAccount[]>)
參數
- conversationId
-
string
交談標識碼
- callback
-
ServiceCallback<ChannelAccount[]>
回呼
getConversationPagedMembers(string, ConversationsGetConversationPagedMembersOptionalParams)
一次列舉一頁交談的成員。 此 REST API 會採用 ConversationId。 您可以選擇提供 pageSize 和/或 continuationToken。 它會傳回 PagedMembersResult,其中包含 ChannelAccounts 陣列,代表交談的成員和可用來取得更多值的接續令牌。
每個呼叫都會傳回 ChannelAccounts 記錄的一頁。 頁面中的記錄數目可能會因通道和呼叫而有所不同。 pageSize 參數可用來做為建議。 如果沒有其他結果,回應將不會包含接續令牌。 如果交談中沒有任何成員,則成員在回應中將會是空的或不存在的。
對先前要求具有接續令牌的要求回應,可能很少會從先前的要求傳回成員。
function getConversationPagedMembers(conversationId: string, options?: ConversationsGetConversationPagedMembersOptionalParams): Promise<Models.ConversationsGetConversationPagedMembersResponse>
參數
- conversationId
-
string
交談標識碼
傳回
Promise<Models.ConversationsGetConversationPagedMembersResponse>
Promise<Models.ConversationsGetConversationPagedMembersResponse>
getConversationPagedMembers(string, ConversationsGetConversationPagedMembersOptionalParams, ServiceCallback<PagedMembersResult>)
function getConversationPagedMembers(conversationId: string, options: ConversationsGetConversationPagedMembersOptionalParams, callback: ServiceCallback<PagedMembersResult>)
參數
- conversationId
-
string
交談標識碼
選擇性參數
- callback
-
ServiceCallback<PagedMembersResult>
回呼
getConversationPagedMembers(string, ServiceCallback<PagedMembersResult>)
function getConversationPagedMembers(conversationId: string, callback: ServiceCallback<PagedMembersResult>)
參數
- conversationId
-
string
交談標識碼
- callback
-
ServiceCallback<PagedMembersResult>
回呼
getConversations(ConversationsGetConversationsOptionalParams)
列出此 Bot 參與的交談。 使用略過令牌從這個方法取得
傳回值是 ConversationsResult,其中包含 ConversationMembers 陣列和略過令牌。 如果略過令牌不是空的,則會傳回其他值。 使用傳回的令牌再次呼叫這個方法,以取得更多值。
每個 ConversationMembers 物件都包含交談的標識碼,以及描述交談成員的 ChannelAccounts 陣列。
function getConversations(options?: ConversationsGetConversationsOptionalParams): Promise<Models.ConversationsGetConversationsResponse>
參數
傳回
Promise<Models.ConversationsGetConversationsResponse>
Promise<Models.ConversationsGetConversationsResponse>
getConversations(ConversationsGetConversationsOptionalParams, ServiceCallback<ConversationsResult>)
function getConversations(options: ConversationsGetConversationsOptionalParams, callback: ServiceCallback<ConversationsResult>)
參數
選擇性參數
- callback
-
ServiceCallback<ConversationsResult>
回呼
getConversations(ServiceCallback<ConversationsResult>)
function getConversations(callback: ServiceCallback<ConversationsResult>)
參數
- callback
-
ServiceCallback<ConversationsResult>
回呼
replyToActivity(string, string, Partial<Activity>, RequestOptionsBase)
此方法可讓您回復活動。 這與 SendToConversation(稍有不同)。
- SendToConversation(conversationId) - 會根據通道的時間戳或語意,將活動附加至交談結尾。
- ReplyToActivity(conversationId,ActivityId) - 如果通道支援該活動,請將活動新增為另一個活動的回復。 如果通道不支援巢狀回復,ReplyToActivity 會回復為 SendToConversation。
在回復交談中的特定活動時,請使用 ReplyToActivity。
在所有其他情況下使用 SendToConversation。
function replyToActivity(conversationId: string, activityId: string, activity: Partial<Activity>, options?: RequestOptionsBase): Promise<Models.ConversationsReplyToActivityResponse>
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
activityId 回復為 (選擇性)
- activity
-
Partial<Activity>
要傳送的活動
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsReplyToActivityResponse>
Promise<Models.ConversationsReplyToActivityResponse>
replyToActivity(string, string, Partial<Activity>, RequestOptionsBase, ServiceCallback<ResourceResponse>)
function replyToActivity(conversationId: string, activityId: string, activity: Partial<Activity>, options: RequestOptionsBase, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
activityId 回復為 (選擇性)
- activity
-
Partial<Activity>
要傳送的活動
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ResourceResponse>
回呼
replyToActivity(string, string, Partial<Activity>, ServiceCallback<ResourceResponse>)
function replyToActivity(conversationId: string, activityId: string, activity: Partial<Activity>, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
activityId 回復為 (選擇性)
- activity
-
Partial<Activity>
要傳送的活動
- callback
-
ServiceCallback<ResourceResponse>
回呼
sendConversationHistory(string, Transcript, RequestOptionsBase)
這個方法可讓您將歷史活動上傳至交談。 傳送者必須確保歷史活動具有唯一標識碼和適當的時間戳。 用戶端會使用標識碼來處理重複的活動,而用戶端會使用時間戳,以正確的順序轉譯活動。
function sendConversationHistory(conversationId: string, history: Transcript, options?: RequestOptionsBase): Promise<Models.ConversationsSendConversationHistoryResponse>
參數
- conversationId
-
string
交談標識碼
- history
-
Transcript
歷史活動
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsSendConversationHistoryResponse>
Promise<Models.ConversationsSendConversationHistoryResponse>
sendConversationHistory(string, Transcript, RequestOptionsBase, ServiceCallback<ResourceResponse>)
function sendConversationHistory(conversationId: string, history: Transcript, options: RequestOptionsBase, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- history
-
Transcript
歷史活動
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ResourceResponse>
回呼
sendConversationHistory(string, Transcript, ServiceCallback<ResourceResponse>)
function sendConversationHistory(conversationId: string, history: Transcript, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- history
-
Transcript
歷史活動
- callback
-
ServiceCallback<ResourceResponse>
回呼
sendToConversation(string, Partial<Activity>, RequestOptionsBase)
這個方法可讓您將活動傳送至交談結尾。 這與 ReplyToActivity() 稍有不同。
- SendToConversation(conversationId) - 會根據通道的時間戳或語意,將活動附加至交談結尾。
- ReplyToActivity(conversationId,ActivityId) - 如果通道支援該活動,請將活動新增為另一個活動的回復。 如果通道不支援巢狀回復,ReplyToActivity 會回復為 SendToConversation。
在回復交談中的特定活動時,請使用 ReplyToActivity。
在所有其他情況下使用 SendToConversation。
function sendToConversation(conversationId: string, activity: Partial<Activity>, options?: RequestOptionsBase): Promise<Models.ConversationsSendToConversationResponse>
參數
- conversationId
-
string
交談標識碼
- activity
-
Partial<Activity>
要傳送的活動
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsSendToConversationResponse>
Promise<Models.ConversationsSendToConversationResponse>
sendToConversation(string, Partial<Activity>, RequestOptionsBase, ServiceCallback<ResourceResponse>)
function sendToConversation(conversationId: string, activity: Partial<Activity>, options: RequestOptionsBase, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- activity
-
Partial<Activity>
要傳送的活動
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ResourceResponse>
回呼
sendToConversation(string, Partial<Activity>, ServiceCallback<ResourceResponse>)
function sendToConversation(conversationId: string, activity: Partial<Activity>, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- activity
-
Partial<Activity>
要傳送的活動
- callback
-
ServiceCallback<ResourceResponse>
回呼
updateActivity(string, string, Partial<Activity>, RequestOptionsBase)
編輯現有的活動。 某些通道可讓您編輯現有的活動,以反映 Bot 交談的新狀態。
例如,您可以在某人按兩下 [核准] 按鈕之後移除按鈕。
function updateActivity(conversationId: string, activityId: string, activity: Partial<Activity>, options?: RequestOptionsBase): Promise<Models.ConversationsUpdateActivityResponse>
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
要更新的 activityId
- activity
-
Partial<Activity>
取代活動
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsUpdateActivityResponse>
Promise<Models.ConversationsUpdateActivityResponse>
updateActivity(string, string, Partial<Activity>, RequestOptionsBase, ServiceCallback<ResourceResponse>)
function updateActivity(conversationId: string, activityId: string, activity: Partial<Activity>, options: RequestOptionsBase, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
要更新的 activityId
- activity
-
Partial<Activity>
取代活動
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ResourceResponse>
回呼
updateActivity(string, string, Partial<Activity>, ServiceCallback<ResourceResponse>)
function updateActivity(conversationId: string, activityId: string, activity: Partial<Activity>, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- activityId
-
string
要更新的 activityId
- activity
-
Partial<Activity>
取代活動
- callback
-
ServiceCallback<ResourceResponse>
回呼
uploadAttachment(string, AttachmentData, RequestOptionsBase)
將附件直接上傳至通道的 Blob 記憶體。 這非常有用,因為它可讓您在處理企業時將數據儲存在相容的存放區中。
回應是 ResourceResponse,其中包含適合用於附件 API 的 AttachmentId。
function uploadAttachment(conversationId: string, attachmentUpload: AttachmentData, options?: RequestOptionsBase): Promise<Models.ConversationsUploadAttachmentResponse>
參數
- conversationId
-
string
交談標識碼
- attachmentUpload
-
AttachmentData
附件數據
- options
-
RequestOptionsBase
傳回
Promise<Models.ConversationsUploadAttachmentResponse>
Promise<Models.ConversationsUploadAttachmentResponse>
uploadAttachment(string, AttachmentData, RequestOptionsBase, ServiceCallback<ResourceResponse>)
function uploadAttachment(conversationId: string, attachmentUpload: AttachmentData, options: RequestOptionsBase, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- attachmentUpload
-
AttachmentData
附件數據
- options
-
RequestOptionsBase
選擇性參數
- callback
-
ServiceCallback<ResourceResponse>
回呼
uploadAttachment(string, AttachmentData, ServiceCallback<ResourceResponse>)
function uploadAttachment(conversationId: string, attachmentUpload: AttachmentData, callback: ServiceCallback<ResourceResponse>)
參數
- conversationId
-
string
交談標識碼
- attachmentUpload
-
AttachmentData
附件數據
- callback
-
ServiceCallback<ResourceResponse>
回呼