結束 Direct Line API 3.0 的交談End a conversation in Direct Line API 3.0

endOfConversation 活動表示通道或 Bot 已結束交談。The endOfConversation activity means the channel or bot has ended the conversation.

注意

雖然只有非常少數的通道會傳送 endOfConversation 事件,但 Cortana 是唯一接受該事件的通道。While the endOfConversation event is only sent by very few channels, the Cortana channel is the only one that accepts it. 其他通道 (包括 Direct Line) 不會實作這項功能,而會卸除或推進活動;每個通道都可決定如何回應 endOfConversation 活動。Other channels, including Direct Line, do not implement this functionality and instead drop or forward the activity on; each channel determines how to react to an endOfConversation activity.

傳送 endOfConversation 活動Send an endOfConversation activity

若要要求結束與 Cortana 通道的交談,請將「交談結束活動」POST 至通道的傳訊端點。To request to end a conversation with Cortana channel, POST End of Conversation Activity to the channel's messaging endpoint.

要求Request

POST https://directline.botframework.com/v3/directline/conversations/abc123/activities
Authorization: Bearer RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR2vtCX7CZj0LdjAPGfiCpg4Fv0
[other headers]
{
    "type": "endOfConversation",
    "from": {
        "id": "user1"
    }
}

回應Response

如果要求成功,則回應將包含已傳送之活動的識別碼。If the request is successful, the response will contain an ID for the activity that was sent.

HTTP/1.1 200 OK
[other headers]
{
  "id": "0004"
}

其他資源Additional resources