skip to Main Content

Is any way here to make accept Telegram.Bot.Types.Update update?

Currently, I have this code, but I would like to use Telegram objects

    [HttpPost]
    public async Task<OkResult> Post([FromBody]TelegramUpdate update) //my model
    {
        //code
    }

When I passing that I getting 400 Bad Request

Through Postman is 415 Unsupported Media Type and Bad request

If I hits controller by InlineKeyboard breakpoint works but with object with null values.
In console (ngrok) shown 200 ok and then 400 Bad Request

2

Answers


  1. Install Nuget package "Microsoft.AspNetCore.Mvc.NewtonsoftJson"

    And use it on your Startup.cs file:

    services.AddControllers().AddNewtonsoftJson();
    
    Login or Signup to reply.
  2. Thanks to Robson Previato,

    Install Nuget package "Microsoft.AspNetCore.Mvc.NewtonsoftJson"

    and using it in Controllers help me

    services.AddControllers().AddNewtonsoftJson();

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search