Get Started with .NET

Introduction

Bots can be built using .NET bots in two ways:

  1. Use the Symphony bot generator. Launch the generator, choose the .NET language and select your template.
  2. Use symphony-apiclient-dotnet, the Symphony .NET client NuGet package, and add it as a dependency of your .NET application.

The remainder of this document describes the Symphony .NET client NuGet package .

Installing the Symphony .NET Client NuGet Package

Use the following commands to install the package:

//Package Manager
Install-Package symphony-apiclient-dotnet -Version 1.0.1	

//dotnet cli
dotnet add package symphony-apiclient-dotnet --version 1.0.1

Usage Example

The following shows an example of using the package:

using System;
using System.IO;
using apiClientDotNet.Models;
using apiClientDotNet;
using apiClientDotNet.Listeners;
using apiClientDotNet.Services;
using apiClientDotNet.Models.Events;
...
  
public void ChatBotTest()
        {
            SymBotClient symBotClient = new SymBotClient();
            DatafeedEventsService datafeedEventsService = new DatafeedEventsService();
            SymConfig symConfig = symBotClient.initBot("PATH");
            RoomListener botLogic = new BotLogic();
            DatafeedClient datafeedClient = datafeedEventsService.init(symConfig);
            Datafeed datafeed = datafeedEventsService.createDatafeed(symConfig, datafeedClient);
            datafeedEventsService.addRoomListener(botLogic);
            datafeedEventsService.getEventsFromDatafeed(symConfig, datafeed, datafeedClient);
        }