DEV Community

Arafat Tehsin
Arafat Tehsin

Posted on

Empower your existing Power Virtual Agents with Bot Framework Skills 🤖

Are you addressing your day to day customer service operations using Power Virtual Agents? Do you have multiple bots for your organization to cater specific use-cases? Do you want to combine all of them into one experience without re-writing it from the scratch? Would you like to learn how can you maximize your customers outreach by combining the Power Virtual Agent (No-Code) with Bot Framework (Code) bots? If this is what you're looking for then the good news is, Conversational AI team at Microsoft has released support for Skills with Power Virtual Agents and in this post, I will show you how we can add those Skills to our existing Power Virtual Agent.

You may encounter some hurdles while developing it but I am sure my post will definitely help you on the Power Virtual Agent's end as I did a bit of struggle behind the scenes to get my hands on this.

Account Balance with Bot Framework Skills

Skills

Skills are the bot (read: extensions of a bot) built on Bot Framework SDK v4.7+ that can be used by another bots. For example you've got a HR Bot in your organization which can be extended with the Finance Bot.

Alright! How to get started with that? I think a lot of conversations have been going around but... I would suggest you to go HERE. However, after following this tutorial, I am sure you're going to get stuck at something which I really want to highlight in my post.

As this is not a Skills 101 post, you must be a bot developer to understand the basics of it. Secondly, I will only discuss my learning on manifest and Azure AD as these were the only tricky parts of the whole development to connect with Power Virtual Agent. Also note that the current docs are absolutely good for Bot (v4.7) to Bot (v4.7) communication with no strings attached. ❤

If you're in Sydney and want to learn more about Power Virtual Agents hidden gems, Bot Framework Composer and much more then don't forget to join my session at the Power Platform Bootcamp!

First, appsettings.json 👈

In this file, you just have to add like this:

{
  "MicrosoftAppId": "<your app Id>",
  "MicrosoftAppPassword": "<your app password>",
  "AllowedCallers": [
    "<your PVA ID>"
  ]
}

Your PVA ID for allow list can be found here:

PVA ID

The Azure AD Challenge 🏂

It is super important to note that to add a skill to PVA, the user signed in PVA can only add a skill that is in her/his tenant. Also, there's an issue which is being tracked by the Product team i.e. if you're developing a bot using Skill's template so it won't populate the home page of App Registration with the bot's URL.

I created the Skill with the basic Echo Bot template therefore, I did an easy trick; changed the Home Page URL manually by going to the App Registration in Azure AD (or from Bot Channels Registration).

The Manifest Challenge 🏋️‍♀️

When I started exploring about Skills, I found out 4-6 types of different manifests but all of them were proved to be old (manifest 1.0) or wrong, not because they were badly written but the Conversational AI Teams (Bot Framework SDK, Virtual Assistant and PVA) are improving their products and services and it's one of the starting phases of unification. Anyway, I landed to the official forum for Power Virtual Agents where I interacted with the product team (thanks to Pawan, Salem & Mr. Chuck) and they worked with me closely to sort this out.

Now, if you check out this manifest file, it's perfect for Bot to Bot communication but when I tried to add it in my PVA, it said 0 input, 0 output. It means you can't pass anything to your skill hence it won't respond back.

0 Input 0 output

So to fix this, if you just add this snippet to your manifest.json then it will give you 1 input 0 output. 1 input because I'm going to ask for an accountNumber from PVA.

"activities": {
   "message": {
     "type": "message",
     "description": "Receives the user's' utterance and attempts to resolve it using the skill's LU models",
     "value": {
       "$ref": "#/definitions/accountNumber"
     }
   }
 },
 "definitions": {
   "accountNumber": {
     "type": "object",
     "required": [
     ],
     "properties": {
       "locale": {
         "type": "string",
         "description": "The current user's locale ISO code"
       }
     }
   }

Your full manifest will then look like this:

{
  "$schema": "https://schemas.botframework.com/schemas/skills/skill-manifest-2.0.0.json",
  "$id": "AMABankSkill",
  "name": "AMA Bank Skill bot",
  "version": "1.0",
  "description": "This skill extends the banking operations to facilitate the customer",
  "publisherName": "Arafat Tehsin",
  "privacyUrl": "https://www.arafattehsin.com/blog",
  "copyright": "Copyright (c) Arafat Tehsin. All rights reserved.",
  "license": "",
  "iconUrl": "https://www.arafattehsin.com/wp-content/uploads/2018/09/logo.png",
  "tags": [
    "arafat tehsin",
    "amabank",
    "bank"
  ],
  "endpoints": [
    {
      "name": "default",
      "protocol": "BotFrameworkV3",
      "description": "Default endpoint for the skill",
      "endpointUrl": "<your endpoint for the Skill>",
      "msAppId": "<your Azure Bot Channel Registration app Id for the Skill>"
    }
  ],
  "activities": {
    "message": {
      "type": "message",
      "description": "Receives the user's' utterance and attempts to resolve it using the skill's LU models",
      "value": {
        "$ref": "#/definitions/accountNumber"
      }
    }
  },
  "definitions": {
    "accountNumber": {
      "type": "object",
      "required": [
      ],
      "properties": {
        "locale": {
          "type": "string",
          "description": "The current user's locale ISO code"
        }
      }
    }
  }

Bingo! Now if you try to add your Skill to your PVA, you will see something like this:

1 Input 0 Output

This means, you're good to go with your Skill now. It can be added as an action. It will receive a message, send the activity from the Skill (even if the activity contains rich content like Adaptive Cards) and keep going back and forth, until Skill sends endOfConversation activity.

Check Balance Topic for Power Virtual Agent

I hope now it's good enough for you to give it a shot. If you want more help around it, please contact me on Twitter, LinkedIn or anywhere you like and I'll be happy to assist you.

Until next time.

Top comments (1)

Collapse
 
tushaar9027 profile image
tushaar9027

@arafattehsin For The Manifest Challenge what if i dont want to pass anything to bot . I just want to pass my message activity to skill bot.

Can you please help me to set this up.