Skip to content
alexvolchetsky edited this page Jul 23, 2020 · 5 revisions

Getting started

In general you would need to create controller with POST action method which receive object of AliceRequest class as parameter.

Method can return one of three response types according to Alice protocol:

  • AliceResponse - without images
  • AliceImageResponse - with one image
  • AliceGalleryResponse - with gallery of several images

Simple example of implementation of functionality described above:

using Microsoft.AspNetCore.Mvc;
using Yandex.Alice.Sdk.Models;

[ApiController]
[Route("[controller]")]
public class AliceController : ControllerBase
{
    [HttpPost]
    [Route("/alice")]
    public IActionResult Get(AliceRequest aliceRequest)
    {
        return Ok(new AliceResponse(aliceRequest, "Hello"));
    }
}
Clone this wiki locally