Dynamically Updating Cards in Bot Framework

By Jamie Sayer on

I’ve recently been working to update our in-house developed Microsoft Teams chatbot. This is used to interact with our System Center Service Manager based helpdesk, bringing it uptodate to use the v4 Bot FrameworkAdaptive Cards, and to make better use of the Microsoft LUIS natural language understanding. 

I hope to write a longer piece on this, but for this post I shall discuss the approach I’ve taken to implement dynamic updating of Adaptive Cards when users make changes to helpdesk incidents. 

The reason this is significant is because prior to this, a user making an update to an incident would not see this change reflected in cards already displayed. Even with the acknowledgment from the bot (with winning emojis to hopefully spark a smile), this often leads to users asking the bot to redisplay an incident to see the effect of the update for themselves. 

Fortunately, there is now a mechanism for updating cards (or any activity type for that matter.) The challenge around this is keeping track of the activity IDs, especially as an activity ID is only generated after it is submitted. 

The way that this is solved, or at least the approach I have taken, is to: 

  • Generate a unique ‘mapping’ ID during the composition of the original card, inserted as a field in the encoded action formssuch as the one used to resolvan incident in our application 
  • Once the card has been submitted, collect the activity ID 
  • Store our generated mapping ID and the activity ID in a table in the conversation state 
  • Then, when processing actions submitted from forms within a card, the mapping ID within the form is used to retrieve the original activity ID, and then an activity update is sent, specifying the original ID. 

The mapping table is an efficient key-value pair structure limited to 10 entries and scoped to the conversation state. 

Now, when a user changes the status, resolves or adds a note to an incident, the card is updated to reflect the changes made. No more having to ask the bot to show the incident again to be confident of the change and an altogether more responsive feeling system. I’ve made a diagram showing the rough flow of how this works, and a little gif below of it in action. 

Adding a bot to a legacy application (like our helpdesk) is a great example of how App Modernisation, an area in which Silversands is focused, does not necessarily mean completely replacing an existing solution, which may be heavily embedded or otherwise have residual or ongoing value to the business.  

Image: Process of bot addition

What’s next?

On the 29th October we are hosting a seminar in London on Intelligent App Modernisation where you can get a deeper insight on the art of the possible! We also post regular blogs on the latest updates and expert advice on Microsoft 365, Cloud and Hybrid IT, User Adoption and the Power Platform, so please do follow us.

Please do use the form below to get in touch with any questions or queries.

Contact us

  • This field is for validation purposes and should be left unchanged.

We have the expertise and the experience to provide specialist solutions and drive your business forward

Get in touch

How can we help you?

Get in touch

What updates would you like?