Search code examples
botframeworkmicrosoft-teams

Display Charts and Graphs in MS Teams using Microsoft Bot Framework


I am currently working on a bot built using MS Bot Framework and Ii'm looking for a solution to display charts (i.e. pie charts, etc.) inside MS Teams using Bot Framework. The goal is to get data from a SQL database, process it to form a chart and send it as an attachment or adaptive card to MS Teams.


Solution

  • Your question is a bit vague - I'm not exactly sure what you're asking for exactly, but maybe this can help: I can think of 3 possible ways to do this:

    1) Generate your graph programmatically, e.g. in C# (there are a bunch of possibly libraries for this), save it to a temporary location (e.g. Azure blob storage) and then embed the link as a message from the bot

    2) same as above, but insert it into an adaptive card (not required, but maybe if you want to send other things like text message etc.

    3) Create a Tab to go along with your bot, which is basically a web page you host somewhere, that shows the graph using, for example, a javascript library. The tab appears along the top in the bot's conversation with the user, and you can have an adaptive card with a button that deep links to the tab, for instance.

    Which approach you choose might depend on the size of the chart, whether it needs to be interactive, and I'm sure other possible factors. There are also other possible ways to tackle this I'm sure, but these are hopefully some good ideas/starting points.