microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.5k stars 2.44k forks source link

Determine events that an application needs to handle #5294

Closed johnataylor closed 4 years ago

johnataylor commented 5 years ago

Categorized Activities by Channel

The following tables show what events (Activities on the wire) can come from what Channels.

This is the key for the tables:

Symbol Meaning
:white_check_mark: The Bot should expect to receive this Activity
:x: The Bot should never expect to receive this Activity
:white_large_square: Currenly undetermined whether the Bot can receive this

Activities can meaningfully be split into separate categories. For each category we have a table of possible Activities.

Conversational

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
Message :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
MessageReaction :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :x: :x: :x: :x: :x:

("Message Reactions" are things like a "thumbs up" on a previous comment. They can happen out of order so can be thought of as similar to buttons. This Activity is currently sent by the Teams Channel.)

Welcome

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
ConversationUpdate :white_check_mark: :white_check_mark: :white_check_mark: :x: :white_large_square: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x: :white_check_mark: :x:
ContactRelationUpdate :x: :x: :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :white_check_mark: :x: :x:

Application Extensibility

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
Event.* :white_large_square: :white_check_mark: :white_check_mark: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:
Event.CreateConversation :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:
Event.ContinueConversation :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:

Microsoft Teams

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
Invoke.TeamsVerification :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :x: :x: :x: :x: :x:
Invoke.ComposeResponse :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :x: :x: :x: :x: :x:

This is very important: if using Dialogs for the OAuth Prompt to work the Invoke.TeamsVerification Activity must be forwarded to the Dialog.

Message Update

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
MessageUpdate :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :white_large_square: :x: :x: :x: :x:
MessageDelete :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :white_large_square: :x: :x: :x: :x:

OAuth

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
Event.TokenResponse :white_large_square: :white_check_mark: :white_check_mark: :x: :white_large_square: :white_large_square: :white_large_square: :x: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:

This is very important: if using Dialogs for the OAuth Prompt to work the Event.TokenResponse Activity must be forwarded to the Dialog.

Uncategorized

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
EndOfConversation :x: :white_check_mark: :white_check_mark: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:
InstallationUpdate :x: :white_check_mark: :white_check_mark: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:
Typing* :x: :white_check_mark: :white_check_mark: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:
Handoff :x: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:

Out of Use (includes Payment specific Invoke)


Summary of Activities supported per Channel

Cortana

Direct Line

Email

Facebook

GroupMe

Kik

Teams

Slack

Skype

Skype Business

Telegram

Twilio

Summary Table All Activities to All Channels

\ Cortana Direct Line Web Chat Email Facebook GroupMe Kik Teams Slack Skype Skype Business Telegram Twilio
Message :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
MessageReaction :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :x: :x: :x: :x: :x:
ConversationUpdate :white_check_mark: :white_check_mark: :white_check_mark: :x: :white_large_square: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x: :white_check_mark: :x:
ContactRelationUpdate :x: :x: :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :white_check_mark: :x: :x:
Event.* :white_large_square: :white_check_mark: :white_check_mark: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:
Event.CreateConversation :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:
Event.ContinueConversation :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:
Invoke.TeamsVerification :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :x: :x: :x: :x: :x:
Invoke.ComposeResponse :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :x: :x: :x: :x: :x:
MessageUpdate :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :white_large_square: :x: :x: :x: :x:
MessageDelete :x: :x: :x: :x: :x: :x: :x: :white_check_mark: :white_large_square: :x: :x: :x: :x:
Event.TokenResponse :white_large_square: :white_check_mark: :white_check_mark: :x: :white_large_square: :white_large_square: :white_large_square: :x: :white_large_square: :white_large_square: :white_large_square: :white_large_square: :white_large_square:
EndOfConversation :x: :white_check_mark: :white_check_mark: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:
InstallationUpdate :x: :white_check_mark: :white_check_mark: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:
Typing* :x: :white_check_mark: :white_check_mark: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:
Handoff :x: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:

Please note that WebSockets vs REST is another layer of complexity not yet accounted for in these charts. Typing activities only work on WebSockets and do not work on REST.

[edited by @corinagum]

Stevenic commented 5 years ago

I think Skype sends ContactRelationUpdate

EricDahlvang commented 5 years ago

• Bing is no longer a channel • Kik is a channel • Slack is a channel

Skype does NOT send ConversationUpdate (I don’t think Facebook does either).

johnataylor commented 5 years ago

We have updated both C# and JavaScript in master. I'm not closing this, just relabeling, because we would like to keep this open as a doc issue and something to base samples on.

johnataylor commented 5 years ago

@EricDahlvang can you take another look.

Anything I wasn't sure about I made italics.

EricDahlvang commented 5 years ago

@johnataylor this is one my favorite documents.

johnataylor commented 5 years ago

Web Chat will send: • "message": with "text" and/or "attachments" • "event": with "name" and "value" (as JSON/string) • "typing": if the user set an option, namely "sendTypingIndicator" Web Chat will not send "contactRelationUpdate". And Web Chat do not support "messageReaction", no one explicitly ask us to support this feature.

By default, Web Chat will render: • "message": will render as either carousel or stacked, depends on the option in the activity • "typing": will render for 5s and hide it, or until next activity come in • "conversationUpdate": will hide • "event": will hide • Others: will show a warning box (we never see it in production) Web devs can modify this render pipeline to add/remove/replace any custom render.

Devs can use Web Chat to send any activity type and payload, we don't doc this feature, we don't recommend this feature. We always recommend custom things goes to "event" activity.

corinagum commented 5 years ago

Does this need to be updated with LINE events?

corinagum commented 5 years ago

image I'm not sure if the :white_check_mark: is the correct here - the end of conversation docs say that Direct Line passes the activity forward to the client but does not do anything with this information. For Direct Line and Web Chat, should this be ⬜️ instead?

Also please note that WebSocket vs REST is a whole other layer of complexity to this conversation that is not accounted for above. For example, Typing only works on WebSocket and not REST, so Direct Line expecting to receive Typing is only true when using WebSockets.

Micro-Muncher commented 5 years ago

From the cortana side...

Hi; regarding how close conversation is used in Cortana

Desktop

  1. User talks to “client”. Client calls speech to text. Client sends text to agent.
  2. Agent figures out how to route the text. For example, open a third party skill.
  3. Agent lets client know a skill is opening. Client opens a “canvas” in which to have a conversation. We have a session. A “Microsoft.Launch” intent is added and the invocation text is sent to the bot.
  4. Client, agent, and bot now talk with request/response. Responses can include speak in which case text to speech is called by client.
  5. a. When the bot determines its purpose is fulfilled, it asks session to end the conversation. This should end the session and close the canvas. b. when the client closes, right now nothing happens on the bot, but client and agent tear down the conversation. (log fill with errors if any response is sent from the bot. ideally the canvas close should cause the event to flow through agent to the bot to do whatever clean up it needs to do.)

Mobile Same but different.

  1. There is no canvas to open. However the app now has a context and messages flow from app to agent to bot.
  2. Bot lets agent and client know that conversation/session is done.

So…. App< Hi I am Cortana. What can I do for you? User> Open SlowChess App< I’m on it! [Launch.Intent] SlowChess<Welcome to ShowChess. I see you have a game in progress. What is your move? Or do you want to see the board? User>move Q C6 to C7 SlowChess<Black Queen C6 takes White Pawn on C7. Want to see the board or leave? User>leave SlowChess<Thanks for playing! [endConversation] App< Cortana here. What can I do for you?

Hopefully one day we supported nested (stacked conversations with warm hand offs. In that case, endConversation pops the stack.

I have other use cases I’d love to see 😊

For example As a skill developer, I can set the duration up to a reasonable amount for the user to respond such that I can change the course of a conversation or provide feedback to the user. As a skill developer, the skill is notified upon the end of rendering such that I can I can reprompt the user or change the flow of a conversation. (For example, if I send an audio card, I am sent an event when it finishes playing.)(Parity with Google Actions.)

Micro-Muncher commented 5 years ago

Cortana ignores tokenResponse because it handles its own oauth. I [tried to] put a diagram together here. https://github.com/bw-kforce-ms/CortanaSkillsWIP/blob/master/Support/OAuth.md#supporting-multiple-channel-oauth

Micro-Muncher commented 5 years ago

Does cortana get conversation updates? We implement welcome by watching for a Microsoft.Launch intent.