My First Bot
This section explains how to create a C# console application connected to the Easybots platform. The app will contain a bot named "My First Bot" that has one
Action named 'SayHelloWorld'

Overview
On high level, this example will:- Create new 'Console Application' in Visual Studio
- Add assembly references to the required DLLs
- Create a link from the console application to the Easybots plaform
- Add a licence, so that the app can communicate with the Easybots platform
- Create a bot with one action that can be called by other bots
Step by Step
Step 1: New Project
Using Visual Studio, create a new Console Application
Step 2: Adding References
Your app needs to reference the 'Easybots.Apps' assemblies. This example uses NuGet to add the references:
In Visual Studio, go to Tools -> NuGet Package Manager -> Package Manager Console
Run the command:
Install-Package Easybots.Apps
Step 3: Add a licence file to the project
Each easybots app must have a licence in order to connect to the platform. The licence is downloaded for free through the Easybots Studio.
3.1. In Visual Studio, add a new class file, with a name similar to 'Licence.cs'
3.2. In Easybots Studio, navigate to "Develop and Manage Apps" -> Get App Licence
3.3. Save the licence file to the same file 'Licence.cs' added in step 3.1.

Step 4: Create Link to the Easybots Platform
4.1. In the AssemblyInfo.cs file, specify the name of the app by adding the following line:
[assembly: Easybots.Apps.EasybotsApp("My First App")]4.2. Edit the
Main
method, connect to the platform by adding the following code line:
static void Main(string[] args) { var link = Easybots.Apps.EasybotsLink.CreateLink();Verify Step 4 - click to expand..// Prevent the app from exiting with a blocking call Console.ReadKey(); }
Start the app (console application), and open the Easybots Studio. In the App Explorer you should see "My First App", with no bots.

Step 5: Create Your First Bot
Add a new class that inherits from
Easybots.Apps.Easybot
. The base constructor expects an ID of the bot to be specified. We will name this bot "My First Bot".
class MyFirstBot : Easybots.Apps.Easybot { public MyFirstBot() : base("My First Bot") { } }Next, create an instance of this bot.
static void Main(string[] args) { var link = Easybots.Apps.EasybotsLink.CreateLink(); var bot = new MyFirstBot();Verify Step 5 - click to expand..// Prevent the app from exiting with a blocking call Console.ReadKey(); }
Start the app. In Easybots Studio, "My First App", should have one bot "My First Bot", without any triggers or actions.

Step 6: Add an 'Action'
Adding an Easybots 'Action' to your bot is done simply by decorating any public instance method with the attribute
[Easybots.Apps.ActionAttribute]
class MyFirstBot : Easybots.Apps.Easybot { public MyFirstBot() : base(ID: "My First Bot") { } [Easybots.Apps.Action] public string SayHelloWorld() { Console.WriteLine("Hello World!"); return "Hello World!"; } }Verify Step 6 - click to expand..
Start the app. In Easybots Studio, the bot "My First Bot", should have one action called 'SayHelloWorld'.

Well Done! Congratulations on creating your first bot.
Next: Your First Trigger