Table of Contents

Hello World

This tutorial shows you how to create your first custom command for the DataMiner Teams bot. You will create a simple command that, upon execution, will return "Hello world!".

Estimated duration: 10 minutes.

Prerequisites

Overview

Step 1: Create an Automation script solution

  1. In Visual Studio, select Create a new project.

  2. In the template search box, search for DataMiner Automation Script Solution (Skyline Communications) and click Next.

    DataMiner Automation Script Solution in Visual Studio

  3. Use DataMinerCustomCommands as the name for your solution, so you can reuse this solution for any future custom command scripts.

    Visual Studio configure your project

  4. Choose a location to save the Automation script solution and click Next.

  5. Specify HelloWorld as the name of your Automation Script, fill in your name as the author, and click Create.

    Visual Studio create Automation script

Step 2: Create the Automation script

  1. For the bot to find your script, you need to place it in the bot folder:

    1. Locate the HelloWorld.xml file in the Solution Explorer and open it.

      HelloWorld.xml file in Solution Explorer

    2. In the Folder tag, specify bot and save the file.

      HelloWorld.xml file in editor

  2. Locate the HelloWorld_1.cs file in the HelloWorld_1 C# project and open it.

    HelloWorld.cs file in Solution Explorer

  3. Add the C# code. This code will output a simple message saying "Hello World!".

    namespace HelloWorld_1
    {
        using System;
       using System.Collections.Generic;
       using System.Globalization;
       using System.Text;
       using Skyline.DataMiner.Automation;
    
       /// <summary>
       /// Represents a DataMiner Automation script.
       /// </summary>
       public class Script
       {
          /// <summary>
          /// The script entry point.
          /// </summary>
          /// <param name="engine">Link with SLAutomation process.</param>
          public void Run(IEngine engine)
          {
             engine.AddScriptOutput("Message", "Hello World!");
          }
       }
    }
    

Step 3: Publish the Automation script

When the custom command script is complete, you will need to publish it to the DataMiner System. You can do so using the built-in publish feature of DIS. Make sure that DIS can connect to the DataMiner System you want to upload your script to. You will need to edit the DIS settings so the DMA is selectable.

  1. Locate the HelloWorld.xml file in the Solution Explorer and open it.

    HelloWorld.xml file in editor

  2. At the top of the code window, click the arrow next to the Publish button and select the DataMiner System you want to upload the script to.

    Publish to DMA

Step 4: Run the custom command

  1. Start a conversation with the Teams bot.

  2. Run the Hello World custom command.

    Run the Hello World custom command