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.
Tip
Prerequisites
- A DataMiner System connected to dataminer.services
- The latest version of the DataMiner Cloud Pack
- The DataMiner Teams bot
- Visual Studio with DataMiner Integration Studio
Overview
- Step 1: Create an Automation script solution
- Step 2: Create the Automation script
- Step 3: Publish the Automation script
- Step 4: Run the custom command
Step 1: Create an Automation script solution
In Visual Studio, select Create a new project.
In the template search box, search for DataMiner Automation Script Solution (Skyline Communications) and click Next.
Use DataMinerCustomCommands as the name for your solution, so you can reuse this solution for any future custom command scripts.
Choose a location to save the Automation script solution and click Next.
Specify HelloWorld as the name of your Automation Script, fill in your name as the author, and click Create.
Step 2: Create the Automation script
For the bot to find your script, you need to place it in the bot folder:
Locate the HelloWorld.xml file in the Solution Explorer and open it.
In the Folder tag, specify bot and save the file.
Locate the HelloWorld_1.cs file in the HelloWorld_1 C# project and open it.
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.
Locate the HelloWorld.xml file in the Solution Explorer and open it.
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.
Step 4: Run the custom command
Run the Hello World custom command.