Cheat Sheet for Creating Apps
1. Add References from NuGet
Install-Package Easybots.Apps
2. Specify the App Name
[assembly: Easybots.Apps.EasybotsApp("My First App")]
3. Add Easybots Licence
Easybots Studio -> Develop and Manage Apps -> Get App Licence
4. Create Easybots Link
var link = Easybots.Apps.EasybotsLink.CreateLink();
5. Define Bot
class MyBot : Easybots.Apps.Easybot
{
public MyBot(string botId) : base(botId)
{}
}
6. Add Action
[Easybots.Apps.Action]
[return: Easybots.Apps.ParameterDescription("string", "long descr.", typeof(string), Order = 0)]
[return: Easybots.Apps.ParameterDescription("int", "long descr.", typeof(int), Order = 1)]
public object[] ActionWithMultipleInputs(
[Easybots.Apps.ParameterDescription("name", "The name", typeof(string), AllowUserInput = true, Order = 0)]
[Easybots.Apps.ParameterDescription("age", "How old is..", typeof(int), AllowUserInput = true, Order = 1)]
object[] inputs)
{
string name = (string)inputs[0];
int age = (int)inputs[1];
return new object[] { "some string", 1 };
}
7. Add Trigger
[Easybots.Apps.Trigger]
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
[return: Easybots.Apps.ParameterDescription("result", "long descr.", typeof(int))]
public int Trigger()
{
int result = 5;
this.TriggerInEasybotsPlatform(result);
return result;
}
8. Instantiate the bot
MyBot myBot1 = new MyBot("My Bot 1");