Search code examples
botframework

How to access Bot Skills via API?


Does Microsoft publish Bot Skills as a API for consumption. I have a need to invoke botskills command programmatically in order to publish it to my VA. How can i do this?


Solution

  • botskills is a Command Line Tool, so no, there's no direct API for it.

    That being said, most programming languages allow you to execute shell commands. Based on your post history, it looks like you're using Node. So, you can do something like this:

    const { exec } = require("child_process");
    
    exec("botskills connect --localManifest "./skills/customSkill/customSkillManifest.json" --skillsFile "./skills.json" --cs --verbose", (error, stdout, stderr) => {
        if (error) {
            console.log(`error: ${error.message}`);
            return;
        }
        if (stderr) {
            console.log(`stderr: ${stderr}`);
            return;
        }
        console.log(`stdout: ${stdout}`);
    });
    

    If botskills is hosted somewhere and you need to use it like an API, you can always add an endpoint to your bot:

    server.post('/api/botskills', (req, res) => {
      // 1. Do some kind of conditional check on the request to make sure it is allowed to do this
      // 2. Execute the command in the previous code block
      // 3. Return a response
    }
    

    If your questions is not about the botskills package/CLI and is actually about "Bot Skills", you interact with a skill just like a bot. They're basically the same thing and you'd use the same REST API.