Skip to content

Commit

Permalink
Merge pull request #354 from finos/msteams-custom-help-page
Browse files Browse the repository at this point in the history
AdaptiveCard Help page for MS Teams
  • Loading branch information
pankajpkhandelwal-db committed Jul 6, 2022
2 parents 9db4811 + 22fac22 commit 0b216a1
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 16 deletions.
26 changes: 22 additions & 4 deletions demos/custom-help-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,26 @@ This bot provides an example of how you can override "baked-in" beans within Spr

This is applicable to all the beans in Spring Bot.

You will need to provide settings for the `application.yml` file according to your own environment. Since this bot only supports Symphony help pages, you should be sure to make sure you don't use the teams profile. In your `application.yml`, include:
You will need to provide settings for the `application.yml` file according to your own environment.

```
spring.profiles.active: symphony
```
----
For instance, you can change below `default` Symphony help page -

![Symphony Standard Help Page](img/symphony_std_help.JPG)

With this custom Expandable Card help page -

![Symphony Custom Help Page](img/symphony_custom_help_expand.JPG)

Help page expanded

![Symphony Custom Expanded Help Page](img/symphony_custom_help_collapse.JPG)

----
And for MS Teams, you can change for Channel & Chat from -

![MS Teams Standard Channel Help Page](img/teams_std_channel_help.JPG) ![MS Teams Standard Chat Help Page](img/teams_std_chat_help.JPG)

To consistent AdaptiveCard across Teams Channel & Chat -

![MS Teams Custom Channel Help Page](img/teams_custom_channel_help.JPG) ![MS Teams Custom Chat Help Page](img/teams_custom_chat_help.JPG)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/custom-help-bot/img/symphony_std_help.JPG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/custom-help-bot/img/teams_std_chat_help.JPG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions demos/custom-help-bot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
<version>9.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- Currently designed to work with Symphony alone, later will add support for MS Teams -->
<!-- <dependency>-->
<!-- <groupId>org.finos.springbot</groupId>-->
<!-- <artifactId>teams-chat-workflow-spring-boot-starter</artifactId>-->
<!-- <version>9.0.1-SNAPSHOT</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.finos.springbot</groupId>
<artifactId>teams-chat-workflow-spring-boot-starter</artifactId>
<version>9.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.finos.springbot.workflow.help.CommandDescription;
import org.finos.springbot.workflow.help.HelpController;
import org.finos.springbot.workflow.help.HelpPage;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Controller;

import java.util.Arrays;
Expand All @@ -17,11 +16,8 @@
/*
* Example of overriding framework functionality
* - Extend framework provided HelpController to override template used for rendering response
* - Here, we are specifying Profiles to make is available only when running in Symphony alone
* - Else, remove profile and provide custom-help-template for MS Teams as well
*/
@Controller
@Profile({"symphony & !teams"}) //To show custom help page when running Bot in Symphony alone
public class CustomHelpController extends HelpController {

private static final String DEFAULT_FORMATTER_PATTERN = "(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
import org.springframework.stereotype.Controller;

/**
* The custom help controller shows the first three options, and the others are on
* Symphony - The custom help controller shows the first three options, and the others are on
* a "more..." expander
* Teams - Usage of custom help page using AdaptiveCards
* @author rob@kite9.com
*
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"text": "Description",
"weight": "Bolder",
"wrap": true
}
],
"width": 50
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"text": "Type In Chat",
"weight": "Bolder",
"wrap": true
}
],
"width": 50
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"text": "${description}",
"wrap": true
}
],
"width": 50
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"text": "${join(foreach(examples,e, ' - ' + e), '\n')}",
"fontType": "Monospace",
"wrap": true
}
],
"width": 50
}
]
}
],
"$data": "${form.commands}"
}
]
}

0 comments on commit 0b216a1

Please sign in to comment.