8000 Adaptive Card Tabs · Issue #6138 · microsoft/botframework-sdk · GitHub
[go: up one dir, main page]

Skip to content
Adaptive Card Tabs #6138
@clearab

Description

@clearab

Overview

Teams is adding support for personal (1-1) tabs populated with Adaptive Cards based on invoke responses sent from a bot. When the user first views the tab, an invoke will be sent to the bot, and the bot will be able to respond with a list of Adaptive Cards. The cards will be rendered inside the tab as a flat list (more complex layouts are being considered for future iterations).

The tab itself will have a unique conversation ID, but not messages will be allowed to post to that ID. When Actions are taken on cards or task modules from the tab the developer will be able to respond with a new list of Adaptive Cards to be rendered.

Authentication responses are possible to either the initial load invoke, or an action invoke.

Events and responses

This section lists the events and responses this feature supports.

On Initial View

When the tab is first loaded, the Teams client will send an invoke named tab/fetch.

{
    "name": "tab/fetch",
    "value": {
        "tabContext": {
            "tabEntityId": "{tab_entity_id}“
        },
        "context": {
            "theme": "default"
        }
    },
    "conversation": {
        "id": "tab:hash(tabId_appId_userId)"
    }, 
    "imdisplayname": "{user_display_name}"
}

There are two valid responses to this request - auth (discussed later), or a tab object.

{
    "tab": {
        "type": "continue",
        "value": {
          "cards": [
            {
               "card": adaptiveCard1,
            },
            {
              "card": adaptiveCard2,
            }
         ]
       },
   },
   "responseType": "tab"
}

Card action

When an Action.Submit action is triggered from a card on a tab, a tab/submit invoke will be send to the bot:

{
    "name": "tab/submit",
    "value": {
        "data": {
            "type": "tab/submit",
            // ... <data properties>
        },
        "context": {
            "theme": "default"
        },
        "tabContext": {
            "tabEntityId": "{tab_entity_id}"
        },
    },
    "conversation": {
        "id": "tab:hash(tabId_appId_userId)"
    },
    "imdisplayname": "{user_display_name}"
}

The valid responses (again, other than auth) are either 200-OK or a tab object as defined.

Task modules - task/fetch

An Adaptive Card in a tab may choose to open a Task Module, which may result in a task/fetch invoke request being sent to the bot. When this action occurs from a tab, the invoke payload will look like:

{
    "name": "task/fetch",
    "value": {
        "data": {
            "type": "task/fetch"
        },
        "context": {
            "theme": "default",
        },
        "tabContext": {
            "tabEntityId": "{tab_entity_id}"
        }
    },
    "imdisplayname": "{user_display_name}",
    "conversation": {
        "id": "tab:hash(tabId_appId_userId)"
    }
}

The response for this is just a normal task object as it would be for any other task/fetch request.

###Task modules - task/submit

When the task module is submitted a task\submit invoke is sent.

{
    "name": "task/submit",
    "value": {
        "data": {serialized_data_object},
        "context": {
            "theme": "default"
        },
        "tabContext": {
            "tabEntityId": "{tab_entity_id}"
        },
    },
    "conversation": {
        "id": "tab:hash(tabId_appId_userId)"
    },
    "imdisplayname": "{user_display_name}",
}

The response to this is a task object as normal. However, for the purposes of Adaptive Card powered tabs, we add the ability to set the value property of the task object to a tab object, as in the below example:

{
  "task": {
    "value": {
      "tab": {
        "type": "continue",
        "value": {
          "cards": [
            {
              "card": adaptiveCard1
            },
            {
              "card": adaptiveCard2
            }
          ]
        }
      }
    },
    "type": "continue"
  },
  "responseType": "task"
}

Authentication

To support authentication, the following tab objects are also supported.

For OAuth:

{
    "tab": {
        "type": "auth",
        "suggestedActions":{
            "actions":[
                {
                    "type": "openUrl",
                    "value": "https://example.com/auth",
                    "title": "Sign in to this app"
                }
            ]
        }
    }
}

And for SSO:

{
    "tab": {
        "type": “silentAuth",
           "suggestedActions":{
              "actions":[
                  {
                     "type": "openUrl",
                     "value": "https://example.com/auth",
                     "title": "Sign in to this app"
                  }
               ]
         }
    }
}

Proposed changes

To support this, we'll need to add support for events outlined above, as well as schema for the objects defined.

Tracking Status

Dotnet SDK Issue

  • PR
  • Merged

Javascript SDK Issue

  • PR
  • Merged

Python SDK Issue

  • PR
  • Merged

Java SDK Issue

  • PR
  • Merged

**Docs

  • PR
  • Merged

Metadata

Metadata

Assignees

Labels

Area: TeamsThe issue is related to Teams supportP0Must Fix. Release-blocker

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0