Configure Custom Endpoint for Botframework Bot

前端 未结 2 643
太阳男子
太阳男子 2021-01-21 23:00

I want to create a bot in C#. How can I set the path for the endpoint.

I tried to do

        httpConfiguration.MapBotFramework(botConfig =>
        {         


        
相关标签:
2条回答
  • 2021-01-21 23:22

    Actually the code that worked for me is like below:

    httpConfiguration.MapBotFramework(botConfig =>
    {
        botConfig.BotFrameworkOptions.Paths = new BotFrameworkPaths()
        {
            BasePath = "/bot",
            MessagesPath = "/john"
        };
    });
    
    0 讨论(0)
  • 2021-01-21 23:26

    The endpoint will be hardcoded if you use the provided integration layer, you can change this by not using our integration layer. There is an example of this in this project

    Edit
    Interesting as I had not thought of it from that perspective. I like the other way because it gives you more open control of your endpoint and allows for multiple endpoints easily, but this would work as well. I was able to successfully change the endpoint of the bot by making a few changes to it.

    first I set up my .bot file like this replacing the old path with something different in the 'endpoint' property:

    {
      "name": "{your botname}",
      "padlock": "{your-padlock}",
      "services": [
        {
          "type": "endpoint",
          "name": "development", // "production" would work too
          "endpoint": "https://{your-site}.azurewebsites.net/bot/endpoint",
          "appId": "{your-app-id}",
          "appPassword": "{your-app-password}",
          "id": "1"
        }
      ],
      "version": "2.0"
    }
    

    then all I had to do was add this into my startup:

    options.Paths.BasePath = "/bot";
    options.Paths.MessagesPath = "/endpoint";
    
    0 讨论(0)
提交回复
热议问题