简体   繁体   中英

Bot Framework c# without Azure Connection to Telegram

I am Testing the deployment of MS Bot framework application without azure on my own host

  1. the bot is a mvc webapp and can be deployed anywhere
  2. our host has an SSL certificate and a vaild endpoint( https://example.com/api/messages )

My issue is with the Activity Connector as its'nt accepting api calls form telegram as follows:

   public async Task<HttpResponseMessage> Post([FromBody]Activity activity)<---
    {
        if (activity.GetActivityType() == ActivityTypes.Message)
        {
            await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
        }
        else
        {
            HandleSystemMessage(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
    }

That's because telegram doesn't send the activity of the same type as expected by bot framework. You may try to use activity.Properties where the json data from telegram are sent. And then deserialize it to custom models. (see this answer )

But it's not a good solution as for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM